Bookmark Topic Watch Topic
  • New Topic

using useBean Tag dynamically

 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi Peter/all ranch members
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
[ December 20, 2004: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not repeat the same question more than once. Please cotninue any discussion here.
[ December 20, 2004: Message edited by: Bear Bibeault ]
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!