Forum Stats

  • 3,815,452 Users
  • 2,259,028 Discussions
  • 7,893,106 Comments

Discussions

Sun RI 1.2 - JSF validation

Venkateshwaran M
Venkateshwaran M Member Posts: 1
edited Oct 4, 2017 8:47AM in JavaServer Faces

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

This discussion has been closed.