Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with Error message and Bean  RSS feed

Tanu Gulati
Ranch Hand
Posts: 113
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsf page where I have several text boxes. some of the text boxes have validation in JSF for maximum number of characters

<h:inputText id="resZipCodeEF" styleClass="formEntryTextNormal"
style="width: 90px" maxlength="9">
<f:convertNumber type="zip" integerOnly="true"
pattern="#{property.zipPattern}" />

Now I did following things
1. ) entered 11 in first text box i.e "resZipCodeEF"
2. ) change the value for SECOND text box from "aa" to "bb" (both the text box are in different jsp but included in one page)
3.) refresh the page

I see that on refreshing the page an error message is generated asking me to enter the value in first text box i.e. "resZipCodeEF" in proper format ..that is fine I should enter atleast 9 characters in the field.

BUT TO MY SURPRISE...the SECOND text box (mention in step above) automatically changes back to original value and did not take the new value provided by me ....

If there is no Error generated from jsp and i refresh the page SECOND text box will have the new value

NOTE : I am not saving the page in to database here only page refresh.
IN summary : on refresh of page when there is an error other text boxes on page does not hold the new value BUT when there is not jsp validation error and i refresh the page i can see all text boxes holding new value

please let me know if i can provide more information
Tim Holloway
Posts: 18774
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you don't show the second text box, but you said "other JSP".

To me, that sounds like the 2 text boxes are in 2 different forms - one on one JSP (View) and one on another. And, since a basic rule of the HTML system that underlies JSF is that only one form can be submitted at a time, I would be unsurprised to see the second form revert to the values in its backing bean(s).
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!