Java Beans

M

Michela Vicaretti

Hi,

how can I pass on a parameter to Java Bean constructor when I use it in
a jsp page using "jsp:usebean"

thanks
 
W

Wendy Smoak

Michela Vicaretti said:
how can I pass on a parameter to Java Bean constructor when I use it in
a jsp page using "jsp:usebean"

http://www.google.com/search?q=jsp+usebean+constructor+parameter
led to
http://www.jguru.com/faq/view.jsp?EID=10970

One of the requirements of a JavaBean is that it have a no-args constructor.
You can use <jsp:setProperty> to set property values in the bean.

Better... instantiate and configure the bean in Servlet code, place it in
the appropriate scope and forward to a JSP that just uses the
already-existing bean.

Otherwise, you'll have to resort to a scriptlet to instantiate the bean.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top