Page 1 of 1

About Question enthuware.jwpv6.2.779 :

Posted: Mon Apr 11, 2016 11:09 am
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

Re: About Question enthuware.jwpv6.2.779 :

Posted: Mon Apr 11, 2016 11:24 am
by admin
The answer and the explanation are correct. Did you try it out?

Re: About Question enthuware.jwpv6.2.779 :

Posted: Thu Apr 14, 2016 10:31 am
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.

Re: About Question enthuware.jwpv6.2.779 :

Posted: Thu Apr 14, 2016 9:39 pm
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.

Re: About Question enthuware.jwpv6.2.779 :

Posted: Fri Apr 15, 2016 11:56 am
by gupta.v21
oh ok Thanks !!!! :-)