Pagination in JSP using DataTables - java

I am planning to implement pagination in my JSP using DataTables. I previously implemented it using DisplayTag Library but looks like it is getting old now. I couldn't find a good example or a resource about Datatables on how to do it in a JSP. I have a list of object in my JSP and intended to show 10 records per page. With DisplayTag I did it very easily but with DataTables I am not exactly sure if it is straight forward and the changes would just be in the JSP. I want some thoughts or if there is any other library out there to help accomplish my goal.
Thanks.

Go with this link.
DatabaleExample

Related

Update data in html table without refreshing whole page

I am developing a simple project using spring and hibernate, and at the moment I need to update data in database and in html page without refreshing whole page. What ways can I accomplish this and what ways are best suited to the spring hibernate combination? Is it possible without using javascript?
You have to use AJAX and JQuery most of the time and you cannot do it just using java or something like that. Javascript has come to stage if you need to perform some database operations without refreshing the page. If you want to learn more about how it can be done using spring and hibernate you may look at this link:
http://www.javacodegeeks.com/2012/02/ajax-with-spring-mvc-3-using.html
or
http://fruzenshtein.com/spring-mvc-ajax-jquery/

how to start on using DataTable in Jquery

I am trying to learn Java and Javascript. Currently I following MVC, where i have servlets that will send data from a table to a JSP and I disply the data in table.
i am trying to make this table editable and create a good look and feel of the table using DataTable, however i am not sure how or where to start..Can someone please help me on this. I am a beginner and any simple example on on how to use DataTable would really help?
Thank you!
There are several examples here: http://datatables.net/examples/
Datatables is a great plugin if you want to show the data. But in my experience, it is not simple to interact with the server.. Like... add a new tr and create an instance on database using java. It is complicated this interaction.
In my experience, I would use primefaces datables: http://www.primefaces.org/showcase-labs/ui/datatableBasic.jsf;jsessionid=1si9n7bh9e6921gz0mj3w42ew3

Spring MVC. Rendering layout

I'am new to Java Spring MVC. Official documentation is very poor and i've got a lot of questions about rendering pages in Spring.
I have page and top block with menu. This menu must be dynamic and must be displayed on all pages. In PHP frameworks this is very common and very easy task. But Spring makes my brain explode.. How can i separate rendering of this menu in some peace of logic and tell spring to render it all the time? For example in JSP. Shoud I use beans or other stuff?
Thanks for your answers!
Official documentation is very poor
No it isn't. Its the one place I always refer back to.
I use a jsp include and yes pass a java bean to the jsp from the controller. The included jsp will be cached the first time it is included. In other places I connect to a controller using jquery and ajax, which dynamically updates the page.
I'd suggest the official tutorials, and krams as good starting points.
You won't find much information about this in the Spring documentation because it's out of the scope of Spring.
You can use JSP includes just as you would do PHP includes. This will however force you to repeat the page layout and the include in each and every page of the application :
<jsp:include page="/menu.jspf" />
Or use a templating engine, like Sitemesh or Apache Tiles (see http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/view.html#view-tiles for Tiles integration in Spring).
The easiest way would be to use <jsp:include page="/menu.jsp" /> where "/menu.jsp" is a path to your menu jsp.
There are other solutions like using tiles, but <jsp:include> should do.

Dyanamic Graphs using jsf

My requirement is I need to populate dyanamic graphs in a jsp page. I am using jsf for my project. I planning to use "jfreecharts" but dont know how to bind my jsp page with the back bean. I have some drop downs on the basis of the selection I my BackBean is fetching the data from the DB. Can you please suggest me some procedure to that with some sample code for my reference?
You can use Fiji (Exadel) library.
They have charts, as well as support for wrapping SWF elements and sending properties in JSF.
See an example here. For each component, there is source code as well so you can try it yourself.
Primefaces has a nice chart component as well.
Fiji is very nice but check out this http://www.fusioncharts.com/

JQgrid and Java

Can someone point to jqgrid + java web app solution or especially with populating the grid and sending the form back to server. there are several php examples but nothing on java.
If you want to use some advanced tools like Spring, Hibernate and Maven here is the good example.
http://krams915.blogspot.in/2012/01/spring-mvc-31-jqgrid-and-spring-data_1887.html
EDIT:
See this, if you want to use plain Servlet and JSP. This is very basic example.
http://javahunter.wordpress.com/2010/12/07/jqgrid-example/
Here is one example on the web:
jqGrid Forum: how-use-jqgrid-in-jsp-server-one-example
If you are using struts2 there's a plugin which includes jqueryui and jqgrid components.
http://struts2-jquery.googlecode.com/

Categories

Resources