struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kropp, Henning" <hkr...@microlution.de>
Subject Re: Dynamic form fields with s:div and ajax
Date Tue, 02 Sep 2008 20:53:00 GMT
Hello Gainty,

thanks for your reply and effort!

I do specify the href as <s:url id="getListOfObjects" action="addObject" 
/>. Sorry I left that out. This calls the AddObjectAction, which 
populates the List of objects in the prepare method. This works greate! 
But I simply cant target the div with the action in the div.

In your doc you use a static jsp where I use the Action to render the 
jsp and initialize a List of objects. Than I want the same div and the 
same Action to render the same jsp with the previously initialized List 
of objects and in the action do something to the List either delete or 
add an object. And either way I try its not working.

Targeting the same div (in your doc 'one') results in not having the 
list on the request. Using the formId results in not getting the the 
list on the request. I know it works if I leave out the target on the 
div (in your doc 'one') but still the div needs to be rendered again to 
make it visible. It works when I target a different div. But how do 
override the other div.

regards

Martin Gainty schrieb:
> from doc located at http://www.roseindia.net/struts/struts2/struts2uitags/div.shtml
> you would either need to specify where the href value is coming from
>    
>     <s:div
>       id="one"
>       theme="ajax"
>       href="%{test}">
>     
>
> OR
>
>
> use the supplied value from property
>
>       Output: 
>       Firstname : 
>       
>
>
>
> for results returned from action class populating a div tag
> Div 1
>
>
>
>
> Martin 
>
>
> ______________________________________________ 
>
> Disclaimer and confidentiality note 
> Everything in this e-mail and any attachments relates to the official business of Sender.
This transmission is of a confidential nature and Sender does not endorse distribution to
any party other than intended recipient. Sender does not necessarily endorse content contained
within this transmission. 
>
>
> ----------------------------------------
>   
>> Date: Tue, 2 Sep 2008 21:22:51 +0200
>> From: hkropp@microlution.de
>> To: user@struts.apache.org
>> Subject: Dynamic form fields with s:div and ajax
>>
>> Hello,
>>
>> I am trying a common scenario, where I want to dynamically create form 
>> fields and either add or remove some fields. The fields are a List of 
>> objects. I using the following approach described in short:
>>
>> AddObjectAction:
>>         List myObjectList;
>>        prepare(){if == null (3x) add ... else add 1x}
>>        String delete(){ myObjectList.remove(int listPostion) }
>>
>> home_jsp:
>>     
>>           
>>           formId="form"> 
>>    
>>
>> addObjectAction-success.jsp:
>>     
>>           
>>                
>>          
>>           ......
>>            href="%{deleteObject[#stat.index]" />
>>     
>>
>> This works, but does not refresh the div objectsDiv. Using target does 
>> not work because objectList does not get onto the request, without 
>> target the objectList is on the request. I tried to set the objectList 
>> as a param to s:url deleteObject, this kind of works but results in a 
>> param intercepter exception (haven't tried a custom converter yet).
>> When having the div put the fields from formId="form" onto the request 
>> it only puts the fields onto the request that itself does not hold. In 
>> example only the 'anotherField'.
>>
>> I think this should work this way. Why does setting target result in 
>> removing the myObjectList on the request? Why does s:div formId not put 
>> the fields on request itself holds?
>>
>> Many thanks in advance
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>     
>
> _________________________________________________________________
> Talk to your Yahoo! Friends via Windows Live Messenger.  Find out how.
> http://www.windowslive.com/explore/messenger?ocid=TXT_TAGLM_WL_messenger_yahoo_082008
>   


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


Mime
View raw message