File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
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: 10003


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: 10003


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: 10003


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%)
I agree. Here's the link:
subject: setProperty doubt!
It's not a secret anymore!