Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
David Squire
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have an answer but I do have the same problem in JSF2 + ui:repeat
 
Darcio Pacifico
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(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
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic