You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by Gerard Garrigan <ge...@precisionsoftware.com> on 2006/03/07 12:15:02 UTC

Beginners JSTL Question

Hello,

I've just started using JSTL and was trying out some sample code. I
wrote a page in html where the user checks boxes. The jsp page then
lists the boxes the user checked or prints a message if nothing was
checked. 

Here's my jsp code:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<c:choose>
<c:when test="${not empty paramValues.feedback}">
You described our customer service as
<ul>
<c:forEach items="${paramValues.feedback}" var="adj">
<c:choose>
<c:when test="${adj == 'satisfactory'}">
<font size="+2">
</c:when>
<c:otherwise>
<font size="-2">
</c:otherwise>
</c:choose>
<li><c:out value="${adj}"/></li>
</font>
</c:forEach>
</c:when>
<c:otherwise>
You didn't choose any feedback checkboxes.
</c:otherwise>
</c:choose>


When I run this in Tomcat I get the following error:

org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
E:\Program Files\Apache Software Foundation\Tomcat
5.0\work\Catalina\localhost\JSTLSample1\org\apache\jsp\checkbox_jsp.java
:52: 'try' without 'catch' or 'finally'
try {
^


Generated servlet error:
E:\Program Files\Apache Software Foundation\Tomcat
5.0\work\Catalina\localhost\JSTLSample1\org\apache\jsp\checkbox_jsp.java
:72: 'else' without 'if'
} else {
^


Generated servlet error:
E:\Program Files\Apache Software Foundation\Tomcat
5.0\work\Catalina\localhost\JSTLSample1\org\apache\jsp\checkbox_jsp.java
:78: illegal start of type
} catch (Throwable t) {
^


Generated servlet error:
E:\Program Files\Apache Software Foundation\Tomcat
5.0\work\Catalina\localhost\JSTLSample1\org\apache\jsp\checkbox_jsp.java
:88: <identifier> expected
}

etc.

Could anyone please help me out with where I'm going wrong?

Many thanks,

Ger

 

 

 

 

Ger Garrigan
Software Engineer
 
Castlewood House, Castlewood Ave, 
Rathmines, Dublin 6, Ireland. 
Tel:  +353 1 4060738   Fax:  +353 1 4060748 
www.precisionsoftware.com <http://www.precisionsoftware.com/> 

 

 


Re: Beginners JSTL Question

Posted by Rahul Akolkar <ra...@gmail.com>.
On 3/7/06, Gerard Garrigan <ge...@precisionsoftware.com> wrote:
>
> Hello,
>
> I've just started using JSTL and was trying out some sample code. I wrote a page in html where the user checks boxes. The jsp page then lists the boxes the user checked or prints a message if nothing was checked.
>
> Here's my jsp code:
> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<snip/>

Since you're on Tomcat 5.x, why not use JSTL 1.1? More on that here:

http://wiki.apache.org/jakarta-taglibs/FrequentlyAskedQuestions

Please ask usage questions on the user list.

-Rahul


> <c:choose>
> <c:when test="${not empty paramValues.feedback}">
> You described our customer service as
> <ul>
> <c:forEach items="${paramValues.feedback}" var="adj">
> <c:choose>
> <c:when test="${adj == 'satisfactory'}">
> <font size="+2">
> </c:when>
> <c:otherwise>
> <font size="-2">
> </c:otherwise>
> </c:choose>
> <li><c:out value="${adj}"/></li>
> </font>
> </c:forEach>
> </c:when>
> <c:otherwise>
> You didn't choose any feedback checkboxes.
> </c:otherwise>
> </c:choose>
>
>
> When I run this in Tomcat I get the following error:
>
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> Generated servlet error:
> E:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\JSTLSample1\org\apache\jsp\checkbox_jsp.java:52: 'try' without 'catch' or 'finally'
> try {
> ^
<snap/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org