• 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

JSTL if else

 
Ranch Hand
Posts: 30
IntelliJ IDE Hibernate
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
<c:otherwise>
<fmt:message key="${ROW_DATA.chargeView.status.value}"/>
<h5>supposed to be null </h5>
</c:otherwise>
</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
IntelliJ IDE Hibernate
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !
 
Ranch Hand
Posts: 72
Hibernate Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
IntelliJ IDE Hibernate
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gopakumar,

Thank you very much for your reply

Thanks !
 
Sheriff
Posts: 67747
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

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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic