About Question enthuware.jwpv6.2.1137 :

Moderator: admin

Post Reply
sebastien
Posts: 12
Joined: Tue Mar 26, 2013 2:38 pm
Contact:

About Question enthuware.jwpv6.2.1137 :

Post by sebastien »

Hello,


for the 3rd answer, the explanation is not correct :
This will not work because the parameter name and the property name do not match.
this will not work because ther is no attribute value or param.

to match parameters's names with property of bean we should have :
<jsp:useBean id='prd' scope='request' class='com.enthu.Product' >
<jsp:setProperty name='prd' property='*'/>
</jsp:useBean>
tell me if i'm wrong

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

Re: About Question enthuware.jwpv6.2.1137 :

Post by admin »

You are wrong. The given explanation is correct. Please see this:
http://docs.oracle.com/cd/A97336_01/bus ... tm#1008181
Or, if the bean property and request parameter have the same name (user), you can simply set the property as follows:

<jsp:setProperty name="pageBean" property="user" />
-Paul.
If you like our products and services, please help us by posting your review here.

targetOCE
Posts: 5
Joined: Fri Jan 02, 2015 7:53 am
Contact:

Re: About Question enthuware.jwpv6.2.1137 :

Post by targetOCE »

Just a side note. Not sure if my understanding is correct here. However, the Product class doesn't comply to the basic requirements to be eligible as a Bean and be used in jsp:useBean tag as it doesn't has a public no-arg constructor, unless in this case, it uses the default constructor?

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

Re: About Question enthuware.jwpv6.2.1137 :

Post by admin »

Yes, it is a valid bean. It is provided with a no-args constructor by the compiler automatically.
If you like our products and services, please help us by posting your review here.

targetOCE
Posts: 5
Joined: Fri Jan 02, 2015 7:53 am
Contact:

Re: About Question enthuware.jwpv6.2.1137 :

Post by targetOCE »

ok, the default constructor. thanks

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests