This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Mainitaining State Between Requests - Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Mainitaining State Between Requests - Struts" Watch "Mainitaining State Between Requests - Struts" New topic
Author

Mainitaining State Between Requests - Struts

Sri Anand
Ranch Hand

Joined: Mar 06, 2005
Posts: 392
Req: Maintaining data between requests with out setting the bean to session.
What am i doing: I am using a DisplayTags , pass an ArrayList which is set to form bean to displays the Object properties it works fine , However I need these properties to be accessed in next request so i set them to session

<bean efine id="raghu" name="newcustomerForm" property="assoc" toScope="session"/>

it works fine i am able to access them. However when i set the bean to request it fails

<bean efine id="raghu1" name="newcustomerForm" property="assoc" toScope="request"/>


Display tag code

<display:table name="newcustomerForm.assoc" requestURI="<%=requestUri%>" decorator="us.ny.state.dot.permits.decorator.AssocDecorator" class="report" sort="list" pagesize="4" defaultsort="1">
<display:column title="Cust Num" property="custNumber" class="entry_small" sortable="true" headerClass="sortable"/>
<display:column title="Name" property="custName" class="entry_small" sortable="true" headerClass="sortable"/>
<display:column title="Disassociate" property="assocDelete" class="entry_small" sortable="true" headerClass="sortable"/>
<display:setProperty name="paging.banner.placement" value="top"/>
<display:setProperty name="paging.banner.no_items_found" value=""/>
<display:setProperty name="basic.empty.showtable" value="true" />
<display:setProperty name="sort.behavior" value="list" />
<display:setProperty name="paging.banner.include_first_last" value="true" />
<display:setProperty name="paging.banner.onepage" value="" />
<display:setProperty name="basic.msg.empty_list" value="<br>There are no Associations available." />
</display:table>

any Ideas how to maintain form data between requets, Here the object properties are not accessed as requests Parameters when using Display Tags, hence i need some way to carry them to next request but i dont want to use session as it i spoiling if user moves to different actions without saving
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by Raghunandan Mamidala:
i dont want to use session as it i spoiling if user moves to different actions without saving

No matter what you do, if the user navigates to a different page without submitting or saving the current page, the values will be lost. There's no way around that.

However, if you don't want to use the session, you can pass the data through to the next page by creating a <html:hidden> tag for each field you wish to have passed on to the next page.


Merrill
Consultant, Sima Solutions
Sri Anand
Ranch Hand

Joined: Mar 06, 2005
Posts: 392
Thanks for the reply i am displaying a huge array list using the display tags it would be difficult to detail each of them using hidden tags, however i wanted the values in next action only so i created a variable in JSP and put that in session removed it in immediate action class once the page is submitted that meets my requirements.
so the value is set in JSP and immediately removed in action classes i could not think of anything better but this works any other suggestions to implement in more simple way ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mainitaining State Between Requests - Struts
 
Similar Threads
Struts+displaytag+partialList+export PROBLEM
DisplayTag and logic:match
Dynamic Attribute assignment (in Struts)
problem with display table pagination and sorting
problem with display tag