This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Adding <c:if> to option tag

 
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JSTL to get populate the book list to select box.

In my action class i am setting selected book name to session on submitting the form. My success page of the action is also the same input page. So I am expecting the selected book name to be selected in the drop box.


so i added the line to option tag.


But the value is not selected as expected. Please let me know if I am making any thing wrong here.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try changing the line number four of your jsp to following : -



Thanks
 
Marshal
Posts: 67339
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you look at the generated HTML to see if it was correct?
 
Bhoomika Bathla
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i checked the source code it is showing one of the option as selected, which i select and if you are not able to get the result try printing the value of "sessionScope.selectedState".
 
Bear Bibeault
Marshal
Posts: 67339
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bhoomika Bathla wrote:yes i checked the source code...


But you're not the one who needs to do the checking. The first step the OP should take is to check the generated HTML.
 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bhoomika.

@Bear- I checked the generated HTML. As the value was getting printed when not placed inside the option tag, i was confused about the syntax usage. Any ways thanks for all help.
 
Surfs up space ponies, I'm making gravy without this lumpy, tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!