• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Nesting JSTL Tags

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Folks,

I'm new to the world of JSTL and am trying to nest two tags. I am not sure if this can be done.

This is what my code looks like,

<c:choose>
<c:when test = "${pdView.isFlag}" >
<c:choose>
<c:when test = "${pdView.isOnFormalWarning}" >N/A
</c:when>
<c:otherwise>
<c:out value = "${pdView.jobPostingDate}" />
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
Data is not available
</c:otherwise>
</c:choose>

Do let me know if this is possible. Thanks,
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happened when you tried it?
 
Samarth Kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got a blank page, I guess the JSP did not compile.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What did a View Source show?
 
Samarth Kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, looks like something is failing. If you're not getting error messages when JSP translation fails, now is the time to stop and fix your setup so you don't waste time chasing down every little sytnax error.

P.S. The answer to the original question is: yes, you can nest tags as much as you want. Just be sure that everything is well-formed.
 
Samarth Kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been able to narrow down the failure to these lines of the JSP

<c:choose>
 <c:when test = "${pdView.isOnFormalWarning}" >N/A
 </c:when>
 <c:otherwise>
  <c:out value = "${pdView.jobPostingDate}" />
 </c:otherwise>
</c:choose>

If I comment these lines out, then the JSP compiles and renders the other data from the tags. Maybe, I need to check the way I defined the variables in the bean.
[ May 31, 2006: Message edited by: Marilyn de Queiroz ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The tags look fine on initial inspection, it's more likely that the EL expressions are throwing an error.

Again, I urge you to spend the time to find out why you aren't getting decent error messages on failure. You're wasting a lot of time guessing.

P.S. Clicking the 'disable smilies' box when posting will make your tags look a lot less surprised !
 
Samarth Kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
bear,

that's true, i should focus on getting good error messages, is there a way to know where the error messages get logged to. my setup is websphere rad for development purposes running under websphere 5.1.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd post a topic in the websphere forum saying that you aren't getting error messages when there is a JSP failure.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<c:when test = "${pdView.isOnFormalWarning}" >N/A

what is the method here? boolean getIsOnFormalWarning()?
or is it boolean isOnFormalWarning()?

Maybe the expression should be ${pdView.onFormalWarning}
 
reply
    Bookmark Topic Watch Topic
  • New Topic