Stanley Walker wrote:1.I didnt know that import was unneccessary for beans. Thanks for letting me know.
2. I wanted to use EL but not before i get a hang of beans.
3. This is kind of important. May be i am getting the concept and usage of beans wrong.
My firstView.jsp will have viewInformation.jsp as its target. I was under the impression that the viewBean.Person class fields will be instantiated with the values from the firstView.jsp(hence the setProperty) and then will be used to show it in viewInformation.jsp.
Yes -- assumes a forward (not redirect) from the servlet to the JSP. You might want to read this article.
Stanley Walker wrote:So i will submit my page to a servlet. Instantiate the Person bean with fields entered in the firstView.jsp using request.getParameter. Then i will place the person object in request. in the second jsp, the values will be populated hence.
Already did. See above.
Also, please do tell me where i should place the class file for the bean.
That sounds odd. What do you mean by this. A JSP shouldn't be sending a bean to a servlet, it should be the other way around.
Stanley Walker wrote:I have one final question. i have a jsp, secondView.jsp which sets properties of the bean and then submits it to beanServlet.
Most likely because they are operating in different request scopes.
if a bean is set in request scope , then why do i get null when i do request,getAttribute("beanId") in the servlet??
setProperty is rather antiquated. Firstly, it was more important in the days when people used JSPs for processing. Secondly, it's been side-lined by the JSTL's <c:set>.
what i do not understand is why would you have a setProperty tag.
That's a remnant from the old Model 1 days. Today, most beans should be instantiated and filled in by the page controller. I still instantiate beans in some JSPs -- but not for data processing. They're usually what I call "display support beans" whose job is merely to help the JSP manage its display.
my understanding was you have a setProperty tag was present so that the bean can be instantiated from the jsp itself ( kind of like jsf and backing bean).
Again, that's Model 1. Deprecated. Old-fashioned. Discredited.
my understanding(for the second approach was)
I wouldn't say "wrong", I'd say "heading down the garden path".
Apparently i am wrong in my above assessment.
I cannot remember the last time I used setProperty. It's good to understand what it does in case you come across a usage. But it's not a big player anymore in the face of <c:set> and Model 2.
Please help. I am almost sure i got beans figured out except for the setProperty tag.
Stanley Walker wrote:Thanks Bear, for volunteering your time.
Tough love works for me!
Of course not! That's what we're here for!
I'll be trying to pick up EL and JSTLs now. Dont be bored if i post some more of my questions.