*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes USEBEAN tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "USEBEAN tag" Watch "USEBEAN tag" New topic
Author

USEBEAN tag

kundan varma
Ranch Hand

Joined: Mar 08, 2004
Posts: 322
Hi All
I want to assign dynamically class or Type in the UseBean tag.
Is it possible?

My code:

code 1 ---- is

<% long SubDeptCode = (Long.parseLong(request.getParameter("subDeptFk")));


if(SubDeptCode==1) {
%>
<jsp:useBean id="testForm" class="cal.xxxForm" scope="request"/>
<jsp:setProperty name="testForm" property="*"/>

<% } else if(SubDeptCode==2) {

%>
<jsp:useBean id="testForm" class="cal.yyyForm" scope="request"/>
<jsp:setProperty name="testForm" property="*"/>

or else if i can do like this
code 2:----
<jsp:useBean id="testForm" class=<%=varClassNmae%> scope="request"/>
<jsp:setProperty name="testForm" property="*"/>

Is This possible or if any alternate solution to dynamically assigning class type in JSP usebean tag.

Thanks
kundan


SCJP1.4,SCBCD,SCEA,CNA
Failures are practice shoots for success.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: USEBEAN tag
 
Similar Threads
HFSJ 2nd edition page 420 - Be the Container Answers
using useBean Tag dynamically
useBean doubt
how to re set a existing bean
Dynamically assigning class types in useBean tag