[jboss-user] [JBoss Seam] - Re: Seam built-in components not working with Woodstock !!!

b.reeve do-not-reply at jboss.com
Thu Oct 25 17:27:01 EDT 2007


My Environment now is

Seam : 2.0.0.CR2
Woodstock : 4.1
JSF : 1.2
Java : 5.0
Tomcat : 6.0.10

These are the files that I have

Employee.java

  | package test.injection;
  | 
  | import java.io.Serializable;
  | 
  | import org.jboss.seam.ScopeType;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Scope;
  | 
  | @Name("employeeBean")
  | @Scope(ScopeType.SESSION)
  | public class Employee implements Serializable{
  | 	
  | 	private String name;
  | 	
  | 	@In(value="#{departmentSpring}")
  | 	private DepartmentSpringBean departmentSpring;
  | 
  | 	public String getName() {
  | 		return name;
  | 	}
  | 
  | 	public void setName(String name) {
  | 		this.name = name;
  | 	}
  | 	
  | 	public String addEmployee(){
  | 		System.out.println("Name = " + getName());
  | 		return "/success.xhtml";
  | 	}
  | }
  | 

DepartmentSpringBean.java

  | 
  | package test.injection;
  | 
  | 
  | public class DepartmentSpringBean {
  | 	
  | 	private String departmentName;
  | 	
  | 	public DepartmentSpringBean(){		
  | 	}
  | 
  | 	public String getDepartmentName() {
  | 		return departmentName;
  | 	}
  | 
  | 	public void setDepartmentName(String departmentName) {
  | 		this.departmentName = departmentName;
  | 	}
  | 
  | }
  | 

spring.xhtml

  | 
  | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <html xmlns="http://www.w3.org/1999/xhtml"
  | 	  xmlns:ui="http://java.sun.com/jsf/facelets"
  | 	  xmlns:h="http://java.sun.com/jsf/html"
  | 	  xmlns:f="http://java.sun.com/jsf/core">
  | 	  <head></head>
  | 	<body>
  | 		<h:form id="testInjectionForm">
  | 			<h:inputText value="#{departmentSpring.departmentName}" />	
  | 			<h:inputText value="#{employeeBean.name}" />
  | 			<h:commandLink action="#{employeeBean.addEmployee}" value="Add Employee" />			
  | 		</h:form>
  | 		
  | 	</body>
  | </html>
  | 

applicationContext.xml

  | <?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
  | <beans>   
  |     <bean id="departmentSpring" class="test.injection.DepartmentSpringBean" />
  | </beans> 
  | 

On running the app, we can see that the seam bean setter (setName) is never called but Spring bean setter is called and also Spring bean is injected into the Seam component. Any ideas, suggestions would be helpful.

Thanks!


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

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



More information about the jboss-user mailing list