Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using a jsp's local variable in 'c:if'

 
vishwanath nadimpally
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to JSTL. Is there way to use a jsp local variable inside a <c:if> or <c:when>. I will give an example for my question:

test.jsp


I have tried this, and it does'nt work. Is there a way to do something like this?

Thanks for any suggestions
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSTL and EL operate upon scoped variables, not scripting variables. In general it is considered poor practice to mix and match them. Either use scriplets or use JSTL, not both.

If you insist, you can create scoped variables from any scripting data with the PageContext.setAttribute() methods.
 
vishwanath nadimpally
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to learn EL and JSTL and stop using scriptlets in my jsp's.Which book do you recommend JSTL and EL?
[ August 15, 2006: Message edited by: vishwanath nadimpally ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing beats the JSP and JSTL specifications. Links can be found in the JSP FAQ.
 
vishwanath nadimpally
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic