[jboss-user] [JBoss Seam] - Re: Destroying Context Variable
jamesjmp
do-not-reply at jboss.com
Fri Oct 26 10:15:18 EDT 2007
hi, I´ve found a problem with what I´ve described before.
My RstReport has some attributes with are other objects. With them the edit doesn´t work.
This is the object:
| @Entity
| @Table(name = "RST_REPORT", catalog = "prisk")
| public class RstReport implements java.io.Serializable {
|
| private int code;
| //simple attribute
| private String shortDescription;
| //object attribute
| private CfgCurrency cfgCurrency;
| //more atributes...
|
| //getters, setter and constructors...
|
This si some of the RstReportEdit.xhtml code:
| <!-- simple attribute, works ok -->
|
| <s:decorate id="shortDescriptionDecoration" template="layout/edit.xhtml">
| <ui:define name="label">#{messages['RstReport.shortDescription']}</ui:define>
| <h:inputText id="shortDescription"
| size="100"
| required="true"
| maxlength="125"
| value="#{rstReportHome.instance.shortDescription}">
| <a:support event="onblur" reRender="shortDescriptionDecoration" bypassUpdates="true" />
| </h:inputText>
| </s:decorate>
|
|
| <!-- object attribute, doesn´t work ok -->
|
| <s:decorate id="currencyIsoDecoration" template="layout/edit.xhtml">
| <ui:define name="label">#{messages['CfgCurrency']}</ui:define>
| <h:inputText id="currencyIso"
| size="20"
| maxlength="50"
| required="true"
| disabled="true"
| value="#{rstReportHome.instance.cfgCurrency.currencyIso}">
| <a:support bypassUpdates="true" event="onblur" reRender="currencyIsoDecoration"/>
| </h:inputText>
| <s:button value="#{messages['Select']} #{messages['CfgCurrency']}"
| view="/CfgCurrencyList.xhtml">
| <f:param name="from" value="RstReportEdit"/>
| </s:button>
| </s:decorate>
|
|
|
And this is RstReportEdit.page.xml full code:
| <!DOCTYPE page PUBLIC
| "-//JBoss/Seam Pages Configuration DTD 1.2//EN"
| "http://jboss.com/products/seam/pages-1.2.dtd">
|
| <page no-conversation-view-id="/RstReportList.xhtml"
| login-required="true">
|
| <begin-conversation join="true" flush-mode="manual"/>
|
| <param name="action" value="#{rstReportHome.action}"/>
| <action execute="#{rstReportHome.wire}"/>
|
| <param name="rstReportFrom"/>
| <param name="rstReportCode" value="#{rstReportHome.rstReportCode}"/>
|
| <param name="cfgBenchmarkFrom"/>
| <param name="cfgBenchmarkBenchmarkCode" value="#{cfgBenchmarkHome.cfgBenchmarkBenchmarkCode}"/>
| <param name="cfgBenchmarkTypeFrom"/>
| <param name="cfgBenchmarkTypeBenchmarkTypeCode" value="#{cfgBenchmarkTypeHome.cfgBenchmarkTypeBenchmarkTypeCode}"/>
|
|
| <param name="firmFrom"/>
| <param name="firmFirmCode" value="#{firmHome.firmFirmCode}"/>
| <param name="cfgCurrencyFrom"/>
| <param name="cfgCurrencyCurrencyCode" value="#{cfgCurrencyHome.cfgCurrencyCurrencyCode}"/>
|
|
| <param name="rstMethodologyFrom"/>
| <param name="rstMethodologyCode" value="#{rstMethodologyHome.rstMethodologyCode}"/>
|
| <param name="fundFrom"/>
| <param name="fundFundCode" value="#{fundHome.fundFundCode}"/>
|
| <param name="rstReportTypeFrom"/>
| <param name="rstReportTypeCode" value="#{rstReportTypeHome.rstReportTypeCode}"/>
|
| <param name="rstStatusFrom"/>
| <param name="rstStatusCode" value="#{rstStatusHome.rstStatusCode}"/>
|
| <navigation from-action="#{rstReportHome.persist}">
| <end-conversation/>
| <redirect view-id="/RstReportL.xhtml"/>
| </navigation>
|
| <navigation from-action="#{rstReportHome.update}">
| <end-conversation/>
| <redirect view-id="/RstReport.xhtml"/>
| </navigation>
|
| </page>
|
For the object-attribute values I use the seam-gened list of them. For instance for the CfgCurrency POJO, CfgCurrencyList.xhtml. When I go there and select one, when returning again to RstReportEdit.xhtml all the fields are populated with that of the last RstReport.xhtml displayed in RstReport.xhtml
I guess the reason is that in the params the code has been automatically added rstReportCode=1131
http://localhost:8080/RISK_ONLINE/RstReportEdit.seam?cfgCurrencyCurrencyCode=4&action=&rstReportCode=1131&cid=13&clr=true
rstReportCode is the id, in the RstReporthome it is:
| public void setRstReportCode(Integer id) {
| setId(id);
| }
|
| public Integer getRstReportCode() {
| return (Integer) getId();
| }
|
What would be the best way to avoid this?
thanks in advance!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099319#4099319
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4099319
More information about the jboss-user
mailing list