You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by m!g <ga...@gmail.com> on 2011/02/07 15:37:40 UTC
Tapestry 5 error "Caused by: java.lang.RuntimeException: Literal
values are not updateable"
Hi everyone.
Here is a simple test application:
public class Test {
@Parameter(value="false")
@Property
private boolean test;
@Component
private Form form;
@Inject
private Request request;
Object onSubmitFromForm() {
test=true;
return null;
}
}
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xml:space="preserve">
<head></head>
<body>
<form t:id="form">
${test}
<t:submit/>
</form>
</body>
</html>
When I try to submit form I get error:
org.apache.tapestry5.runtime.ComponentEventException: Failure writing
parameter 'test' of component Test: Literal values
are not updateable. [at classpath:ru/kupivip/pages/Test.tml, line 4]
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.jav
a:1152)
Is it right behaviour of T5? Why I can't update parameter values?
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-error-Caused-by-java-lang-RuntimeException-Literal-values-are-not-updateable-tp3374330p3374330.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Antwort: Tapestry 5 error "Caused by: java.lang.RuntimeException:
Literal values are not updateable"
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 07 Feb 2011 13:44:53 -0200, m!g <ga...@gmail.com> wrote:
> Failure writing parameter 'test' of component TestPage:test: Literal
> values are not updateable.
The message is quite clear: you're trying to change the value of a literal
value. This happens in the first line of your method:
Object onSubmitFromForm() {
test=true;// here!
return null;
}
If you passed a property to the parameter, its value would be changed to
true when you do test = true.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Antwort: Tapestry 5 error "Caused by: java.lang.RuntimeException:
Literal values are not updateable"
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 11 Feb 2011 10:14:35 -0200, m!g <ga...@gmail.com> wrote:
> Hi, there is a lot of place in my project where this situation occurs.
> There is one of them (I removed unnecessary code):
> public class MainTemplate {
>
> @Parameter(defaultPrefix="literal")
> @Property
> private String title;
> void setupRender() {
>
> //on some pages title is auto generated
> if (pathContainer.getProductDesc() != null) {
> title += pathContainer.getProductDesc().getName() ;
> }
>
> //title can be defined in props file
> if (title == null) {
> title = messages.get("title-" +
> pathContainer.getPageClass().getSimpleName());
> }
Why don't you change it to use the title field just to receive the
parameter and another field or variable so you can change it without
problems?
Another suggestion:
@Parameter(defaultPrefix="literal", name="title") // notice the name
attribute of @Parameter here
private String receivedTitle;
@Property
private String title;
void setupRender() {
title = receivedTitle;
...
}
This way, the title field is not bound to anything anymore and you don't
need to change your templates.
> Of course there are other workarounds (i.e. to define all titles in
> props as mentioned before), but I think it's not expected behaviour.
What you're seeing is absolutely expected behavior. Tapestry bindings are
are literally bindings: when you change the value of a @Parameter field,
Tapestry will change the corresponding value (in most cases, a property)
passed to the parameter.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Antwort: Tapestry 5 error "Caused by:
java.lang.RuntimeException: Literal values are not updateable"
Posted by m!g <ga...@gmail.com>.
Hi, there is a lot of place in my project where this situation occurs. There
is one of them (I removed unnecessary code):
Main template with parameter / property "title" (the title meant to be
displaed in head section):
public class MainTemplate {
@Parameter(defaultPrefix="literal")
@Property
private String title;
.....
void setupRender() {
//on some pages title is auto generated
if (pathContainer.getProductDesc() != null) {
title += pathContainer.getProductDesc().getName() ;
}
//title can be defined in props file
if (title == null) {
title = messages.get("title-" +
pathContainer.getPageClass().getSimpleName());
}
//add suffix, here is modification which leads to exception on pages with
predefined titles
title = title + " - TEST";
}
}
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>${title}</title>
.....
Inner template
public class ShopTemplate {
@Parameter(defaultPrefix = "literal")
private String title;
@Component(parameters={"title=prop:title"})
private MainTemplate template;
.....
}
<div t:id="template"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xml:space="preserve">
.....
</div>
Here is page with predefined title:
public class Addresses implements AjaxZoneComponent {
@Component
private ShopTemplate template;
......
}
<div t:id="template" title="My addresses"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xml:space="preserve">
....
</div>
As I understand the only way to pass a predefined literal value of title to
the MainTemplate is to add property in the page class Addresses :
public class Addresses implements AjaxZoneComponent {
@Component(parameters={"title=prop:title"})
private ShopTemplate template;
@Property
private String title = "My addresses";
......
}
Of course there are other workarounds (i.e. to define all titles in props as
mentioned before), but I think it's not expected behaviour.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-error-Caused-by-java-lang-RuntimeException-Literal-values-are-not-updateable-tp3374330p3381074.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Antwort: Tapestry 5 error "Caused by:
java.lang.RuntimeException: Literal values are not updateable"
Posted by LLTYK <LL...@mailinator.com>.
Because it's literal "false" and where changes would be stored is not
specified. If you want to set it you have to have the parameter map to a
property of the container.
The example doesn't make clear what you are trying to do to begin with.
--
View this message in context: http://tapestry-users.832.n2.nabble.com/Tapestry-5-error-Caused-by-java-lang-RuntimeException-Literal-values-are-not-updateable-tp6000461p6000769.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Antwort: Tapestry 5 error "Caused by:
java.lang.RuntimeException: Literal values are not updateable"
Posted by m!g <ga...@gmail.com>.
I made only page just for simplicity. OK, Here is component with parameter:
public class TestPage {
@Component(parameters={"test=false"})
private Test test;
}
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xml:space="preserve">
<head></head>
<body>
<div t:id="test"/>
</body>
</html>
public class Test {
@Parameter(value="false")
@Property
private boolean test;
@Component
private Form form;
@Inject
private Request request;
Object onSubmitFromForm() {
test=true;
return null;
}
}
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xml:space="preserve">
<form t:id="form">
${test}
<t:submit/>
</form>
</t:container>
Error is the same:
Failure writing parameter 'test' of component TestPage:test: Literal values
are not updateable.
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1152)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3000(ComponentPageElementImpl.java:72)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$7.invoke(ComponentPageElementImpl.java:1077)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$7.invoke(ComponentPageElementImpl.java:1074)
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-error-Caused-by-java-lang-RuntimeException-Literal-values-are-not-updateable-tp3374330p3374449.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Antwort: Tapestry 5 error "Caused by: java.lang.RuntimeException:
Literal values are not updateable"
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 07 Feb 2011 12:42:12 -0200, Kristian Marinkovic
<kr...@porscheinformatik.at> wrote:
> Pages usually don't have parameters. Components do!
I can't think of any reason for a page to have a parameter: instead, they
have the activation context and query parameters. Pages *don't* have
parameters.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Antwort: Tapestry 5 error "Caused by: java.lang.RuntimeException: Literal
values are not updateable"
Posted by Kristian Marinkovic <kr...@porscheinformatik.at>.
Pages usually don't have parameters. Components do!
g,
kris
Von: m!g <ga...@gmail.com>
An: users@tapestry.apache.org
Datum: 07.02.2011 15:38
Betreff: Tapestry 5 error "Caused by: java.lang.RuntimeException:
Literal values are not updateable"
Hi everyone.
Here is a simple test application:
public class Test {
@Parameter(value="false")
@Property
private boolean test;
@Component
private Form form;
@Inject
private Request request;
Object onSubmitFromForm() {
test=true;
return null;
}
}
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xml:space="preserve">
<head></head>
<body>
<form t:id="form">
${test}
<t:submit/>
</form>
</body>
</html>
When I try to submit form I get error:
org.apache.tapestry5.runtime.ComponentEventException: Failure writing
parameter 'test' of component Test: Literal values
are not updateable. [at classpath:ru/kupivip/pages/Test.tml, line 4]
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.jav
a:1152)
Is it right behaviour of T5? Why I can't update parameter values?
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-5-error-Caused-by-java-lang-RuntimeException-Literal-values-are-not-updateable-tp3374330p3374330.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org