Hi, 
thanks for the answer:
The BackingBean
@Stateful
  | @Scope(CONVERSATION)
  | @Name("relationshipManager")
  | @LoggedIn
  | public class RelationshipManagerAction implements RelationshipManager {
  |     
  |     @In(create=true)
  |     private EntityManager em;
  | 
  |     @DataModel
  |     List<Relationship> relationships;
  |     
  |     @DataModelSelection
  |     Relationship relationship;
  |      
  |     @In(create=true)
  |     private transient FacesMessages facesMessages;
  |        
  |     
  |     @In @Out(required=false)
  |     //The currently logged in user
  |     private Person person;
  | 
  |     @In
  |     private Group group;
  |     
  |     @SuppressWarnings("unchecked")
  |     @Factory
  |     public void find() {
  |             relationships = new LinkedList();
  |             relationships.addAll(em.createQuery("from Group where owner = 
:user")
  |                                     .setParameter("user",person)
  |                                     .getResultList());
  |             relationships.addAll(em.createQuery("select from 
BinaryRelationship where from = :user")
  |                                     .setParameter("user",person)
  |                                     .getResultList());
  |     }
  | 
  |     public void addGroup() {
  |             group.setOwner(person);
  |             person.getRelationships().add(group);
  |             relationships.add(group);
  |             facesMessages.add("Successfully registered as 
#{newGroup.name}");
  |     }
the view:

        
  | <h:form>
  |     <fieldset>
  |     <s:validateAll>
  |             <h1>Group</h1>
  |             <div class="entry">
  |                             <div class="label"><h:outputLabel 
for="groupName">Name:</h:outputLabel></div>
  |                             <div class="input">
  |                                <h:inputText id="groupName" 
value="#{group.name}" required="true"/>
  |                                <br/><span class="errors"><h:message 
for="groupName" /></span>
  |                             </div>
  |             </div>
  |     </s:validateAll>
  |             <div class="entry errors"><h:messages globalOnly="true"/></div>
  |             <div class="entry">
  |                     <div class="label"><f:verbatim>&#160;</f:verbatim></div>
  |                     <div class="input">
  |                             <h:commandButton value="Save" 
action="#{relationshipManager.addGroup}" class="button"/>&#160;
  |                     </div>
  |             </div>          
  |     </fieldset>
  |     </h:form>

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3954518#3954518

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3954518

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to