Ajax and MVC Model 2 Integration


Web tier: servlets, JSP, Web frameworks: Ajax and MVC Model 2 Integration

  1. Ajax and MVC Model 2 Integration (6 messages)

    Hello, I am looking for a solution regarding jsp/ajax integration. I made an application where I use servlets. This is very typicall MVC Model 2 architecture. I am using jsps where I show data from request or session scope. I would like to provide ajax version of view and I am wondering would it be possible to use a kind of ajax-framework where I could use jsp pages and do not change MVC architecture. When agent is sending requests to controller servlet, with parameters, depending on values, one page is displayed but with diffrent content of objects i show ( using ${object}) in request/session scope Would it be possible to make jsp page with ajax and send requests (by XMLhttprequest?) and do not reload whole page but only get new requestObject with fresh business data? There are planty of frameworks but I could not find solution. I think this is very typicall problem for all of people who wants to change to integrate standard MVC (model2) application with AJAX.

    Threaded Messages (6)

  2. Re: Ajax and MVC Model 2 Integration[ Go to top ]

    Looks like you don't want to disclose your MVC Model2 framework name -)) or it may be a custom framework. In any case, check out: how DWR integrates with Struts which might be of help for you ?? http://getahead.ltd.uk/dwr/server/struts Bhagvan K http://www.jroller.com/page/bhagvank
  3. well....[ Go to top ]

    I use Spring Web Flow, and DWR will not help me to obtain new objects in session scope within jsp page where I use Ajax. :->
  4. Re: well....[ Go to top ]

    Are u invoking a servlet perhaps to bring the DOM data from the back end to render the page? I believe you might need to include a small custom servlet layer on the server and then use that layer to create a dynamic dom structure each time an XMLHTTP(Ajax) request is sent to the server from your browser, and inside the servlet you may obtain all the session /associated data, then buld an xml document and send it to the browser, where you can do your ajax tricks using JavaScript.
  5. AJAX Tags[ Go to top ]

    U can use AJAX tag libraries...we used the same to integrate ajax with our custom web framework...
  6. no solution found[ Go to top ]

    Well.. let's say there is a url with 2 parameters (from and howMany) http://localhost?from=10&howMany=5; Request goes from user browser to Controller Servlet which invokes business methods on model and then this Controller adds objects to session scope and redirects request to jsp page. This jsp page shows objects from session scope and there are are also many web links like http://localhost?from=10&howMany=5; http://localhost?from=15&howMany=5; http://localhost?from=20&howMany=5; so when user clicks, he sends requests and the same page is loaded but with diffren content in session scope. I known there are ajax tags and other solutions which allow to access data in request or session scope. The problem is that in this case I need to send new request if user want to se newest/other data and this new data must be shown on the same page (without refreshing whole page, but only to make that I have new objects in session scope)
  7. Re: no solution found[ Go to top ]

    for example, in your app, you may want to update a select box or re-draw a div ..without changing any other part of the page. on the eventhandler javascript functions, you have to somehow bring an xml fragment from the server. I havent used any taglibs for Ajax, but instead we use our own framework, where there is a DOMserver servlet which is invoked using XMLhhtp which then serves the the xml and then we simply update the fragment of the webpage.