Get your CodeRanch badge!*
The moose likes Struts and the fly likes How to call Struts 1 action without page reloading? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to call Struts 1 action without page reloading?" Watch "How to call Struts 1 action without page reloading?" New topic
Author

How to call Struts 1 action without page reloading?

Konstantin Netkachev
Greenhorn

Joined: Jul 24, 2009
Posts: 15
I only need to save form data in DB without page reloading or forwarding to other page.
Is there possibility to do that without AJAX usage?


So I want that PlanManagerAction only save data and doesn't do any forwarding/page reloading. Is it possible in Struts 1?
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
Konstantin Netkachev wrote:
Is there possibility to do that without AJAX usage?


Add a hidden iframe to the page and set it as your form's target (html:form ... target="name_of_iframe")


OCJP 6 (93%)
Konstantin Netkachev
Greenhorn

Joined: Jul 24, 2009
Posts: 15
When I do this, after submiting page is opened in new browser window.

What's wrong?
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
oops, double post, sorry!
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
Konstantin Netkachev
Greenhorn

Joined: Jul 24, 2009
Posts: 15
Ok, thanks.
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
You're welcome!
Richard Golebiowski
Ranch Hand

Joined: May 05, 2010
Posts: 213

You can also just set the status of the HttpServletResponse in the action to 204 by using setStatus:

response.setStatus(204);
Peter DeGregorio
Greenhorn

Joined: Jul 11, 2002
Posts: 9


response.setStatus(204);


response.setStatus(response.SC_NO_CONTENT);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to call Struts 1 action without page reloading?
 
Similar Threads
Struts: ComboBox onChange action
Struts upload not working
data submit on popup and refresh parent page
what if I replace the "html:form" by "form"?
can i use a normal form with struts?