首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

跪求!<jsp:include page="1.jsp">解决思路

2013-09-11 
跪求!!!!啊~~jsp:include page1.jsp/////////////////////////////////////////2Jsp.jsp%@ page lan

跪求!!!!啊~~<jsp:include page="1.jsp">
/////////////////////////////////////////
2Jsp.jsp


<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
   
  <title>My JSP '2Jsp.jsp' starting page</title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">  
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

  </head>
  
  <body>
<jsp:include page="1.jsp"></jsp:include>
<p>帮助:
正文…………</p>
  </body>
</html>


///////////////////////////////
1.jsp


<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
   
  <title>My JSP '1.jsp' starting page</title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">  
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

  </head>
  
  <body>
  This is my JSP page. <br>
  </body>
</html>



错误!!

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

exception 

org.apache.jasper.JasperException: /2Jsp.jsp(26,28) Expecting "jsp:param" standard action with "name" and "value" attributes
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.parseParam(Parser.java:801)
org.apache.jasper.compiler.Parser.parseBody(Parser.java:1642)
org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:978)
org.apache.jasper.compiler.Parser.parseInclude(Parser.java:830)
org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1092)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421)
org.apache.jasper.compiler.Parser.parse(Parser.java:130)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)


org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)
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)



为什么啊~~~为什么啊~~~腻歪死我啦!!!!!


[解决办法]
你的jsp include 用法有问题。如果你要是有参数的话可以用如下这种形势

<jsp:include page="1.jsp" flush="true">
<jsp:param name="XXXXX" value="xxxx"/>
<jsp:param name="xxxx" value="xxxxx" />
</jsp:include>


如果没有参数不要有这种
<jsp:include page="1.jsp"> </jsp:include>
改成这种格式
<jsp:include page="1.jsp"/>这就可以了
否则就会出现上面的错误。
[解决办法]

探讨

<base href="<%=basePath%>">
改成,<base target="_self">
其他不要的jsp代码删除

另外,检查运行的jsp代码是否是lz贴出来的代码。jsp:param出现在2.jsp的26行。但是没看到你的代码里有。并且显示:jsp:param没写name或者是value属性

我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html

热点排行