[jboss-user] [JBoss Seam] - Re: renew the @Factory
srpantano
do-not-reply at jboss.com
Wed Sep 5 14:08:38 EDT 2007
ok, here go!
in my add.xhtml page I put:
| #{messages['Name']}:
| <h:inputText id="name" size="30" value="#{license.name}">
| <s:validate />
| <a4j:support event="onblur" reRender="outMessageLicensee" />
| </h:inputText>
|
| <s:link action="#{licenseHome.persistAndContinue}">
| <h:outputText value="#{messages['Tosavecont']}"/>
| </s:link>
|
the add.page.xml:
| <page no-conversation-view-id="list.xhtml">
|
| <begin-conversation join="true"/>
|
| <navigation from-action="#{licenseHome.persistAndContinue}">
| <end-conversation/>
| <redirect view-id="add.xhtml"/>
| </navigation>
|
| </page>
|
and the class:
| @Name(value = "licenseHome")
| public class LicenseHome extends EntityHome<License> {
|
| @Override
| protected License createInstance() {
| license = new License();
| return license;
| }
|
| @Override
| @Factory(value = "license")
| public License work() {
| return getInstance();
| }
|
| public String persistAndContinue() {
| super.persist();
| Contexts.getSessionContext().remove("license") ;
| setInstance(new License());
|
| return "";
| }
|
| public void setLicenseId(Long id) {
| setId(id);
| }
|
| public Long getLicenseId() {
| return (Long) getId();
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081456#4081456
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081456
More information about the jboss-user
mailing list