geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "xu haihong" <>
Subject [DISCUSS] Improve the inputs validation and message display in the Admin console
Date Mon, 18 Aug 2008 05:37:57 GMT
   I have using the Geronimo for some time, I just found that it is lack of
a strong strategy of inputs validation and message display, and currently,
some pages in the console has these functions, and some do not. I guess that
we may need a uniform way for it. I have some ideas for it, and please feel
free to give some comments, thanks !
  I list some issues that need to be resolved if we would have a better
inputs validation and message display, and try to give some comments for

   1.  *While in the whole console application, we may need a unique message

   -     Message types: Usually, message types include prompting, warning
   and error. Depending on the type, we could choose different style to display
   -     Message content: A short description for the message. For example
   while we deploying a module, this could be that it is successfully deployed
   or it is not successfully deployed
   -     Message detailed information: The detailed information for the
   message, let's take the example above, if the deployment failed, maybe the
   user wish to get some more information, such as the exception stack.
   -     Message target element: Who is the message for, commonly, after we
   validate the inputs, we should specify which form component is this message
   for. In the meanwhile, if we know it, we could use some CSS style to
   highlight the target element.

    2.   *How to implement the client (usually it is a form component)
*     Generally speaking, using script language is the popular way, but
writing and debugging JavaScript is not an easy thing. Fortunately, dojo is
integrated into the console and it provides a very powerful validation
function. For   example, if you want to mark the input box is required to
input, you only need to add an attribute named required with the value
"true", and dojo will do the checking for you when you submit the form
We wish to adopt the dojo's way to validate the client users' input and
display messages to them,

   - Once the user finishes the input and the input component loses focus,
   the input component is marked in other color if the validation fails, also
   an error message is displayed in a tooltip form.
   - When the user submits the form, dojo will navigate the first input
   component needs to be modified.

    We try to extend the dijit.form.Form component, and successfully
implement some extra functions (By the way, I am not sure whether Dojo
provides these functions, so far, I could not find them.):

   - The corresponding label of the error input box will be marked in red
   - Provide an extra point for the developer to add their own validation
   logic, e.g. with it, we could make sure the end date is after the start

   3.   *How and where to display these client side and server side
validation messages?*
          For those messages from client sides (do not contain a specified
target component) and server sides, we will show them in the way below:

   -  List all the messages line by line.
   -  If the detailed information exists, by clicking the 'show detail'
   button, a pop window or a hidden block will show the detailed information.
   -  If the message is for a target component, we could click the message
   to navigate to the target component.

                       E.g. the module is successfully deployed
                              The module is successfully started.
              And we may provide a message container for each Portlet, which
means all the error messages for a Portlet will display together. We suggest
the location is on the top of the Portlet.

   4.  *How to implement the server side validation?*
        Like what those popular web frameworks do, some methods will be
added in the org.apache.geronimo.console.BasePortlet class.

   - public void addErrorMessage(String message, String detailedMessage
   ,String targetElementId);
   - public void addWarningMessage(String message, String detailedMessage
   ,String targetElementId);
   - public void addPromptMessage(String message, String detailedMessage
   ,String targetElementId);

    5. *How to catch the PortletException?*
        All the expected error messages could be added by the methods. But
how to catch the those unexpected PortletException and show a user-friendly
web page.

   -  One way is that all our portlets use a customized PortletServlet in
   the web.xml, not using the one "org.apache.pluto.core.PortletServlet".
   -  Add a try-catch block in the template page for each Portlet request
   may be a choice too.

    6. *How to rebound values to the form fields?*
          It is a common issue in the web applications. While server found
some inputs are incorrect, and return to the user, those inputs should be
kept. We are not using some technology like Tapestry, so we should handler
it ourselves. Using Jason binding integrated in the Dojo maybe a choice. Or
we handler it by ourselves, add a jsp tag for each input component.

    Thanks !


View raw message