Reputation: 23
Is there a simple framework for processing form submissions via a servlet? For my needs, a framework like STRUTS seems like over kill.
My ideal processor would be a servlet that converts form elements into a bean object, possibly using typing information in the form to help with the conversion. Does something like this exist or is there another solution out there geared toward simpler needs?
Thanks!
Upvotes: 2
Views: 260
Reputation: 1109635
Stripes is the most lightweight MVC framework which suits your needs.
A pure JSP solution would be <jsp:useBean id="bean" class="com.example.Bean" />
in combination with <jsp:setProperty name="bean" property="*" />
which sets the request parameters as bean properties matching the request parameter name. But this doesn't leave much room for abstraction and easy form processing (conversion, validation, changelisteners, invoking action, etc).
You may consider to use JSF, Sun's own MVC framework. Although this looks overwhelming and overkilled, it's after all actually simple to start with. Especially JSF2, part of JavaEE6, which ships with annotations so that there's no need for configuration headache with XML files. Here and here are some JSF2 tutorials.
Upvotes: 2