Reputation: 3305
What is the proper but simple way to display and edit SQL table on JSP pages, having all the SQL and Java code in Servlet?
Coming from ASP.NET environment, I'm looking for GridView substitute - to display editable rows on JSP page but have all the SQL methods in Servlet file. My goal is to have 2 JSP pages: 1st for simple table display, 2nd as a CMS to edit these rows (save button for every record), and a Servlet with most of the Java code.
I would appreciate some simple example to display editable table in JSP, with Java/SQL code in Servlet. I've seen some bits and pieces online, but each one is using different approach. It would be best not to edit any server settings.
Thanks in advance.
Upvotes: 2
Views: 4994
Reputation: 17859
I would suggest using jqGrid. It is sort and simple plus all you have to do is mapping your CRUD url to controllers where you do the the SQL operations.
http://www.trirand.com/blog/jqgrid/jqgrid.html
Upvotes: 1
Reputation: 3753
As far as simple JSP is concerned, there is no such control as GridView in ASP.NET.
You can try JSF based controls like DataTable (http://www.mkyong.com/jsf2/jsf-2-datatable-example/). But it does not have any in-build editing functionality like GridView. Datatable will provide you enough control over it so as to implement your own edit/delete/add logic.
To start with JSF, refer this http://www.mkyong.com/tutorials/jsf-2-0-tutorials/ or http://www.vogella.com/articles/JavaServerFaces/article.html
Upvotes: 1