Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Having trouble with C:CHOOSE WHEN clauses

843838Aug 15 2006 — edited Aug 16 2006
My issue I believe is simple syntax to get the c:when clause to return a true condition.

I am trying to read an array and break on various fields, one of which is the state. The variable "prevState" is a work variable to hold the last state processed. However, I cannot get the JSTL to recognise it.

The dbSearchBean is populated and does have data. I found all kinds of examples but never where two variables are being compared. It's always a variable compared to a constant.

I always hit the c:otherwise code.

Here's a snippet...


<%pageContext.setAttribute("prevState","**"); %>

<c:forEach items= "${dbSearchBean.selectItems}" var="selItemBean">

<c:choose>
<c:when test= "${selItemBean.state} != ${prevState}}">
<c:set var= prevState value= ${selItemBean.state} />
...
...
<c:otherwise>
...
</c:otherwise>
</c:choose>

</c:foreach>

I've tried the c:when test 80 different ways. I thought eventually, I'd just lucky.

Thanks in advance for any assistance.

This particular version of code gives me this error:

JSPG0055E: Unable to create an xml attribute from name [${selItemBean.state}!${prevState}}] value [>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2006
Added on Aug 15 2006
3 comments
356 views