You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Anderson, Jessica" <Je...@trs.state.tx.us> on 2001/02/27 22:02:00 UTC
Iteration with - BUG?
I am attempting to iterate through an enumeration and display key/value
pairs as part of the link using jsp expressions (<%= value %>).
while (enum.hasMoreElements()){
jsp = (String)enum.nextElement();
display = (String)navigation.get(jsp); %>
<html:link page="/<%= jsp %>.do?action=jsp/<%= jsp %>.jsp" target="body"><%=
display %><BR>
<% } %>
However, using this code results in the following error and it seems to have
something to do with the closing brace for the while loop. I tested the
while loop without the <html:link> tag included and it was working properly.
Is this a bug or am I missing something?
Thanks,
Jessica
org.apache.jasper.JasperException: Unable to compile class for
JSPE:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigatio
n_0002ejspnavigation_jsp_33.java:111: 'while' expected.
}
^
E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
002ejspnavigation_jsp_33.java:873: 'try' without 'catch' or 'finally'.
} while (_jspx_th_html_link_22.doAfterBody() == BodyTag.EVAL_BODY_TAG);
^
E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
002ejspnavigation_jsp_33.java:874: 'finally' without 'try'.
} finally {
^
E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
002ejspnavigation_jsp_33.java:879: 'try' without 'catch' or 'finally'.
if (_jspx_th_html_link_22.doEndTag() == Tag.SKIP_PAGE)
^
E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
002ejspnavigation_jsp_33.java:881: 'finally' without 'try'.
} finally {
^
5 errors
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:149)
at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va:161)
at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:160)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
at java.lang.Thread.run(Thread.java:484)
Re: Iteration with - BUG?
Posted by Martin Cooper <ma...@tumbleweed.com>.
Jessica,
You have not closed the link tag. After the <%= display %>, you need
</html:link>.
Also, you might want to look into using the Struts <logic:iterate> tag
instead of using a while loop in a scriptlet.
Hope this helps.
--
Martin Cooper
Tumbleweed Communications
----- Original Message -----
From: "Anderson, Jessica" <Je...@trs.state.tx.us>
To: <st...@jakarta.apache.org>
Sent: Tuesday, February 27, 2001 1:02 PM
Subject: Iteration with <html:link> - BUG?
> I am attempting to iterate through an enumeration and display key/value
> pairs as part of the link using jsp expressions (<%= value %>).
>
> while (enum.hasMoreElements()){
> jsp = (String)enum.nextElement();
> display = (String)navigation.get(jsp); %>
>
> <html:link page="/<%= jsp %>.do?action=jsp/<%= jsp %>.jsp"
target="body"><%=
> display %><BR>
>
> <% } %>
>
> However, using this code results in the following error and it seems to
have
> something to do with the closing brace for the while loop. I tested the
> while loop without the <html:link> tag included and it was working
properly.
> Is this a bug or am I missing something?
>
> Thanks,
> Jessica
>
> org.apache.jasper.JasperException: Unable to compile class for
>
JSPE:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigatio
> n_0002ejspnavigation_jsp_33.java:111: 'while' expected.
> }
> ^
>
E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
> 002ejspnavigation_jsp_33.java:873: 'try' without 'catch' or 'finally'.
> } while (_jspx_th_html_link_22.doAfterBody() == BodyTag.EVAL_BODY_TAG);
> ^
>
E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
> 002ejspnavigation_jsp_33.java:874: 'finally' without 'try'.
> } finally {
> ^
>
E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
> 002ejspnavigation_jsp_33.java:879: 'try' without 'catch' or 'finally'.
> if (_jspx_th_html_link_22.doEndTag() == Tag.SKIP_PAGE)
> ^
>
E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
> 002ejspnavigation_jsp_33.java:881: 'finally' without 'try'.
> } finally {
> ^
> 5 errors
>
> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
> at
org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
> at
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
> rvlet.java:149)
> at
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:161)
> at
> org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
> at
org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:160)
> at
>
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
> )
> at java.lang.Thread.run(Thread.java:484)