Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts2 with ajax: howto return a value to div?

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Trying to use AJAX with struts2. I'm 'paraphrasing' an example from the apache site.

The objective is to return a simple value (field name=data) to a dvi ('myID')

I did this:

* JSP *
~~~~~~~


when the user clicks the doIt the action, testAjax1, is executed (showing the 'data' the user has input)


* ACTION *
~~~~~~~~~~

public String testAjax1()
{
System.out.println("say something: "+data);
return "t2";
}

and routed to AjaxResult3.jsp:

*XML*
~~~~~~


OUTPUT: The result, AjaxResult3.jsp, comes in a NEW page with the 'data' value the user has provided

"AjaxResult3.jsp"
-----------------


My question is how to have the result get to myID and not to a new page?
Thanks
[ February 19, 2008: Message edited by: Bear Bibeault ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic