This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL if else  RSS feed

 
Micale Raj
Ranch Hand
Posts: 30
Hibernate IntelliJ IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to implement if/else in JSTL. My Code is


<c:choose>
<c:when test="${ROW_DATA.status.value != null}">
<fmt:message key="${ROW_DATA.status.value}"/>
<h5> not null </h5>
</c:when>
<ctherwise>
<fmt:message key="${ROW_DATA.chargeView.status.value}"/>
<h5>supposed to be null </h5>
</ctherwise>
</c:choose>


but the output shows both if else parts.
Here's the output

"Processed
not null

Processed
supposed to be null"

Can any body help .
Thanks in advance
 
Micale Raj
Ranch Hand
Posts: 30
Hibernate IntelliJ IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I got the solution .
I have forget to add c prefix .

<%@ taglib uri='/WEB-INF/c.tld' prefix='c' %>

thanks !
 
Gopakumar Naryanan
Ranch Hand
Posts: 72
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Micale Raj wrote:Hi,

I got the solution .
I have forget to add c prefix .

<%@ taglib uri='/WEB-INF/c.tld' prefix='c' %>

thanks !


Hi Raj,

You got the solution. it sounds good.
I would like to add on to your post.
you need not include "c.tld" in WEB-INF.
it is sufficient , if you add a taglib directive as follows:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
Make sure that you have jstl.jar and standard.jar files are present in your WEB-INF/lib directory.

Thanks
 
Micale Raj
Ranch Hand
Posts: 30
Hibernate IntelliJ IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gopakumar,

Thank you very much for your reply

Thanks !
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gopakumar kiing wrote:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>

This is an old URI for JSTL 1.0. You should be using JSTL 1.2 at this point which has a different URI.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!