struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chumbobumbo <chumbobu...@hotmail.com>
Subject Struts Ajax Newbie
Date Sun, 01 Mar 2009 23:47:12 GMT

This is probably so basic - I'll put my flame proof suit just in case.

I have a 2 combos and (yes ;-) I would like the second one to be loaded
depending on what's been chosen in the first one, so in my action execute
method I have:

     model.setList(service.getData1());

my struts.xml looks like this (note that I am using spring and I am hitting
the same action 'class' (demoAction):

               <action name="firstAction" class="demoAction"
method="execute">
			<result name="success">jsp/output.jsp</result>
			<result name="error">jsp/error.jsp</result>
		</action>
		<action name="secondAction" class="demoAction" method="second">
			<result name="success">jsp/second.jsp</result>
			<result name="error">jsp/error.jsp</result>
		</action>

in my output jsp I have:

.....

    <td><s:select list="model.list" listKey="entry.code"
listValue="entry.desc"  name="selection.listCode"
   				onchange="javascript:load_second_list();return
false;"></s:select></td>
		</tr>

		<tr>
			<td>
   				<s:url id="second_url" action="loadSecond.action" /> 
   				<s:div showLoadingText="false" id="second" href="%{second}"
theme="ajax"
   					listenTopics="load_second_list" formId="demo"/>
			</td>
		</tr>

that's all fine and dandy, but when I call loadSecond.action I find that my
model is re-initialised anew (i.e. as the action is marked 'prototype' in
spring config, the data for the first combo is no longer there) 

obviously I need data in the 1st combo to be available in the resulting
page, as the user should be allowed to change the first selection (that
would in turn relaod the second combo again). 

Is there a way to serialize/cache the data that was retrieved in the first
call so that it is available in the subsequent call other than putting it in
the session?

Thanks,

99-L Blue 
-- 
View this message in context: http://www.nabble.com/Struts-Ajax-Newbie-tp22279792p22279792.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message