You asked about conceptual idea of a possible solution. I try shortly describe a possible way. How I could understend from your previous question you are a beginner in JavaScript and jQuery. So I try to write simple and clear describe the arcitectur of the solution.
Your Web application can consist of pure HTML or XHTML pages (without any JSP pages) with Javascript files loaded and started throght <script type="text/javascript" src="..."></script>
. You place HTML/XHTML markup in your *.htm files and the definition of jqGrid in *.js files.
jqGrid has three important parameter mtype
which are typically "GET" or "POST", datatype
withe the values like "xml" or "json" and url
parameter. This three parameters defins how the grid will be filled. There are also editurl
cwich are used for CRUD operations. So you can implement a servlet in Java (see http://stackoverflow.com/questions/773508/how-to-learn-ajax-using-jquery-in-a-java-web-app for example) which could be the only active component in your solution which bound to the URL defined by url
and editurl
and support HTTP GET or POST depend of your mtype
choice. It will work like a web service which provide the data for the jqGrids and implement all CRUD operations.
jqGrid will send to servlet some standard parameters. The names of this input parameters of the servlet you can change with prmNames
parameter of jqGrid (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options). The most important parameters of the servlet method are following int page, int rows, string sidx, string sord
. Adfditional parameters could be also bool _search, string searchField, string searchOper, string searchString
if you want to use single searching in th jqGrid or bool _search, string filters
in case of advanced searching. So it user click on the "next page" jqGrid button or click on the grids column header to sort the data, your servlet will by called by jqGrid with the corresponding values of the imput parameters.
In the way you have clear structure of your solution. I am not sure that you will need DWR. Just try to find how you can use jQuery.ajax
to call your Java servlets. If you will have some problems with implemented the same technique inside of jqGrid you can customize jQuery.ajax requests which will be send by jqGrid with ajaxGridOptions
jqGrid parameter. You can also use serializeGridData
event of jqGrid (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events#list_of_events) to implement any data conevrsion before the data will be snd to the servlet and use use jsonReader or xmlReader (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data) which define how the data returned from the server should be readed by jqGrid.