I need to display some tabular data in a JSF page. I need some kind of grid component, but it is a must for it to have a pager and also to be able to sort the displayed data(example: by date created, alphabetically or simmilar...) Most probably i will start to create a custom component that fits all my needs, but i was wondering is is there any tag in JSF 2.0 or in some other library that already includes all this features. I would prefer not to use an external library like richfaces or similar just clean JSF 2.0. But if there is any good gadget out there i might give it a try.
Have a look at the p:dataTable component from Primefaces. It has sorting, filtering, pagination, row selection and a lot more features.
Getting started with Primefaces is quite simple. Download the jar, put it in your classpath and add the following namespace definition to your facelet's html tag:
xmlns:p="http://primefaces.prime.com.tr/ui"
Related
I'm just starting out with Spring MVC having been trying to pickup Java(Web) for the few months.
I'm sure what I'm trying to achieve is very simply, but I can't find a solution that really works.
I'd like to include another controller/view inside a view. This could be a menu, or some other dynamically generated content. For example, let's say in a side bar of an application I need to display a list of categories. I don't want to have to retrieve these categories in every controller/view that needs to use them. I'd like to include another controller/view into the main page view so that this content can be placed in multiple views but managed by a single piece of code.
ASP.NET MVC has something called PartialViews, and most PHP frameworks seem to offer this kind of functionality, but I can't find anything like this in spring.
The closest I've come to resolving this issue is to use the jsp:include tag, which does work, infact it's almost the solution, but it generates errors in Eclipse because obviously Eclipse can't locate the path, as it's a spring RequestMapping i.e. /include/categories rather than a direct link to a physical file.
The other solution is to use Javascript to dynamically load content into the sidebar, but I don't want to do that.
Is there a 'correct' way to do this, or is there a way to supress the errors generated by eclipse for the jsp:include tag?
If the content your are including is static and you don't have a lot of different pages, your approach with including jsps is ok. Otherewise, look at the templating frameworks like Tiles or Thymeleaf.
I want a pick list as available in richfaces in jquery or any other which is compatible with jsf2.0
But I don't want to use richfaces, icefaces or primefaces.
I am getting some of the similar components in jQuery but I can't directly bind them with List in ManagedBean
Chosen JQuery is the good option, and it gives the selected value directly in the back bean.
I need this for the import functionality of the web-based app im creating. I need to get the path of a text file the user wants to be imported in order to egt the data inside the text file and saves it in a database.
There is no such component in standard JSF. However, there are several component libraries that offer file selection:
PrimeFaces <p:fileUpload>
RichFaces <rich:fileUpload>
IceFaces <ice:inputFile>
Tomahawk <t:inputFileUpload>
etc. - basically every JSF component framework has such a component
You could check this out - http://livedemo.exadel.com/richfaces-demo/richfaces/fileUpload.jsf, and build yours accordingly.
I am using JSF2.0 and facelets. How to perform sorting, filtering and page navigation in facelets using jsf dataTable?
You could use a component library like PrimeFaces, which has a dataTable with support for sorting and filtering.
You will be able to do it reading BalusC articles
http://balusc.blogspot.com/2006/06/using-datatables.html
http://balusc.blogspot.com/2008/10/effective-datatable-paging-and-sorting.html
I believe this will works fine with JSF2, maybe with some modifications.
Or you can use PrimeFaces as Mark said or RichFaces..
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/