You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Manuel Correa <mc...@itos.uga.edu> on 2007/08/08 22:04:19 UTC
get properties action for theme ajax
How I get the properties (variable result) when the for is submit with
Ajax theme, look:
Form:
<s:div theme="ajax" id="success"
loadingText="Loading information..."
errorText="Unable to contact server"
href="${pageContext.request.contextPath}/success.jsp"
listenTopics="/refresh"
>
</s:div>
<s:form action="Person_save" id="person" >
<s:textfield name="person.firstName" id="person.firstName"
label="FirstName" />
<s:textfield name="person.lastName" id="person.lastName"
label="LastName" />
<s:textfield name="person.age" id="person.age" label="age" />
<s:submit theme="ajax" notifyTopics=/save,/refresh" />
</s:form>
The Person_save is a action that return success or error and set one var
names "msg" when some message to the user, I want to show that message,
if I don't use the Ajax Theme, everything is fine.
public String save(){
try{
personDAO.persist(person);
System.out.println("person->"+person.getId());
msg = "The data was save in DB";
return Action.SUCCESS;
}catch(Exception e){
msg = "Error saving Data!!";
return Action.ERROR;
}
}
Manuel Correa.
RE: get properties action for theme ajax
Posted by Manuel Correa <mc...@itos.uga.edu>.
Ok, I found, targets property in the submit button.
Thanks.
Manuel Correa.
-----Original Message-----
From: Manuel Correa [mailto:mcorrea@itos.uga.edu]
Sent: Wednesday, August 08, 2007 4:04 PM
To: Struts Users Mailing List
Subject: get properties action for theme ajax
How I get the properties (variable result) when the for is submit with
Ajax theme, look:
Form:
<s:div theme="ajax" id="success"
loadingText="Loading information..."
errorText="Unable to contact server"
href="${pageContext.request.contextPath}/success.jsp"
listenTopics="/refresh"
>
</s:div>
<s:form action="Person_save" id="person" >
<s:textfield name="person.firstName" id="person.firstName"
label="FirstName" />
<s:textfield name="person.lastName" id="person.lastName"
label="LastName" />
<s:textfield name="person.age" id="person.age" label="age" />
<s:submit theme="ajax" notifyTopics=/save,/refresh" />
</s:form>
The Person_save is a action that return success or error and set one var
names "msg" when some message to the user, I want to show that message,
if I don't use the Ajax Theme, everything is fine.
public String save(){
try{
personDAO.persist(person);
System.out.println("person->"+person.getId());
msg = "The data was save in DB";
return Action.SUCCESS;
}catch(Exception e){
msg = "Error saving Data!!";
return Action.ERROR;
}
}
Manuel Correa.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org