• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Nesting JSTL Tags

 
Samarth Kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • 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>
<ctherwise>
<cut value = "${pdView.jobPostingDate}" />
</ctherwise>
</c:choose>
</c:when>
<ctherwise>
Data is not available
</ctherwise>
</c:choose>

Do let me know if this is possible. Thanks,
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it?
 
Samarth Kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got a blank page, I guess the JSP did not compile.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What did a View Source show?
 
Samarth Kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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>
 <ctherwise>
  <cut value = "${pdView.jobPostingDate}" />
 </ctherwise>
</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
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
Stefan Evans
Bartender
Posts: 1780
10
  • Mark post as helpful
  • send pies
  • 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}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic