This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes setProperty doubt! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "setProperty doubt!" Watch "setProperty doubt!" New topic

setProperty doubt!

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9398


Om page 362 of the HFSJ book, the line says <jsp:setProperty name="person" property="empID" value="<%=request.getParameter("empID")%>" Why does this fail to compile when the empID is of type int?? I'm not understanding?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
VijayKumar Sivagnanam

Joined: Dec 25, 2006
Posts: 26
the automatic type conversion will not happen for jsp expression while el expression will do the type conversion. thatz why it will give a compilation error.

SCJP 1.2 <br />SCWCD (94%)<br />SCBCD (preparing)
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9398


How does the EL does the implicit type conversion?? Is there any rule or is it according to the spec?
Sanjeev Singh
Ranch Hand

Joined: Nov 01, 2006
Posts: 381
That we can find somewhere in Specification for JSP?
Jothi do you have the link for the specification of JSP and servlets?

~Sanjeev Singh<br />SCJP 1.5
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9398


That is a good thing to look at the specs. you can get it here.
[ January 11, 2007: Message edited by: Jothi Shankar Kumar Sankararaj ]
Manikandan Jayaraman
Ranch Hand

Joined: Sep 15, 2004
Posts: 230

Just remember this. Auto-Type_Conversion WILL NOT happen in jsp:setProperty, if we use scripting in 'value' attribute.

To get rid of this problem, use EL or string literal.

Regards,<br />Mani<br />SCJP 1.4 (95%)<br />SCWCD 1.4 (94%)
Consider Paul's rocket mass heater.
subject: setProperty doubt!