• Expecting "jsp:param" standard action with "name" and "value" attributes错误


    错误信息如下:

    Servlet.service() for servlet [jsp] in context with path [/20161017] threw exception [/tag/simpleTag.jsp (line: 25, column: 44) Expecting "jsp:param" standard action with "name" and "value" attributes] with root cause
    org.apache.jasper.JasperException: /tag/simpleTag.jsp (line: 25, column: 44) Expecting "jsp:param" standard action with "name" and "value" attributes
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:275)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:91)
    at org.apache.jasper.compiler.Parser.parseParam(Parser.java:829)
    at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1681)
    at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1006)
    at org.apache.jasper.compiler.Parser.parseForward(Parser.java:870)
    at org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1122)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1459)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:227)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

    simple.jsp文件如下:

     

     1 <%@ page import="java.util.* ,com.tt.javaweb.Customer" %>
     2 <%@ page language="java" contentType="text/html; charset=UTF-8"
     3     pageEncoding="UTF-8"%>
     4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     5 <html>
     6 <head>
     7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     8 <title>Insert title here</title>
     9 </head>
    10 <body>
    11             <%
    12                 //模拟Servlet中的操作
    13                 List<Customer> customers = new ArrayList<Customer>();
    14                 customers.add(new Customer(1,"AA",12));
    15                 customers.add(new Customer(2,"BB",13));
    16                 customers.add(new Customer(3,"CC",14));
    17                 customers.add(new Customer(4,"DD",15));
    18                 customers.add(new Customer(5,"EE",16));
    19                 
    20                 request.setAttribute("customers", customers);
    21             
    22             %>
    23             
    24                   
    25             <jsp:forward page="testTag.jsp"></page:forward>
    26             
    27 </body>
    28 </html>

     testTag.jsp文件如下:

     1 <%@ page import="java.util.* ,com.tt.javaweb.Customer" %>
     2 <%@ page language="java" contentType="text/html; charset=UTF-8"
     3     pageEncoding="UTF-8"%>
     4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     5 <html>
     6 <head>
     7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     8 <title>Insert title here</title>
     9 </head>
    10 <body>
    11 
    12            <!-- 在页面上对request中的customers属性进行遍历,打印id,name,age -->    
    13            <%
    14                 List<Customer> customers = (List<Customer>)request.getAttribute("customers");
    15                 if(customers != null) {
    16                      for(Customer customer : customers){
    17            %>
    18            
    19                <%= customer.getId() %> ,<%= customer.getName() %> ,<%= customer.getAge() %>        
    20                     
    21            <% 
    22                      }
    23                 }
    24           
    25            %>
    26 
    27 </body>
    28 </html>

     原因:在simpleTag.jsp中的forward标签写错了!

    总结该错误可能出现的原因:

    1.标签的开始和结束不一致:比如我犯的这个错

    2.没有结束标签:<jsp:forward page="testTag.jsp">,应该是<jsp:forward page="testTag.jsp"/>

    3.没有参数的标签,结束时不能换行:

       <jsp:forward page="testTag.jsp">

       </jsp:forward>

      应该是<jsp:forward page="testTag.jsp"></jsp:forward>

     

  • 相关阅读:
    创业失败,是应该坚持还是给别人打工?
    在三四线小城市投资3至8万,做什么小生意好?
    在小县城做什么生意好?
    在农村创业有哪些优势和机会?
    听说做餐饮的都在赔钱,为什么新店却越开越多?
    现在做什么行业好一点?
    手头有五万左右,想做个小生意,有什么值得推荐的?
    可以给我个创业的建议吗?
    如果你现在月工资纯入7千左右,30多岁有家庭但前途迷茫,你会独自创业打拼吗?
    JeeSite 4.0 简化业务逻辑层开发
  • 原文地址:https://www.cnblogs.com/TTTTT/p/5973872.html
Copyright © 2020-2023  润新知