File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes UpdateModelException - Property 'xx' not writable on type java.lang.String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "UpdateModelException - Property Watch "UpdateModelException - Property New topic
Author

UpdateModelException - Property 'xx' not writable on type java.lang.String

David Squire
Greenhorn

Joined: Sep 23, 2009
Posts: 5
I am getting the following error when I try to submit an AJAX request:

serverError: class javax.faces.component.UpdateModelException /s/tabs/variables.xhtml @219,151 value="#{row.valueLabel}": Property 'valueLabel' not writable on type java.lang.String

I'm using JSF 2.0 and Tomcat 7.0. In my backing bean I have a list of "ValueLabelRow" classes. The ValueLabelRow class has two properties a "value" which is an Object and a "valueLabel" which is a String. They both have getter and setter methods and there is nothing else in this class. It is a totally simple POJO.

On the front end I am using an h:dataTable tag with two columns. The first column uses an h: outputText to display the "value" as a read only value, and the second column uses an h:inputText to show/allow for edit the "valueLabel."

These exact same classes and beans used to work just fine in JSF 1.2, but now as I'm upgrading to 2.0 I'm hitting this error. I don't understand why the property is not writable. And why is it saying "not writable on type java.lang.String?"

Any help would be greatly appreciated!

Thank you,

Dave

Alastair Rae
Greenhorn

Joined: Nov 14, 2003
Posts: 7
I don't have an answer but I do have the same problem in JSF2 + ui:repeat
Darcio Pacifico
Greenhorn

Joined: Jul 06, 2011
Posts: 1
(Using JSF1.2+Richfaces3+Spring3+Hibernate3+Java1.6)

I have exactly same error when my properties have generic return:
...<P extends Serializable>...
public P getPK(){...}

As a workaround i override these methods forcing return to String.

I hope this helps you and other people. Good luck!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

And a hearty "Welcome" to all you new greenhorns!

You need one of the following:

A)

Add a toString() and a constructor-from-string method to the bean

B)

Write a JSF converter class to convert the bean to and from String format.

It is essential that anything you send to a web page be convertible to text format since HTML is text.

In David's case, I suspect that the get and/or set methods were incorrectly defined. JSF cannot see these methods unless they are public, so the proper forms would be:


For clarity, I've omitted constructors, the value get/set methods and other amenities.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
jQuery in Action, 2nd edition
 
subject: UpdateModelException - Property 'xx' not writable on type java.lang.String
 
Similar Threads
Error reading resource Hibernate
javax.el.PropertyNotFoundException: Property 'logoutUser' not found on type org.ssc.webapp.UserLogin
Hibernate throwing SAXPasesExceptions
many-to-one relationship to non-PK field
XML file error