Skip to end of metadata
Go to start of metadata

View Rendering

Struts/JSP

  • JSP pages, tag files, struts lib

JSF/Facelets

  • Facelets pages, templates, tag files, JSTL, tag decorators, custom EL resolvers, resource libraries
  • Layout and rendering separated, could attach a WML or PDF rendering Kit for example
  • Many third party libs, (with ajax, jquery, gwt support to name a few)

Spring

  • JSP/Tags/JSTL - taglib provided for form elements
  • velocity
  • xslt
  • pdf/excel
  • Jasper
  • XML
  • JSON

Population

Struts/JSP

  • Struts populates Form from request parameters
  • Formatters are used for types and special conditions
  • Populate hook on form for custom processing
  • Customized version of PropertyUtils to handle nulls

JSF/Facelets

  • JSF populates beans (which can include form) from component values
  • Converters are used for types and special conditions
  • No hook by default, can create one in framework
  • Handling nulls? Might be able to hook into JSF
  • Was able to create a common converter which calls ObjectUtils#getFormatterWithDataDictionary(because the value expression is available, the business object and property name can be determined)

Spring

  • Binding to request parameters to POJO's done by framework. BindingResult object provided to controller with error messages and un-bindable data.
  • Converter and Formatter interfaces provided. Can register per field, controller, or global to spring DispatcherServlet instance. They are registered per java type.
  • primitives can only be formatted by registering java PropertyEditors

Multi-Form processing

Struts/JSP

  • Wrote special handling logic in form populate base

JSF/Facelets

  • Myfaces extensions provides a filter

Spring

  • Provides a filter

Validation

Struts/JSP

  • Validation hook on ActionForm called by struts lifecycle

JSF/Facelets

  • Validation called in JSF lifecycle
  • Can use existing validators and build own by implementing Validator interface

Spring

Controller/Mappings

Struts/JSP

  • Controller extend Struts action class and have predefined method signatures
  • Controller mapping done with XML
  • For determining controller method, a request parameter is used. For form posting (mapping buttons to
    methods) we maintain logic to parse the method name from the button name.

JSF/Facelets

  • Controllers are declared in XML or annotated with CDI (managed bean)
  • Method signature must be zero arg and return String
  • No mapping, URLS point to JSF page which has action elements (buttons, links) pointing to controller methods

Spring

  • Controllers mapped via convention (url to bean name), annotation (with classpath scanning), directly in spring config, or by implementing a custom HandlerMapper.
  • Method signatures may contain Object(s) to be bound, Binding results, any standard servlet object (request, response, session, etc). Only requirement is that any BindingResult parameter directly follows it's Object to be bound.
  • Interceptors for controllers can be configured in spring (this replaces the struts RequestProcessor).

Navigation

Struts/JSP

  • Navigation handled by defining forward ids in XML (global and within controller), controller
    returns forward

JSF/Facelets

  • Navigation handled by defining view ids in XML (global, within controller, or controller method), controller method returns view id
  • Can have custom navigation handler

Spring

Security (form population)

Struts/JSP

  • editablePropertiesMap in the form
  • client code can register properties to the Map before response is rendered * as response is being rendered the kul tags and custom struts tags register a field as being editable
  • when population of the form is being done the map is checked to see if the property was marked as editable

JSF/Facelets

  • Population to the model (or form) is done indirectly. First when the page is posted the component tree is rebuilt from the page (restore view), then the component are asked to get their values from the request, convert, validate, and finally update the model * If a property was not editable there would not be an associated component created on restore view, or a component with readOnly set to true would be created, in either case the model would not be updated

Spring

Incident Reporting (Exception Handling)

Struts/JSP

  • Exception handlers defined in XML

JSF/Facelets

  • MyFaces has an error handler and you can customize the error page, other than that have to catch exception in base action and forward to error page

Spring

Errors Handling

Struts/JSP

  • Struts has ActionMessage which has key and parameters, associated with a property
  • Kuali MessageMap translated to ActionMessages before response is rendered
  • Since struts message do not have severity, we maintain containers for errors, warnings, and info

JSF/Facelets

  • JSF has FacesMessage which includes a severity (INFO, WARN, ERROR, FATAL), summary and detail text, and associated with a property
  • Translate the Kuali MessageMap to FacesMessages through common action listener

Spring

Initial Setup (UserSession)

Struts/JSP

  • KualiRequestProcessor has hooks for various lifecycle methods, including invoking the action method

JSF/Facelets

  • Can have action listeners and default action listener that gets invoked before the action method
  • Can define pre or post lifecycle listeners for any of the lifecycle methods (convert, validate, populate, invoke action, restore view)

Spring

State Management

Struts/JSP

  • Struts can put form in request or session
  • We have hook into request processor that implements our own session state using a database

JSF/Facelets

  • The component tree state can be held request (client) or server (session), or a custom state manager
    can be created
  • For the model, follows the Java EE Managed Beans (and CDI) spec and MyFaces has extensions on this
  • Another option is use of MyFaces Orchestra which might fix the JPA lazy loading issue

Spring

Resources

Struts/JSP

  • Message bundles defined in XML and then can be referenced using struts tags

JSF/Facelets

  • Message bundles defined in XML and then can be referenced using JSF tags
  • Or can write a custom EL resolver that will get message from configuration service

Spring

Get Requests

Struts/JSP

  • Gets go through standard servlet/action

JSF/Facelets

  • JSF core had limited support for get (can map request parameters to components in xhtml)
  • Third party library PrettyFaces offers page load actions and URL rewriting

Spring

Other Conversion Issues

  1. Can we have base controller classes that allow for overriding when needed? If so, how does this work with the URL mappings?
  2. How will we convert the infrastructure to store off the action form when going to a lookup/question page, then retrieving it on the post back before the population of the form is done? This is currently handled in the request processor
  3. Can we use convention to map URLs and parameter to controller methods so we don’t have to use the annotations? If not we need to at least have a convention for creating the mappings else it would be difficult to know when you are stomping on another mapping.
  • No labels