Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

[JSF] Blank out bean properties when assign HTML element is "emtpy"

Thread view: 
Christoph Dahlen - 08 Sep 2006 15:15 GMT
Hi,

I noticed a problem from "old school" JSP times is also present in JSF.
Assume I have a Managed Bean in my session names "myBean". Also assume
that I have bound the property "prop" of myBean to a <h:inputText>
component.

<h:inputText value="#{myBean.prop}" />

Now, when I enter some text into the generated HTML <input> field and
send the form, this text is - of course - written into the assigned
property.

But, when - after this - I clear the HTML <input> field and send the
form again, the properties value is _not_ removed, the appropriate
setter is not called, when the input from the <input> field is empty
(that is: null or zero-length string).

Can this be avoided?

Gruß,

Christoph
cicap - 08 Sep 2006 19:40 GMT
> But, when - after this - I clear the HTML <input> field and send the
> form again, the properties value is _not_ removed, the appropriate
> setter is not called, when the input from the <input> field is empty
> (that is: null or zero-length string).

are you sure that your inputText has not required="true" ?
Christoph Dahlen - 09 Sep 2006 08:48 GMT
cicap schrieb:

> are you sure that your inputText has not required="true" ?

I am.

Gruss,

Christoph


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.