Here is the summary: I need to build a simple java web app that, among other things, will let the user create, update, delete, and view records from a few tables.
My app is required to use Struts2 and the struts2-jquery-plugin to implement AJAX functionality (grid).
However, I’m new to Struts2 (and Java in general), so I’ve being trying to follow tutorials all over the globe. And the more I search, the more I find different solutions and plugin dependencies which means more tutorials to read. I’ve written everything from business, dao, and beans but the .jsp’s and actions. I’m now short on time and can’t spend another week on wrong directions. Hope this thread can save someone else time too.
1- I’ve downloaded the showcase examples and they all seem to use hibernate plugin. Is it a MUST or can I use grid without it? Because it’s too much info for a single human head at this point.
2- Related to sessions. Do I need to configure an interceptor to be loaded at every action call to check if user is logged in, or is there anything taking care of this by default in Struts2? I’m trying to avoid struts.xml, so I’m using convention. How can I achieve this session check without xml configs?
3- If anyone can provide some short and fast examples of using struts2 and grid, it’d be really appreciated.
More questions should come shortly.
My 2 cents: always use KISS (Keep It Simple, Stupid) pattern, especially if you are new to Struts2, JSP and Java in general…
I recommend to start with little things. Login Action, First Action, First JSP.
When all works (you can read data from DB through First Action and display it on First JSP), you can go deeper (EJBs, Interceptors, Validation, etc).
By the way, for Session Checking Interceptor, take a look here
(You put a boolean on login page, you check it from the Interceptor, then you can forget about it, instead of checking it on every Action…)