• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And please properly indent your code.
 
Bartender
Posts: 1845
10
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic