jsp include is not working from subdirectories -
i not able include jsp file subdirectory. have include file include subfolder file in test folder.
i tried code
<%@ include file="../../include/file.jsp"%>
inside file ../test/sample.jsp
but i'm getting error like
org.apache.jasper.jasperexception: /all.jsp(132,1) file "/../../include/file.jsp" not found org.apache.jasper.compiler.defaulterrorhandler.jsperror(defaulterrorhandler.java:40) org.apache.jasper.compiler.errordispatcher.dispatch(errordispatcher.java:407) org.apache.jasper.compiler.errordispatcher.jsperror(errordispatcher.java:88) org.apache.jasper.compiler.parser.processincludedirective(parser.java:300) org.apache.jasper.compiler.parser.parseincludedirective(parser.java:333) org.apache.jasper.compiler.parser.parsedirective(parser.java:442) org.apache.jasper.compiler.parser.parsefiledirectives(parser.java:1749) org.apache.jasper.compiler.parser.parse(parser.java:127) org.apache.jasper.compiler.parsercontroller.doparse(parsercontroller.java:255) org.apache.jasper.compiler.parsercontroller.parsedirectives(parsercontroller.java:120) org.apache.jasper.compiler.compiler.generatejava(compiler.java:180) org.apache.jasper.compiler.compiler.compile(compiler.java:347) org.apache.jasper.compiler.compiler.compile(compiler.java:327) org.apache.jasper.compiler.compiler.compile(compiler.java:314) org.apache.jasper.jspcompilationcontext.compile(jspcompilationcontext.java:592) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:326) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:313) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:260) javax.servlet.http.httpservlet.service(httpservlet.java:717)
update: think problem related tomcat.when used map root folder context in tomcat working , when add root folder host,the problem arises.i want use host.
here in tomcat config doesn't work:
<host name="abc.test" appbase="c:\abcd" unpackwars="true" autodeploy="true" xmlvalidation="false" xmlnamespaceaware="false"> <context path="/" docbase="c:\abcd" reloadable="true" crosscontext="true"> .................................................................. ............................................................... </context> </host>
but works in following config
<host name="abc.test" appbase="c:\abc" unpackwars="true" autodeploy="true" xmlvalidation="false" xmlnamespaceaware="false"> <context path="/lang" docbase="c:\subdir" reloadable="true" crosscontext="true"> .................................................................. ............................................................... </context> <context path="/" docbase="c:\subdir" reloadable="true" crosscontext="true"> .................................................................. ............................................................... </context> </host>
ie, jsp include subfolders works in http://abc.test/lang/ , doesn't work http://abc.test in both cases, files same directory can included
i've found using full path info (from root directory) sans leading slash seems work...
in other words, instead of
../../../directory/file
i use:
firstsubdir/secondsubdir/thirdsubdir/directory/file
including leading slash (ie: /firstsubdir/se...
) seems cause same issue noted.
Comments
Post a Comment