David has posted 3 posts at DZone. View Full User Profile

jWebApp 4.8.5: URL/Object Mapping, Forms, & REST

05.28.2008
| 4245 views |
  • submit to reddit
Location: 
http://www.jwebapp.org

jWebApp is a trouble free full stack MVC web application framework that truly removes the complexities of web development and its configuration. jWebApp is so simple, it can actually be learned in a matter of minutes. This release includes added support for URL to object mapping, forms, and RESTful web services.

jWebApp Features:

  • An extremely easy web application framework
  • Full stack web development
  • Model-View-Controller architecture
  • Incredibly easy server side AJAX support
  • Full support for RESTful web services
  • Simple configuration free web applications
  • Easy-to-use URL to object mapping
  • Extremely small learning curve (learn in minutes)
  • All the functionality offered by other frameworks and more
  • No proprietary tag libraries and no need for any
  • Use JSP/JSTL, Velocity, or whatever you like
  • Use regular HTML and Forms
  • Optionally use any BSF compatible scripting language
  • Extensive validation support for your data
  • Easily handle forwarding, redirects, and non-secure connections
  • Easily handle SSL(https)
  • Role level security
  • Container- and application-based authentication
  • Built-in URL rewriting for handling cookie-limited browsers
  • Multipart forms and file uploads
  • Email with attachments and HTML
  • Backend direct payment processing
  • Support for regular expression matching
  • Secure file downloading and uploading
  • and tons more (with jCommonTk, jWebTk and JPersist)

jWebApp is literally this simple:

public class JWebAppExample extends RequestHandler 
{
DatabaseManager jpersistdb = AppUtils.getDatabaseManager();

public String processGetCustomer(HttpServletRequest request)
{
request.setAttribute("customer", jpersistdb.loadObject(Customer.class,
"where :customerId like ?",
request.getParameter(“customerId”)));

return "/WEB-INF/customer.jsp";
}

public String validateNewCustomer(ServerInterface serverInterface)
{
... // trivial validation stuff
if (errors.length() > 0) return “/WEB-INF/newCustomer.jsp”
else return SUCCESS;
}

public String processNewCustomer(ServerInterface serverInterface)
{
Customer customer = new Customer();

serverInterface.fillObjectFromRequest(customer);

jpersistdb.saveObject(customer);

serverInterface.setAttribute(“customer”, customer);
serverInterface.setAttribute(“customerSaved”, “Customer Saved”);

return "/WEB-INF/customer.jsp";
}
}

 JSP:

    <div align="center">
<h2>jWebApp Example.</h2>
<b>${customerSaved}</b>
<p>CustomerId: ${customer.customerId}
<p>First Name: ${customer.firstName}
<p>Last Name: ${customer.lastName}
...
</div>

and calling:

host/context/jWebAppExample/getCustomer?customerId=value

or post a form with:

host/context/jWebAppExample/newCustomer

Using the above given URLs, jWebApp automatically finds the supporting class, instantiates it, and executes the supporting method. jWebApp does not require any configuration or annotation, so the above is actually all you have to do.

jWebApp provides support for all of the features you expect, but does not need additional tag libraries or extensive APIs to implement them, what you already know is all you will need. With jWebApp, you can use any model/business layer technologies, any database-access technologies, any web-authoring technologies, and plain old HTML and HTML forms.
0
Average: 4 (2 votes)
Published at DZone with permission of its author, David B..

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)