aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "access to attributes" Watch "access to attributes" New topic
Author

access to attributes

Kaiser Lautern
Greenhorn

Joined: May 11, 2005
Posts: 18
Hi,

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)?

kaiser
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="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Kaiser Lautern
Greenhorn

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)

Thanks,

Kaiser
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: access to attributes