Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

get properties action for theme ajax

Manuel Correa

2007-08-08

Replies:

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.



©2008 junlu.com - Jax Systems, LLC, U.S.A.