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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to