*
The moose likes Struts and the fly likes struts2 with ajax: howto return a value to div? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts2 with ajax: howto return a value to div?" Watch "struts2 with ajax: howto return a value to div?" New topic
Author

struts2 with ajax: howto return a value to div?

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts2 with ajax: howto return a value to div?
 
Similar Threads
Problem of resubmisson in struts2
Showing Hiding <s:div> tag in Struts2
I want to implement editable autocompleter in struts2 using jquery.
Jsp is not displaying in Struts2
iterate problem in struts2