Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sun RI 1.2 - JSF validation

Venkateshwaran MOct 4 2017 — edited Oct 4 2017

Hi,

We are migrating a web application (uses my faces 1.2) that has been running on WAS 6.1 to WAS 8.5 server. Since Myfaces 1.2 is not supported with WAS 8.5, we have switched to sun RI 1.2.

We have seen couple of issues with the existing page validation methods that have been implemented in two ways. They are

1. Validating all the fields in the action method when the page is submitted as below.

     Example:

     public String submit(){

          if (null == username){

               Utils.addComponentErrorMessage(USER_NAME, VALUE_MUST_BE_ENTERED);

               return null;

         }

         return endScreenFlow();

     }

This validation works fine with Myfaces where as it is not working correctly with Sun RI 1.2 (it includes some duplicate div page elements while refreshing the page)

We see that it is working when we have the actual faces navigation id returned instead of returning null when the validation fails. We have gotten huge amount of files where this scenario is seen, thinking if there could be any other possible fixes.

2. Validation is done by binding a validation method in the page element itself.

    Example:

   <tr:inputText id="useName" value="#{myBean.username}" validator="#{myBean.validateUserName}" />

     public void validateUserName (FacesContext, UIComponent, Object){

          //validation logic

     }

In both scenarios, we have issues with the reloaded page (some duplicate elements) and would be grateful if I am given with some possible fixes please.

Thanks,

Venkat

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 1 2017
Added on Oct 4 2017
0 comments
774 views