and #2: you need not save the value in request if you can retrieve it using usebean..
As you have observed, if you set it in the JSP, it is avialable..this is because you save the value in one object(bean) and retrieve from the same..
I suggest to try using the same bean name(cs) as instantiated in your action class while getting the values... I am sure about your your mistake, but I leave this experiment to you..let's see the result
I have done same thing what you have suggested in action class but not able to get bean values on JSP page. I tried this in JSP page: <jsp:useBean id="one" beanName="test.BeanClass" type="test.BeanClass" scope="request"/> <jsp:getProperty name="one" property="name" />
Your 2nd approach is correct, but there's one small mistake..you have not mentioned which property of the bean 'one' do you want to display..
just add property = "anyProperty" to your <bean:write ..../> tag , it will work.
I have just tried it with your code.
You are getting this garbage value because you're trying to display the onject's value...which is always random untill you override the toString() method in its class...
i am not sure why 'null' is printed before your package.Classname; I suspect it is because you have some null value in your code.
I got only package.class@garbage when I tried your jsp code in my Application [ August 18, 2008: Message edited by: Aniruddh Joshi ]
Joined: Dec 27, 2007
I tried as per your advice and what I did is <jsp:useBean id="one" beanName="test.BeanClass" type="test.BeanClass" scope="session"/> <bean:write name="one" property="name"/>
output is "null" Not the desired output..
I have one more requirement My need is to set a list object in an request.setAttribute() on a JSP page and retrieve it on Action class. Even this is not working Is it that we cannot set an object in request scope in an JSP page.