This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes access to attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "access to attributes" Watch "access to attributes" New topic

access to attributes

Kaiser Lautern

Joined: May 11, 2005
Posts: 18

Maybe this is a silly question, but here it goes: how can I have access to attributes (request, session or application) from a bean (or any supporting class -i.e. not servlet, not Action, not ActionForm, not JSP)?

alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
you need to pass in the request object and have a method that does request.getAttribute("attrName"); and return the value in each of your bean or supporting class.

otherwise, you need to set the value somehow, say using bean efine from your jsp or do MyBean.setValue(request.getAttribute("attrName");

-/a<br />certified slacker...yes, my last name is 'do' - <a href="" target="_blank" rel="nofollow"></a>
Kaiser Lautern

Joined: May 11, 2005
Posts: 18
Hi Alan,

In fact I had already figured out the first method. Now I'm gonna try the second one (MyBean.setValue)


It is sorta covered in the JavaRanch Style Guide.
subject: access to attributes
Similar Threads
jsp access exception
solve it
difference between servlets parameters and arguments
synchronize access to request object
regarding PageContext