日期:2014-05-20  浏览次数:20854 次

jsp的<%@ include问题
JScript code
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
  </head>
  
  <body>
    <%
        String value1 = request.getParameter("value1");
        String value2 = request.getParameter("value2"); 
     %>
     
     <% if(request.getParameter("compute").equals("divison")){      %>
         <jsp:include page = "divide.jsp" flush="true">
             <jsp:param name="v1" value="<%=value1%>"/>
             <jsp:param name="v2" value="<%=value2%>"/>
     <%}else{ %>
         <%@ include file="multiply.jsp" %>
     <%} %>
  </body>
</html>


运行错误提示:
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: /Compute.jsp(20,2) 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:827)
org.apache.jasper.compiler.Parser.parseBody(Parser.java:1665)
org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1004)
org.apache.jasper.compiler.Parser.parseInclude(Parser.java:856)
org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1118)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1448)
org.apache.jasper.compiler.Parser.parse(Parser.java:133)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.


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

Apache Tomcat/6.0.13


[b]问题:
Compute.jsp(23,2)是<%@ include file="multiply.jsp" %>这条语句,不需要“name”和“value”啊,怎么回事?[/b]




------解决方案--------------------
指令<%@ include file="multiply.jsp"%>,明确规定:这个指令是静态包含其他的文件,所谓静态就是指file不能为一变量Url。也不允许file指定的文件后面接任何参数。

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