On Fri, 11 Feb 2011 10:14:35 -0200, m!g <gagau...@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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org