File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Head First Android 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)


I agree. Here's the link:
subject: access to attributes
It's not a secret anymore!