Bear Bibeault wrote:My rule of thumb is to never do on the client what can be done on the server before getting there.
Bear Bibeault wrote:I do this very thing quite often. I use an Ajax request to fetch the newly sorted table and replace just the table. All formatting is handled by the back-end code (ending with a JSP (JSTL/EL) that does the table formatting).
I simply use a jQuery load() method to reload the table.
Bear Bibeault wrote:Most of my apps that do this are set up something like this:
jQuery stuffs the table into the DOM location identified by load().
Steve Dyke wrote:
Bear Bibeault wrote:Most of my apps that do this are set up something like this:
jQuery stuffs the table into the DOM location identified by load().
I think I understand this, having the table inside a DIV tag.
Bear Bibeault wrote:Why the two Ajax calls?
Bear Bibeault wrote:No. Why would you need to do that in two separate requests? Why the need to load anything into the session at all?
Your single request submits all the information necessary to retrieve the data (filters, sort info, paging info). The action/command/controller fetches the data from the DB (letting the DB do all the paging and sorting work) and forwards the results to a JSP that formats the results for display.
You're over-engineering the whole thing.
Steve Dyke wrote:How does the form get repopulated seing there is not directlink between it and the display page.
Steve Dyke wrote:
Note: the jQuery.getJSON does not do a forward method to the JSP file.
And the load.("TaskTable.jsp") call has no provisions to send new data values to the JSTL variables.
Which of the two request should I use to be correct.
Bear Bibeault wrote:
Neither. Do both jobs in a single request.
Bear Bibeault wrote:
The request sends all filter data (including sort column, direction, and paging info) to an action that (with the help of the properly structured back-end code) fetches the results from the database, captures it in Java collections, and forwards it to a JSP for formatting as a table.
The response contains the HTML table and is placed into the DOM by the jQuery load() method.
Bear Bibeault wrote:Off the top of my head: Use the name field to record the row/column? Use custom attributes that get passed back as request params?
Steve Dyke wrote:
Bear Bibeault wrote:
The request sends all filter data (including sort column, direction, and paging info) to an action that (with the help of the properly structured back-end code) fetches the results from the database, captures it in Java collections, and forwards it to a JSP for formatting as a table.
The response contains the HTML table and is placed into the DOM by the jQuery load() method.
Okay thanks to your help I have my table responding like it should. Right now depending on role of user the table will display as static data or text boxes which I need to make editable. How can I tie, say the fourth column which is estimated completion date with the first column which is the record index so updates will be pushed to correct record?
Bear Bibeault wrote:
Steve Dyke wrote:
Steve Dyke wrote:
Bear Bibeault wrote:
The request sends all filter data (including sort column, direction, and paging info) to an action that (with the help of the properly structured back-end code) fetches the results from the database, captures it in Java collections, and forwards it to a JSP for formatting as a table.
The response contains the HTML table and is placed into the DOM by the jQuery load() method.
Okay thanks to your help I have my table responding like it should. Right now depending on role of user the table will display as static data or text boxes which I need to make editable. How can I tie, say the fourth column which is estimated completion date with the first column which is the record index so updates will be pushed to correct record?
One more question. Once I have loaded a DIV with the JSP is there a way to unload it so the DIV becomes empty again with out reloading the page?
Bear Bibeault wrote:(You should start new questions in new topics.)
Why would you use Ajax for a frame?