aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Problem with c:if .. /c:if tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Problem with c:if .. /c:if tag" Watch "Problem with c:if .. /c:if tag" New topic
Author

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

Sandeep Prabhakar
Ranch Hand

Joined: Dec 22, 2005
Posts: 59
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

Joined: Oct 16, 2005
Posts: 1277
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


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Sandeep Prabhakar
Ranch Hand

Joined: Dec 22, 2005
Posts: 59
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

Joined: Mar 11, 2004
Posts: 42
try this -
<c:if test="${initParam.IsApplicationInProductionMode == 'false'}" >

let me know if this works for you.


regards,<br />Jayant Raj<br /> <br />SCJP 1.4 [98%]<br />SCWCD 1.4 [91%]<br />SCBCD [In Progress]
Sandeep Prabhakar
Ranch Hand

Joined: Dec 22, 2005
Posts: 59
Even
<c:if test="${initParam.IsApplicationInProductionMode == 'false'}" >

does not work.
Jayant Raj
Ranch Hand

Joined: Mar 11, 2004
Posts: 42
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

Joined: Dec 22, 2005
Posts: 59
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

Please show your jsp. Did you declare the prefix like :


[My Blog]
All roads lead to JavaRanch
Sandeep Prabhakar
Ranch Hand

Joined: Dec 22, 2005
Posts: 59
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

Joined: Apr 07, 2005
Posts: 43
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

And also read the following :
http://faq.javaranch.com/view?JstlTagLibDefinitions
Sandeep Prabhakar
Ranch Hand

Joined: Dec 22, 2005
Posts: 59
Thanks folks.
Got it working

Cheers,
Sandeep
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with c:if .. /c:if tag