dev@jsftemplating.java.net

Re: jsf page

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Wed, 23 Aug 2006 20:04:58 -0700

Hi Ana,

I did a quick test that looked something like this:

...
<!beforeCreate
    inc(number="$int{5}" value=>$page{six});
/>
...
<!command
    println(value="This should be 6: #{six}");
/>
...
<staticText value="This should be 6: #{six} <br />" />

When I clicked on the link, it printed 6 to the log file showing that it
persisted across requests. When it displayed the static text, it also
accurately printed out '6'.

The problem in your case may be that you may be changing the value of
"#{six}" accidentally. Check to see what may be causing it to change
(look at your binding / etc). Try printing values out right after you
set it, and later (like I did above). Also, make sure you have a
current jsftemplating.jar.

Good luck!

Ken




Ana Caballero wrote:
> I'm trying to use the "page" session mapping expression you added
> yesterday. When I try to retrieve the value using the following
> syntax #{userId} it does not the return anything. How do I retrieve
> this value?
>
> Mapping:
> User(ConfigName="server-config", Realm="admin-realm",
> UserId=>$*page*{userId}, GroupList=>$*page*{groupList});
> Retrieval:
> #{userId}
>
> Ken Paulsen wrote:
>>
>>
>> Ana Caballero wrote:
>>>
>>> ------------------------------------------------------------------------
>>>
>>> <sun:page id="page1">
>>> <!beforeCreate
>>> setResourceBundle(key="i18n" bundle="com.sun.enterprise.tools.admingui.resources.Strings")
>>> />
>>> <event>
>>> <!beforeCreate
>>> getUser(ConfigName="server-config", Realm="admin-realm", UserId=>$attribute{userId}, GroupList=>$attribute{groupList});
>>>
>> getPageSessionAttribute(key="groupList", value="$attribute{groupList}");
>>> />
>>> </event>
>>> <sun:html id="html2">
>>> <sun:head id="propertyhead">
>>> </sun:head>
>>> <sun:body id="body3">
>>> <sun:form id="propertyForm">
>>> #include "appServer/serverInstTabs.jsf"
>>> <!-- Page Title -->
>>> <sun:title id="propertyContentPage" title="$resource{i18n.server.AdminPasswordTitle}" >
>>> <sun:helpInline id="pageHelp" type="title" text="$resource{i18n.server.AdminPasswordPageHelp}"/>
>>> <!-- Buttons -->
>>> <!facet pageButtonsTop>
>>> <sun:panelGroup id="topButtons">
>>> <sun:button id="saveButton" text="$resource{i18n.button.Save}" >
>>> <!command
>>> saveUser(
>>> ConfigName="server-config"
>>> Realm="admin-realm"
>>> UserId="#{userId}"
>>> GroupList="#{groupList}"
>>> Password="#{password}"
>>> );
>>> />
>>> </sun:button>
>>> </sun:panelGroup>
>>> </facet>
>>> <!-- PropertySheet .... -->
>>> <sun:propertySheet id="propertySheet">
>>> <!-- Text Field section -->
>>> <sun:propertySheetSection id="propertSectionTextField">
>>> <sun:property id="userIdProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n.server.Userid}">
>>> <sun:staticText id="UserId" text="#{requestScope.userId}"/>
>>> </sun:property>
>>> <sun:property id="groupListProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n.server.GroupList}">
>>> <sun:staticText id="GroupList" text="#{requestScope.groupList}"/>
>>> </sun:property>
>>> <sun:property id="newPasswordProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n.server.NewPassword}">
>>> <sun:textField id="NewPassword" columns="$int{25}" text="#{requestScope.password}" required="#{true}"/>
>>> </sun:property>
>>> <sun:property id="confirmPasswordProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n.server.ConfirmNewPassword}">
>>> <sun:textField id="ConfirmPassword" columns="$int{25}" text="#{requestScope.confirmPassword}" required="#{true}"/>
>>> </sun:property>
>>> "<br /><br />
>>> </sun:propertySheetSection>
>>>
>>> </sun:propertySheet>
>>> </sun:title>
>>> </sun:form>
>>> </sun:body>
>>> </sun:html>
>>> </sun:page>
>>>