Java : Java related items, personal opinions, coding, etc.
Updated: 2/2/2004; 2:41:48 PM.

 

Subscribe to "Java" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

Sunday, January 12, 2003

Figured out a nice Jakarta Struts 1.0.2 trick.  If you are trying to do form validation, and you are storing your form bean in the session, you may get some validation errors from the validate method of your form bean.  Struts may try to validate your form on a normal display if your user has visited the form, left, and then returned to the form. 

To prevent the form bean from validating when the user has not submitted the form, I put a hidden input field in my HTML form called "submitted" and set its value to "true".  In the validate method of my form bean, I put:

// Check to make sure that the form was submitted
if (request.getParameter("submitted") == null) {
    log.debug("Form was not submitted, return no errors.");
    return null;
}

This checks to see if the hidden input field was in the request when the form is displayed.  If it wasn't, it means that the user didn't actually submit the form.  So, the block returns null to tell Struts that there were no ActionErrors when validating the form. 

When the user actually submits the form, the value of "submitted" will be "true" and the above block of code won't execute.


12:33:52 PM    comment []

JDEE 2.3.2 now has extremely nice Ant build support.  It will scan your build file for targets and do completion when it prompts you for which one to build.  If a build completes without errors, the window automagically goes away now instead of remaining and annoying you.  Love it.
12:22:06 PM    comment []

JDEE 2.3.2 now includes a code style checker!  Sweet!  There are many other improvements that I'll probably be writing about. 
12:04:30 PM    comment []

© Copyright 2004 Tom Pierce.



Click here to visit the Radio UserLand website.

 


January 2003
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Dec   Feb

Search

 
How this works

Emacs Sources
 tsql-indent.el
 user-add-sql-folding-marks
 remove-line-boundary-in-region
 convert-camel-to-underscore

My Subscriptions
 Funny
 KM