Introduction
NOTE: The delete functionality isn't working correctly in this application after you do a sort on the colums. Hopefully someone can help me figure out how to fix it.
The plan was for this to become a nice walk-through tutorial/lesson. Hopefully I'll get around to it. In the meantime, I think many will be able to get a lot out of this sample application. If there are things wrong with it, please let me know by e-mail. If you are new to JSF (as I am at the moment), please ask general JSF/MyFaces questions on the MyFaces mailing list. Unfortunately, I don't have a lot of time right now to answer JSF/MyFaces specific questions, plus you are better off getting answers from those much more knowledgable than myself.
Thanks to all those on the MyFaces and struts-users mailing list who helped with answering my many questions. (Not going to name specific names since I'd feel bad if I left someone out).
Some of things this application demonstrates...
Thanks to all those on the MyFaces and struts-users mailing list who helped with answering my many questions. (Not going to name specific names since I'd feel bad if I left someone out).
Some of things this application demonstrates...
- MyFaces
- DataTable using ListDataModel
- Sorting DataTable
- Master/Detail example not using request params to get detail record
- SelectItems for select options
- Use of prerender from Shale (not truly a good real-life usage, but demonstrates it being used).
- Using mostly request scope for Backing beans
- saveState
- preserveDataModel
- rendered attribute
- Managed properties
Compiling/Building
I'm not a pro with Ant but the build script works even though I'm sure it could be re-written to be better.
ant build
will build and deploy a war.
Note
The "real life" part of this application stops at the EmployeeService class. This tutorial isn't demonstrating how you would actually do the true persistence of your data. I happen to like iBATIS http://ibatis.apache.org/, but the point is you should be able to use any persistence framework you want. The EmployeeService class in this example is just a layer that would then call your persistence framework of choice, but in real life you'd want a more robust setup (Interfaces etc). The application is mainly to demonstrate JSF usage not persistence. This lesson just uses a static map to store stuff.