form containing UIOutpus and UIinputs
Hello, one more question.
How can be solve (easilly) this problem.
Imagine that I have form where I present user detail.
Some of items can be changed (like address) and
some of them can't (like login name)
So I choose for instance these components:
inputText - for those that can be changed
outputText - for those that cannot
The problem is (I guess everybody had to solve before):
When user makes a mistake during filling the input field and submits the form
validator finds the mistake and responses with error message.
But as you see, outputTexts are not included in request, so next time the user sees the page where the ouputTexts will be blanked (to be precious they will have default values of Bean Properties). The reason is that the bean was created but there was no action to load the bean up.
Do you understand my problem? If so I would appreciate any advice.
PS: One solution is to use only Input fields and turn some of them disabled, but it doesnt look well.
[1058 byte] By [
sgtPeppera] at [2007-10-2 11:45:42]

> Hello, one more question.
> How can be solve (easilly) this problem.
> Imagine that I have form where I present user
> detail.
> Some of items can be changed (like address) and
> some of them can't (like login name)
>
> So I choose for instance these components:
> inputText - for those that can be changed
> outputText - for those that cannot
>
> The problem is (I guess everybody had to solve
> before):
> When user makes a mistake during filling the input
> field and submits the form
> validator finds the mistake and responses with error
> message.
> But as you see, outputTexts are not included in
> request, so next time the user sees the page where
> the ouputTexts will be blanked (to be precious they
> will have default values of Bean Properties). The
> reason is that the bean was created but there was no
> action to load the bean up.
>
> Do you understand my problem? If so I would
> appreciate any advice.
> PS: One solution is to use only Input fields and turn
> some of them disabled, but it doesnt look well.
This is what I do:
<h:outputText id="recordIdString" value="#{recordForm.recordId==null?recordForm.recordIdString:recordForm.recordId}"/>
<h:inputHidden id="recordIdInput" value="#{recordForm.recordId}" required="true"/>
Basically, recordForm.getRecordId() returns the value from the bean field. However, on post back, this will be null, in which case the value is retrieved from getRecordIdString(). The method recordForm.getRecordIdString() returns the value from the recordIdInput request parameter.
"JSF, wonderfully convoluted ways to do very simple things"