• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Mainitaining State Between Requests - Struts

 
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Sri Anand
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
That feels good. Thanks. Here's a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic