Forums Register Login

jsp:useBean

+Pie Number of slices to send: Send
refering to Head Frst JSP Servlets ,,page 416.




What happens when these parts of servlet code Exceute? (person is abstract and eMployee is concrete).

1
Person p = new Employee();
p.setName("evan");
request.setAttribute("person", p);

2
Employee p = new Employee();
p.setName("evan");
request.setAttribute("person", p);

Should the results of both not be the same?
+Pie Number of slices to send: Send
You can find the java servlet that the JSP engine creates on behalf of the JSP and see what happens. If you are using Tomcat, it places these in the folder hierarchy under $CATALINA_HOME/work.
+Pie Number of slices to send: Send
the book specified that the second option wud work..
tested that .. it doesnt.

Bear, why do you want me to look at the servlet code? The query was for the useBean.. anything specific you wanted to point to
+Pie Number of slices to send: Send
 

Originally posted by geetu lalchandani:
the book specified that the second option wud work..
tested that .. it doesnt.



Can you explain what you mean by "it doesn't"?
Was an exception thrown? If so, can you post the stack trace?
What behviour were you expecting?
What actually happened.

I don't see anyting wrong with either example.

Originally posted by geetu lalchandani:

Bear, why do you want me to look at the servlet code? The query was for the useBean.. anything specific you wanted to point to



I think Bear's statement was more general.
Anytime you want to find out how the JSP compiler is dealing with a particular piece of code, the first place you should look is in the generated servlet code.
I wasn't selected to go to mars. This tiny ad got in ahead of me:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 970 times.
Similar Threads
HFSJ doubt :Pg:356
jsp:useBean doubt?
Is this an error in HFSJ ??
HFSJ - Doubt
Clarification On Question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 00:42:30.