About Question enthuware.jwpv6.2.779 :

Moderator: admin

Post Reply
gupta.v21
Posts: 17
Joined: Wed Jan 07, 2015 11:33 pm
Contact:

About Question enthuware.jwpv6.2.779 :

Post by gupta.v21 »

Hi,

Since setter will be called setMystring("hello") and there is no such method caller will see following exception

org.apache.jasper.JasperException: Cannot find any information on property 'mystring'

please crosscheck once and advice.

Regards,
Vivek Gupta

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.779 :

Post by admin »

The answer and the explanation are correct. Did you try it out?
If you like our products and services, please help us by posting your review here.

gupta.v21
Posts: 17
Joined: Wed Jan 07, 2015 11:33 pm
Contact:

Re: About Question enthuware.jwpv6.2.779 :

Post by gupta.v21 »

Ok I read the explanation but still I do not agree with the point I have verified by making similar code.

<jsp:useBean id="mystring" class="java.lang.String" />
I agree this will create empty string.

<jsp:setProperty name="mystring" property="*" />
now when you pass following parameter mystring=hello to above JSP wont it call
mstring.setMystring("hello") . Since it does not exist and fail.

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.779 :

Post by admin »

Again, did you try running the code? It works fine.
It won't call setMystring("hello") because String doesn't have mystring property. When you use property="*", it sets only those properties that exist.
If you like our products and services, please help us by posting your review here.

gupta.v21
Posts: 17
Joined: Wed Jan 07, 2015 11:33 pm
Contact:

Re: About Question enthuware.jwpv6.2.779 :

Post by gupta.v21 »

oh ok Thanks !!!! :-)

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests