• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Couldn't access bean:define variable in action class using request.getAttribute

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,
I am trying to forward a bean object from my JSP page to my Action class. I am using this statement for this purpose
<bean efine id="nextpage" name="pagewise" scope="request" toScope="request" type="PagewiseBrowseForm " />
In my action class
PagewiseBrowseForm pageForm=(PagewiseBrowseForm)request.getAttribute("nextpage");
But value of pageForm is null.
Any help is always gratefully received.
Thanks in adv.
Sonu
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
request-scope attributes exist only while a request is being processed on the server side. In the JSP, the attributes are available only while the page is being rendered. Once the page gets rendered and the response goes out to the client, the attributes disappear (since your request has gone out of scope, it's attributes go out of scope as well).
You might want to keep your attribute in the session scope instead although I'm not sure I understand why you want to play around with a Form bean since the Struts framework already manages them in the session scope anyway. Besides, the form is always passed to your Actions execute()/perform() method so there's hardly ever any reason to do what it looks like you're trying to do.
 
Sandeep Ghosh
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was trying to do show resultset page wise. For this I have a bean where I kept resultset info like total records,last records seen etc .When I put this object in session bean I was running into problem.So I was trying to keep that in request scope. Now I have kept constant infos like resultset size in session and some info like last record fetched as request parameter.
Does anybody have any better idea for pagination in struts as I don't want to bring complete resultset in one trip.
Sonu
 
Hug your destiny! And hug this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic