This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Problem with c:if .. /c:if tag

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
I am not able to get the <c:if> .. </c:if> tag working.
I have a Context Parameter called IsApplicationInProductionMode.
The idea of having this is to display debugging info or not. If IsApplicationInProductionMode has the value of 'false', I want to display some debugging info.

In one of the error page that catches all Exceptions thrown, I have the following code

<c:if test="${initParam.IsApplicationInProductionMode eq 'false'}" >
Exception on the Server - ${pageContext.exception}
</c:if>

Now the problem is - irrespective of the value in IsApplicationInProductionMode, the debugging info is always displayed.
Ranchers, please let me know if I am missing some thing here.

Cheers,
Sandeep
[ November 21, 2006: Message edited by: Sandeep Prabhakar ]
 
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this -
<c:if test="${initParam.IsApplicationInProductionMode eq false}" >

since false is a reserved word for EL, it shouldnt be in duble quotes
had your IsApplicationInProductionMode been a String then your code would have had worked,

correct me if i am worng
 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even this does not work

The web.xml entry for this context parameter is

<context-param>
<param-name>IsApplicationInProductionMode</param-name>
<param-value>true</param-value>
</context-param>
I guess it treats IsApplicationInProductionMode as String.
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this -
<c:if test="${initParam.IsApplicationInProductionMode == 'false'}" >

let me know if this works for you.
 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even
<c:if test="${initParam.IsApplicationInProductionMode == 'false'}" >

does not work.
 
Jayant Raj
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it works..... i made a couple of changes to an existing web application...

1] added this to the web.xml :


2] added this on a jsp :


when the value is true in web.xml, I get the javascript prompt... it should work in your case too...

try printing out the parameter in your jsp first...
 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you try setting IsApplicationInProductionMode=false.
I am getting the alert message even when IsApplicationInProductionMode=false.

Also,
When I just print the value in IsApplicationInProductionMode using the statement
${initParam.IsApplicationInProductionMode}
, the correct value is getting displayed

Cheers,
Sandeep
[ November 21, 2006: Message edited by: Sandeep Prabhakar ]
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please show your jsp. Did you declare the prefix like :
 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
I think that was the problem.
I am using Net Beans and when I try to include core tag libs, I get an error saying "could not resolve the uri"
Ranchers, please help me how to resolve this issue.

Cheers,
Sandeep
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check that jstl.jar and standard.jar are in the lib directory of your web-app.

If you have HFJS then check out HFJS p434
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And also read the following :
http://faq.javaranch.com/view?JstlTagLibDefinitions
 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks folks.
Got it working

Cheers,
Sandeep
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!