How to pass parameters to a bean constructor. I can create a bean constructor with parameters. but bow do I pass values to the bean from a JSP page on creation..Is there any way to do this..

Derek Illchuk

You can't actually pass parameters to the constructor, but you can achieve something pretty much identical while having a constructor with no parameters:

<jsp:useBean class="Bean" id="bean" scope="session">
   <set a property here>
   <% bean.callAMethodHere(); %>
   <set another property here>
</jsp:useBean>

Just place whatever you like between the <jsp:..> and </jsp:..>
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact