Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

access to attributes

 
Kaiser Lautern
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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");
 
Kaiser Lautern
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alan,


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

Thanks,

Kaiser
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic