This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Struts and the fly likes In Need of Urgent help Struts + jquery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "In Need of Urgent help Struts + jquery" Watch "In Need of Urgent help Struts + jquery" New topic

In Need of Urgent help Struts + jquery

Vikas Dhyani

Joined: Jul 15, 2010
Posts: 1
Hi all,

This is vikas. I am COMPLETELY NEW TO STRUTS(struts2 framework). I have a task to use jquery to make ajax call to the actionclass of the JSP from which i m trying to make a call.

My JSP has 2 forms, the aim is to make actionclass call from one form, with loading the entire page. I am putting the jsp code without jquery for your reference:

I need to make a jquery ajax call from the second form submit tag(without reloading of the entire page)... I am completely clueless of what to do... pleease pleease help me.. with the steps to be done.

Warm Regards,
David Newton

Joined: Sep 29, 2008
Posts: 12617


Are you having an issue with Struts 2, or with jQuery?
Sita Marivada

Joined: Apr 01, 2010
Posts: 14
You can make a call to action class using sj:div tags.

<s:url var="urlajax1" action="youraction" namespace="/ns escapeAmp="false">
<s:param name="paramname" value="%{value}" />

<sj:div id="someid" href="%{urlajax1}" />

When rendering the page,when container encounters sj:div ,it looks for href and makes a call to particular action class(in s:url).It will just update the page with the result fragment returned by your method in action class in the particular div area in the jsp.

In this way you can call multiple actions from the same page by adding multiple sj:div's

Sita Putta
jQuery in Action, 2nd edition
subject: In Need of Urgent help Struts + jquery