Thanks Bear....yes...i know in actual practise i won't use Java code in jsp...but right now i am learning the basics....so that is why you can see a good amount of java code in my jsp.
... and yes...there was no default constructor in User object. I declared one and used "class" attribute and it worked! ...MUCHAS GRACIAS ! .... but then how does it work now ? ... i mean how does "type" and "class" attribute work and they differ from each other ?
One observation i made was..... i placed a SOP in the default constructor of the User object....and when there was no session created and when i accessed the page, the SOP was printed in the console, but when session was created and when i accessed the page, it did not print any thing in SOP! .... i guess i am coming back unknowingly to my question....."how does <jsp:useBean> work ?"
It's all spelled out in the JSP Specification. That's where you need to go for the details.
In short, type expects the scoped variable to already exist, while class will create the bean if it doesn't. That's why there needs to be a default constructor. There are more nuances that you can read about.
Joined: Aug 25, 2005
Thanks...ok i will go through those again.....but they don't have examples to explain the behavior ...that is why i had to ask here.... .... can you please suggest me some good JSP Book to start with ??