站内搜索: 请输入搜索关键词

当前页面: 开发资料首页JSP 专题include问题

include问题

摘要: include问题


我的tomcat/webapps下有两个网站,第一个网站文件夹名是a,第二个网站文件夹名为b,
现在我想在a网站的index.jsp中将b网站的index.jsp包含进来,
用的方法是:在a/index.jsp中用语句<@include file="/b/index.jsp">,可是提示出错,404错误,
怎么办呢?


把b文件的路径打完整,包括http://...


又提示错误:



HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /index.jsp(29,0) File "/http://localhost/b/index.jsp" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:90)
org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:339)
org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:372)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:28)


这就是你包含的文件的问题了,至少文件找到了.如果方便,希望能把2个文件的详细代码贴出,更方便解决.


404跟500是刚学JSP最容易出现的2个错误


/是针对本应用的,所以这种方式找不到b应用的文件


to ldg_2(绿豆糕)
================
那我应该怎么做呢?请大侠指点..


ldg_2(绿豆糕)
/是针对本应用的,所以这种方式找不到b应用的文件

说的很清楚了



用别的方法也可以呀,难道这个问题就没法解决吗?


<@include file="../b/index.jsp">
你采用<@include file="/b/index.jsp">,是在a文件夹下找b文件夹,当然找不到了。


xiariguji(夏日孤寂)
=============
还是出错,

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /index.jsp(29,0) File "/../b/index.jsp" not found




你用struts的module功能试一下哈~


↑返回目录
前一篇: 网站发布问题
后一篇: 关于EL表达式判断两个字符串内容相等的问题