org.apache.jasper.JasperException:

时间:2012-08-01 13:45:07

标签: jsp struts2

在我的jsp页面中

       <s:if test="#alist[0].aboutme!=null"  test="#alist[0].aboutme!=''">
         <div class="info">
            <div class="title">
               About
            </div>
            <div class="value">
               <div class="value_title">
                    <s:property value="alist[0].aboutme"/>
               </div>
            </div>
         </div>
       </s:if>

我正在检查ArrayList alist [0]关于我的值,如果它为null或'' 它不会显示aboutme文本和值 以前它工作正常,但现在显示以下异常

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: /pages/profile/about.jsp (line: 67, column: 102)   Attribute qualified names must be unique within an element
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:89)
org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:171)
org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:153)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1236)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1452)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

2 个答案:

答案 0 :(得分:1)

test代码中有两个s:if属性:

<s:if test="#alist[0].aboutme!=null"  test="#alist[0].aboutme!=''">

试试这个:

<s:if test="%{#alist[0].aboutme!=null and #alist[0].aboutme!=''}">

答案 1 :(得分:0)

你的第一行包含:

<s:if test="#alist[0].aboutme!=null"  test="#alist[0].aboutme!=''">

单个test元素

不能有两个if属性