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?
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.
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()