• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts 1 Toekn Processing in Ajax Request

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic