File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes JSTL if statement does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL if statement does not work" Watch "JSTL if statement does not work" New topic
Author

JSTL if statement does not work

Urs Wagner
Greenhorn

Joined: Sep 01, 2005
Posts: 9
I try to use <c:if> to include an additonal page.

For testing I use both statements.

<c:if test="${Partner.loggedIn=='false'}" >
<%@include file="login2.jsp" %>
</c:if>

<c:if test="${Partner.loggedIn=='true'}" >
<%@include file="login2.jsp" %>
</c:if>

It does not work. There is no html code from login2.jsp.
Does have anyone an advice? For example how I can debug it.

Thanks

Urs
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Are you doing this in a JSF page?


GenRocket - Experts at Building Test Data
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

See what <cut value="${Partner.loggedIn}"/> prints out.
Also, if loggedIn is a boolean, you probably do not want quotes around false or true.
[ October 13, 2005: Message edited by: Marc Peabody ]

A good workman is known by his tools.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61601
    
  67

If loggedIn is a boolean, I'd code it just as Marc showed it without any comparison at all.

Not really a JSF question, is it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Urs Wagner
Greenhorn

Joined: Sep 01, 2005
Posts: 9
<c ut value="${Partner.loggedIn}"/> prints out ${Partner.loggedIn}.

I am bit confused. Partner is bean and loggedIn is a boolean property. Writing without qqote does also not help.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Moving this to the JSP forum...
Eddy Lee Sin Ti
Ranch Hand

Joined: Oct 06, 2005
Posts: 135
Which version of JSTL you are using? and do you turn the EL expression off?


SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="http://eddyleesinti.blogspot.com" target="_blank" rel="nofollow">http://eddyleesinti.blogspot.com</a>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61601
    
  67

Also need to know what JSP container and version you are using.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL if statement does not work