• Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing Request Scope Variables  RSS feed

 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
  • 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
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
144
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Posts: 66144
144
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not just use an array?
 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
  • 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..

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!