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

servlet报错
这是servlet的类
Java code

@Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doGet(req, resp);
        /**
        *
        *@TradeOperator
        */
        TradeOperator to = new TradeOperator();
        ArrayList<Trade> list = to.getTradequery();
        for (Trade trade : list) {
//            req.setAttribute("list", list);
            
            req.setAttribute("TRADE_NAME", trade.getName());
        }
        req.getRequestDispatcher("test.jsp").forward(req, resp);

    }




jsp页面
Java code

<body>

  ${Request.getAttribute("TRADE_NAME") } 
</body>



帮我看看,现在为什么报错

严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /test.jsp(11,4) The function getAttribute must be used with a prefix when a default namespace is not specified
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
at org.apache.jasper.compiler.Validator$ValidateVisitor$1FVVisitor.visit(Validator.java:1506)
at org.apache.jasper.compiler.ELNode$Function.accept(ELNode.java:129)
at org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:200)
at org.apache.jasper.compiler.ELNode$Visitor.visit(ELNode.java:242)
at org.apache.jasper.compiler.ELNode$Root.accept(ELNode.java:56)
at org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:200)
at org.apache.jasper.compiler.Validator$ValidateVisitor.validateFunctions(Validator.java:1531)
at org.apache.jasper.compiler.Validator$ValidateVisitor.prepareExpression(Validator.java:1536)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:720)
at org.apache.jasper.compiler.Node$ELExpression.accept(Node.java:958)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1763)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)