This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Accessing Request Scope Variables

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

I have used javascript in my JSP pages but I'm having problem related to this.





I declare LOGIN_RESULT as a request scope attribute in my action class and
it seems ok at this point and I can alert the user regarding the result because I know I had defined LOGIN_RESULT as a request scope attribute prior to forwarding to this JSP.

But what if the request scope attribute differs depending on the user transaction and different request scope attribute can be reloaded together
with the page.



I tried googling for answer and found request.getAttributeNames() and it returns an enums. I dont know how getAttributeNames is implemented using EL and my action class always return just one request attributes.
What can I substitute "?" in my EL expression

Thanks for the help and tell me if my question isn't that clear
 
Sheriff
Posts: 67752
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
How is your dynamic attribute name getting to the page?

In general, indirection can be handled with:



where something contains the attribute name.
 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

How is your dynamic attribute name getting to the page?



Pardon me but I am not sure if I got your question correctly but I am doing this in my action class



in my javascript, I was hoping to substitute "?" with the attribute.



I can hardcode it one by one like this but I want to learn if there's an easy way out of doing this for the sake of learning.



Thanks again..
 
Bear Bibeault
Sheriff
Posts: 67752
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
Why not just use an array?
 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

thanks for the suggestion. I have overlooked about using arrays. By using array I wont bother much on the attribute name.

Thanks for the help. I'll check and try it out..

 
I AM MIGHTY! Especially when I hold this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic