wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts 1 Toekn Processing in Ajax Request 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 "Struts 1 Toekn Processing in Ajax Request" Watch "Struts 1 Toekn Processing in Ajax Request" New topic
Author

Struts 1 Toekn Processing in Ajax Request

Mihir K Parekh
Greenhorn

Joined: Jul 20, 2012
Posts: 11


I am Using Struts 1.3 in My Application and I have used Struts token methods in my Base Action class for creating new Record. For Example

public class BasicCreateAction extends Action{

@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {

if(isTokenValid(request)){
// process request
// resetToken(request);
}else{
// duplicate request simply discard it
}
}

}

in My Application all my Action classes created for Creating Record in Application extends above class and leverage its base functionality.

this works perfectly in the scenario where User explicitly submits forms. in some case the record is created via Ajax Request and not by submitting form. for example,

User wants to create a Product in to application so he presented a product page to create it.it has some fields like Product Name , Number , SKU , and Product Type. the last filed Product Type is separate entity so i have provide option to user to create it by providing Popup menu to create it , in the Popup menu there is a form to create a Product Type. when user press a button on the Popup menu this Product type is created via Ajax Request sent to the server.

so my question is how can i save token for this scenario , so i can i use it in my Action Class as exactly as i can use in previous case ?

in previous case i am saving token from subclass of DispatchAction class where all forwarding of particular page occurs.

Thank You Mihir Parekh
 
jQuery in Action, 2nd edition
 
subject: Struts 1 Toekn Processing in Ajax Request
 
Similar Threads
Refresh parent window without closing popup with struts validation
Refresh Problem
Summary of Struts, by Struts newbie
Preventing multiple posts...with popup windows in the mix
using inheritance in struts