• 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

the lifespan of a request?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
I have the following actions


I call listDocuments.do and the resulting jsp-page lists some "channels" where it is possible to delete a chosen channel, by following a link to http://localhost:8080/saveChannel.do?method=delete&id=40278. ChannelAction extends DispatchAction. Now, in ChannelAction, I do a check if the channel can be deleted. If not, I do the following:



The thing is now, that listChannels.do does not seem to be able to display the errors. The attribute is gone from the request. Why is this? I have only done one request, as far as I can see. Does Struts consider going to another Action to be a completely new request?

any help would be appreciated!

cheers,
pj
 
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Request is valid only for request time. If you want have data longer use another scope - session for example. I'm not sure how struts handle with request, but it is possible that after forward it creates new request.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Request attributes last for the scope of a request.
Forward/include happens on the same request.
A redirect sends a response telling the browser to send a new request.

So request attributes are retained over a forward/include
Request attributes are lost if you issue a redirect.

Looking at your actionforward for /listChannels:
<forward name="forward" redirect="true" path="/channellist.jsp"/>

Solutions
- put the attribute in session
- don't redirect on a "listChannels" request
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic