• 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

How to pass value to jstl within a jsp

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I need to pass the above value in below tag.
values are there in hiddenvalue, but if i use ${param.hiddenvalue} it is not recognizing the value and tried in many options.


Please suggest how to pass the value?
 
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
What is the relationship between these statements? Are they in the same JSP file? If not how are they related?
 
Raghu Sha
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes..both are in same jsp file
 
Bear Bibeault
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
Well, then param isn't going to contain anything. param contains submitted information. And if the form hash;t been submitted yet...

If the scoped variable user is in session scope, then ${user} will fetch it.

Why are you using a scriptlet expression rather than the JSTL in the first place?
 
Raghu Sha
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Session is having value.

Could you please tel how to pass into <c:value=""> using jstl?
 
Bear Bibeault
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
I already told you: ${user}
 
Raghu Sha
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks..

Is there is any way to use ${user} without using <%= session.getAttirbute("user")> ?
Because session is already available in the page..

Have to avoid getting session.getAttirbute("user").
 
Bear Bibeault
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
Yes: ${user}

Just ${user}

Always ${user}

Use ${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

${user}

Just ${user}

There is no need to include the scriptlet. Ever.

Why aren't you just trying it instead of posting questions?
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
${user} is approximately equivalent to session.getAttribute("user") (it's actually pageContext.findAttribute("user") )
Maybe to make it explicit: Try ${sessionScope.user}

In any case, yes, you can access session attributes from JSTL.
There is no point in taking a value from session, putting it into a hidden field and getting it into JSTL via a request parameter when you can just read it from the session in the first place.

 
this is supposed to be a surprise, but it smells like a 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