[JBoss Seam] - Re: Navigation outcome from bean
by hamtho2
Mike,
your idea came pretty close to how it works. Thanks for your help.
This is it worked for me now:
<page view-id="/*">
|
| <navigation from-action="#{myBean.commonAction}">
| <redirect view-id="/results.xhtml"/>
| </navigation>
|
| </page>
But do you know if it is possible to redirect to the page, where I came from as well? If I call an action-method and it returns a String with null, I will be redirected to the page I came from automatically. So is there a way to define this through the pages definition as well?
I thought about something like this:
<navigation>
| <rule if="#{myBean.anotherAction}">
| <redirect view-id="/successfull.xhtml"/>
| </rule>
| <rule if="#{not myBean.anotherAction}">
| <redirect view-id="null"/> <!-- Should be the calling page then -->
| </rule>
| </navigation>
|
Is there a way to do something like a switch-case if there might be different-results? In the code-example mentioned above, the anotherAction is probably called everytime I have a new rule.
DO you know anything about this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017675#4017675
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017675
19Â years, 2Â months
[JBoss Seam] - EntityHome persist problem
by dustismo
I am having trouble getting a simple object to persist.
here is the form
| <h:form>
| <h:outputLabel for="name">Group Name:</h:outputLabel>
| <s:decorate>
| <h:inputText id="name" value="#{uGroup.name}" />
| <s:message />
| </s:decorate>
|
|
| <h:selectOneListbox value="#{uGroup.ugrouptype}">
| <s:selectItems value="#{groupTypes}" var="ugrouptype"
| label="#{uGroupType.name}" noSelectionLabel="Please Select..." />
| <ec:convertEntity />
| </h:selectOneListbox>
|
| <h:commandButton value="Save" action="#{groupHome.persist}"
| styleClass="button" />
| </h:form>
|
And here is my entity home.
| @Name("groupHome")
| public class GroupHome extends EntityHome<UGroup> {
|
| @In (required=true)
| private User user;
|
| @Factory("uGroup")
| public UGroup initGroup() {
| return this.getInstance();
| }
|
| protected UGroup createInstance() {
| System.out.println("Creating a ugroup");
| UGroup g = new UGroup();
| g.setUser(user);
| return g;
| }
| }
and my entity looks like
| @Entity
| @Table(name = "UGroup")
| public class UGroup implements java.io.Serializable {
|
| // Fields
|
| private int id;
|
| private User user;
|
| private String name;
|
| private UGroupType ugrouptype;
|
| ....
| }
So when I fill in the fields of the form and press save, it just reloads the page. I can see it creates a new ugroup, but persist is never called. Am I doing something wrong?
thanks
Dustin
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017668#4017668
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017668
19Â years, 2Â months
[JBoss Seam] - Using Seam components remotely...
by bkyrlach
I was recently tasked with separating the service layer of my seam application with the presentation layer. My first thought was to use the ability of EJB's to have a remote interface, and implement my own Variable Resolver which would allow me to look up Seam components from the Java Naming Directory and return them to the presentation layer.
This, however, results in the following exception...
| Caused by: java.lang.IllegalStateException: Attempted to invoke a Seam component outside the context of a web application
| at org.jboss.seam.contexts.Lifecycle.getServletContext(Lifecycle.java:404)
| at org.jboss.seam.contexts.Lifecycle.beginApplication(Lifecycle.java:89)
| at org.jboss.seam.Seam.componentForName(Seam.java:211)
| at org.jboss.seam.intercept.SessionBeanInterceptor.postConstruct(SessionBeanInterceptor.java:101)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| ...
|
Is what I'm attempting to do even possible? Is there another route that more experienced Seam developers would take? Any input would be greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017664#4017664
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017664
19Â years, 2Â months