• Post Reply Bookmark Topic Watch Topic
  • New Topic

<c:if test="..."/> is not working in jsp  RSS feed

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am redirecting a response from a servlet to jsp but I am not getting this to work
this is my servlet code of get method



and this is my searchemployee.jsp file


everything is working fine i am forwarding my page to searchemployee.jsp the only thing is ,<c:if /> is not executing

Where is wrong?

thanks
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you will find it is actually executing, if you do some debugging. And you will find it thinks that param.username is null, because it is. You don't have a parameter called username. You do however have a request attribute called username, so you should change your code to use that.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And please properly indent your code.
 
Stefan Evans
Bartender
Posts: 1836
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are using the <c:if> tag but I can't see anywhere that you have imported the tag.
Does it work with the following line added?



Feedback on general stuff in this JSP:
Your URLs are all absolute to localhost:8080. That is too much information. Theoretically they should just be local links - probably built with the <c:url> tag like you do for the scripts/stylesheets.

A better test for if statement would be:

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You are using the <c:if> tag but I can't see anywhere that you have imported the tag.
Does it work with the following line added?


ya its working I have saved files in some other jsp and I have included that in my current file.


<c:if test="${not empty param.username}">


when I am using i am getting a warning that


This not is always result a value of true


any more clarification?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!