wood burning stoves
The moose likes JSF and the fly likes problem with Error message and Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "problem with Error message and Bean" Watch "problem with Error message and Bean" New topic

problem with Error message and Bean

Tanu Gulati
Ranch Hand

Joined: Oct 06, 2008
Posts: 113

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

Tanu Gulati
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

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).

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: problem with Error message and Bean
It's not a secret anymore!