• 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 and AJAX

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the disadvantages of sending all the request to struts in jsp via AJAX?
The project that i am working on is only having 6 pages and home.jsp is the main page. I want to send all the request in home.jsp via AJAX to struts to process it? Basically I will be having only one Action class for all the action in home.jsp and process those request in the execute method.
Is this way is a correct way of doing it? what are the disadvantages of doing this way?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jaffrin,
I don't recommend using the same action for everything. If you have 6 pages, it's likely because they do 6 different things? Why not have 6 actions? This decision is independent of whether you choose to use AJAX in your application.

If you share more about what your page does, you may get more useful comments on whether or not AJAX is useful there.
 
jaffrin abdul salam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replying. I will be having 6 different action class for the other pages.This is very simple application . As I said before , home.jsp is the main page. Users will be spending lot of time in the home page. Other pages will be preference page, Contact us etc. There will be no much action involved in other pages.
So I will be sending all the request from home page to that Struts action class for the home page.
I wanted to do same way they have done here http://www.omnytex.com/articles/xhrstruts/. Instead of redirecting to a jsp in the execute method I will be having like this.
// Write the HTML to response
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println(html);
out.flush();
return null; // Not forwarding to anywhere, response is fully-cooked
} // End execute()


Please advice me what is the better way.
reply
    Bookmark Topic Watch Topic
  • New Topic