日期:2014-05-17  浏览次数:21063 次

equal symbol expected
高手帮我看看这段代码:哪里出问题了??

<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@taglib prefix="s" uri="/struts-tags %>
<html>
  <head>
  <title>My JSP 'viewcustomer.jsp' starting page</title>
  </head>
  
  <body>
  <table>
  <tr>
  <td>用户名</td>
  <td>银行帐号</td>
  <td>联系电话</td>
  </tr>
  <s:iterator id="Customer" value="customers" status="st">
  <tr <s:if test="#st.odd">style="background-color:#bbbbbb"</s:if>>
  <td><s:property value="cname"/></td>
  <td><s:property value="bank"/></td>
  <td><s:property value="phone"/></td>
  </tr>
  </s:iterator>
  </table>
  </body>
</html>

错误信息:

exception 

javax.servlet.ServletException: org.apache.jasper.JasperException: /viewcustomer.jsp(15,29) equal symbol expected
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)


root cause 

org.apache.jasper.JasperException: /viewcustomer.jsp(15,29) equal symbol expected
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.parseAttribute(Parser.java:195)
org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:150)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:396)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1433)
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:153)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
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:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



------解决方案--------------------
应该是你的标签不规范造成的

例如你代码中的这句:

<tr <s:if test="#st.odd">style="background-color:#bbbbbb" </s:if>>