如何在web.xml文件中引入其他的xml文件(web.xml如何拆分)
?
?
????????????????<web-app version="2.5"?
?????????????????????xmlns="http://java.sun.com/xml/ns/j2ee"?
?????????????????????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
? ? ? ? ? ? ? ? ? ? ?xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
?
? ? ? ? ? ? ? ? ? ? ?http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"?? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
????????????????>????
????????????????&test;
????????????????&admin;
? ? ? ? ? ? ? ? </web-app>
????????????以上修改即可,web.xml会在开头引入你的test.xml.然后??&test;表示你放的地方。?
? ? ? ? ? ? 如果设定的是相当路径,可以如此设定:
????????????如果test.xml和web.xml在同一个文件夹,则???[<!ENTITY?test?SYSTEM? "test.xml">]
????????????如果test.xml在web.xml所在文件夹的ccc文件夹中,则??[<!ENTITY?test?SYSTEM? "ccc/test.xml">]
?
? 3.以上做法在Window下使用,不會出錯,但是部署到Linux時就會出錯:
? ? ? ? ? ??2011-12-15 09:09:39,136 ERROR [org.apache.jasper.xmlparser.ParserUtils] - Invalid PUBLIC ? ? ID: null
org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/web.xml at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:113) at org.apache.jasper.compiler.JspConfig.processWebDotXml(JspConfig.java:70) at org.apache.jasper.compiler.JspConfig.init(JspConfig.java:188) at org.apache.jasper.compiler.JspConfig.findJspProperty(JspConfig.java:240) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:160) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:470) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:474) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) at javaservlets.common.util.IndexServlet.doProcess(IndexServlet.java:368) at javaservlets.common.util.IndexServlet.doGet(IndexServlet.java:712) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419) at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675) at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:619)
?不知道原因?
?