See comment inline. I hope I am interpreting your question correctly.
On Friday, July 13, 2012 4:08:24 AM UTC-4, nicola galdiolo wrote:
hello everybody
I want async. refresh a single textfield Ty value whith jquery plugin tags.
The async. request (href or submit) has as parameter the instaneous value of
anothet texrt field Tx.
I want refresh the value, not hidden/appears. After clic value appears A,
before B.
the questions :
1. the result type for strus. what is ? dispatcher jsp ? json ?
IMO, I will use json as a result type. You will need the struts-json plugin in your webapps, and set the action mapping in your struts.xml with the result type="json"
2. refresh in main jsp. I must define a DIV section with FIELDTEXT inside
and target the Id DIV ?
Not a must, you don't need to define a div if you are using json.
if you set the target with the Div's id, assuming you are using the sj:submit with targets set, you will need the result type to be a jsp with your textfield in it.
<s:textfield name="Ty" value="%{whatever_value_you_want_replace_from_your_ajax_request}" />
or is possible target the id <s:fieldtext name="Ty" id="Ty" > ?
If you go the json route, you will need to use javascript to have a topic listener for your Ajax request, and populate the textfield value inside the listener.
For e.g.
<sj:submit
...
onSuccessTopics="updateTextfieldTyTopic"/>
$.subscribe("updateTextfieldTyTopic", function(event,data) {
// you may need to set this correctly look at the example in the wiki:
var newTyValue = event.original.data.newTyValue; // assuming your new value is called "newTyValue" in your action class
// TODD: replace value to the textfield with the new value
});
3. Tha Struts action. IT must contains the Ty property. Depends of result
type I suppose.
See comment above