File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • 0
  • 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 ]
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • 0
  • 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
  • 0
  • 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.
 
Jayant Raj
Ranch Hand
Posts: 42
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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 ]
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • 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
  • 0
  • 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
 
Mark Beavis
Ranch Hand
Posts: 43
  • 0
  • 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
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks folks.
Got it working

Cheers,
Sandeep
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic