[jboss-user] [JBoss Seam] - Trouble calling Stateless Bean

sjmenden do-not-reply at jboss.com
Tue Aug 15 14:44:27 EDT 2006


I have a page to show the groups in my system.   There are a series of links to allow the user to modify the group.  I am having trouble implementing the first of those links where the user clicks to edit the group itself.


  | <h:commandLink value="Edit Information" action="#{editGroup.update}">
  |    <f:param name="groupId" value="#{groupUsers.group.groupId}"/>
  | </h:commandLink>
  | 


  | @Name("editGroup")
  | @Stateless
  | public class EditGroup implements IEditGroup { 
  | 	
  | 	@RequestParameter
  | 	private Long groupId;
  | 	
  | 	@Logger
  | 	private Log log;
  | 	
  | 	private EntityManager em;
  | 
  | 	@In(create=false) @Out
  | 	Group group;
  | 	
  | 	public String update() {
  | 		//Verify groupId is set
  | 		if(groupId == null || groupId.equals("")){return null;}
  | 	
  | 		Map<String, Object> parameters = new HashMap<String, Object>();
  | 	
  | 		log.info("\n\nFinding Group with groupId: " + groupId + "\n\n");
  | 
  | 		Query query = em.createQuery("from Group group where group.groupId = :groupId");
  | 		parameters.put("groupId", groupId);
  | 		
  | 		for (Entry <String, Object> param : parameters.entrySet()) {
  | 				query.setParameter( param.getKey(), param.getValue() );
  | 		}
  | 		log.info("Querying for group");
  | 		Group attachedGroup = (Group) query.getSingleResult();
  | 		log.info("Found group object: " + group);
  | 		
  | 		if(group == null) {
  | 			group = attachedGroup;	
  | 		} else {
  | 			log.info("group was not null, attempting to update the attached group");
  | 			attachedGroup.setName(group.getName());
  | 			attachedGroup.setAddress(group.getAddress());
  | 			attachedGroup.setAddress2(group.getAddress2());
  | 			...
  |                         ...
  |                         ...
  | 		}
  | 		
  | 		return "editGroup";
  | 	}
  | }
  | 
  | 



The error when I click on the link is as follows:

  | WARNING: Component _id13 just got an automatic id, because there was no id assigned yet. If this component was created dynamically (i.e. not by a JSP tag) you should assign it an explicit static id or assign it the id you get from the createUniqueId from the current UIViewRoot component right after creation!
  | 14:14:09,411 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
  | javax.faces.FacesException: Error calling action method of component with id _id1
  |         at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
  |         at javax.faces.component.UICommand.broadcast(UICommand.java:106)
  |         at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
  |         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
  |         at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
  |         at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
  |         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
  | 


I'm probably doing my @Stateless bean completely against convention, but all I want is to load the group on demand and update on demand, I dont' think it needs to be statefull.

I thought I could just create a @Stateless bean and invoke it from anywhere, but I must be missing something, help is needed with that *something*.

Thanks.

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

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



More information about the jboss-user mailing list