pblm with property in xml file

Sathish David  Kumar N
Sathish David  Kumar N used Ask the Experts™
on
Hi ,

<bean name="/hello.do"
            class="springapps.controller.HelloController">
            <property name="ProduectBean" ref="ProduectBean"></property>
</bean>

which name i want to give in the property name ..
error is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/hello.do' defined in ServletContext resource [/WEB-INF/SpringApps-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'ProduectBean' of bean class [springapps.controller.HelloController]: Bean property 'ProduectBean' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

can anyone tell me ..
what values we want put it in property !!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mick BarryJava Developer
Top Expert 2010

Commented:
whats your controller look like?

My Xml File 
 
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
 
	
 
 
	<bean id="product" class="springapps.service.simpleProductManager">
		<property name="product">
			<list>
				<ref bean="pro1" />
				<ref bean="pro2" />
			</list>
		</property>
	</bean>
 
 
 
	<bean id="pro1" class="springapps.Bean.ProduectBean">
		<property name="product_no" value="00001"></property>
		<property name="product_details" value="s/w product"></property>
		<property name="price" value="200"></property>
	</bean>
 
	<bean id="pro2" class="springapps.Bean.ProduectBean">
		<property name="product_no" value="00002"></property>
		<property name="product_details" value="machanic product"></property>
		<property name="price" value="5000"></property>
	</bean>
 
 
<bean name="/hello.do"
		class="springapps.controller.HelloController">
		<property name="product" ref="product"></property>
	</bean>
 
 
 
 
	<bean id="viewReslover"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="viewClass"
			value="org.springframework.web.servlet.view.JstlView">
		</property>
		<property name="prefix" value="/Jsp/"></property>
		<property name="suffix" value=".jsp"></property>
	</bean>
 
</beans>
 
 
My Controller 
 
public class HelloController implements Controller{
	
	private ProductInter productInter;
	
	public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse res)throws ServletException,IOException
	{
		String now =(new Date()).toString();
		System.out.println("inside controller");
		
		Map myModel=new HashMap();
		myModel.put("now",now);
		myModel.put("pro",this.productInter.getProduct());
	
		return new  ModelAndView("hello","myModel",myModel);
	}
	
	public void SetProductInter(ProductInter productInter) {
        productInter = productInter;
	
}
 
}
 
 
ProductInter is an inter face thats have two methods called getProdect and incresePrice
 
Which name i want to mention in the proerty !! 
y we mention can any one explain in this 

Open in new window

Mick BarryJava Developer
Top Expert 2010

Commented:
>            

looks like name should be: productInter

*but* the ref also appears wrong I don't see any bean name ProduectBean, nor any bean of type ProduectInter that I can see

Your controller also needs a getter method and the name of the setter should be setProductInter
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

this what productBean i set the values of the bean in the xml file
public class ProduectBean  implements Serializable{
	
	private String product_no;
	private String product_details;
	private int price;
	public String getProduct_no() {
		return product_no;
	}
	public void setProduct_no(String product_no) {
		this.product_no = product_no;
	}
	public String getProduct_details() {
		return product_details;
	}
	public void setProduct_details(String product_details) {
		this.product_details = product_details;
	}
	public int getPrice() {
		return price;
	}
	public void setPrice(int price) {
		this.price = price;
	}
 
}
 
 
simpleProductManager is productInter implemented one 
public class simpleProductManager implements ProductInter {
	private List product;
	public int increasePrice(){
		
		return 1;
	}
	public List getProduct()
	{
	
		return product;
	}
	public void setProduct(List product)
	{
		this.product=product;
	}
 
}
 
this what my whole code 
 
can u tell me now !! 

Open in new window

Java Developer
Top Expert 2010
Commented:
looks like it should be:



and you'll need to fix up the getter/setter in controller as I mentioned above

i did a small mistake ...very chily mistake
in controler setter method  i put S as caps ...
thanks man !!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial