What is jsm?
In its core jsm is a JavaScript library to build highly responsive web pages. It is currently focusing on displaying
information in tables and makeing it editable.
There are Java classes to bridge the gap from the server to the client side. One could also provide PHP or other
brigde classes around the core JavaScript library.
Why does it exist?
In the web applications I am working on a lot of screens are create, update, delete screens. Normally we display
the information from the business objects in a table and add a few icons to edit and delete rows.
On top we add a filter area to filter the records shown. On every 'Apply filter', 'Edit' or 'Delete' a call
to the server was made. This took its time. Plus we had to write similar code over and over again.
This is why I decided to create jsm. When creating CRUD screens it reduces development time, makes the screens faster
and standardizes them from a layout point of view.
Obviously jsm can be used and will be helpful in other scenarios.
Features of JsmTable:
- Sortable
- Resizable
- Editable
- Pageable
- Extendable, eg. by your own Filters, Validators, ActionCells, Widgets
- A fully functional filter area can be generated
- User events, like jsmOnTableHeaderClick, jsmOnTableCellClick, jsmOnTableRowClick can be implemented
- Layout is definable via stylesheet classes
- Lazy loading of data
How can I learn more
Browse thru the introduction PowerPoint presentation. There is also an example web application distributed with jsm.
How am I supposed to use it?
Basically you create JavaScript model objects and render the model onto the page. Then you can start to modify the model and
re-render it. Maybe you called the server using Ajax to retrieve information or update the business objects.
The whole web page is never reloaded.
The recomended process is as follows:
In your MVC framework:
- Retrieve your business objects via a DAO
- Create a JsmTable object and attach JsmTr, JsmTd,... objects populated with data and meta data by the business objects. Use JsmTableUtil, eg. the generateJsmTrs method to make your life easier
- Put the JsmTable object in the ServletRequest
In your JSP:
- Retrieve the JsmTable object from the ServletRequest and call its generateJavaScript method
- Add further JavaScript stuff, which could not be specified on the Java Objects
- For example implement jsmOnSaveRow(table, rowIdx, columnIdx) using the JavaScript/Ajax RemoteCall object to communicate changes back to the server
- For example you added an icon to the table and attached an on click function. Impement this function.
- In your jsmOnSaveRow event get the JSONiced row data and send it to the server using the JavaScript/Ajax RemoteCall object
In your MVC framework:
- Use Java provided utility classes to update your business objects from the JSONiced data
- Save your business objects
- Respond success or failure
- Update the JavaScript model and/or notify the user
In your JSP:
- Update the JavaScript model and/or notify the user
You can skip steps if not applicable. Also there are other uses for jsm completely outside this process.