tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David M. Holmes" <david_m_hol...@yahoo.com>
Subject Bean instantiation question
Date Thu, 10 Aug 2000 19:48:05 GMT
I have some beans that implement a base type. I would like to instantiate the correct type
of bean
based on the request. The following will not work, "Variable 'ws' is already defined in this
method." Is there a way to do this?

<Dave/>

rateworksheets.RateWorksheet ws;
	
switch ( Integer.parseInt(request.getParameter("rate")) ) {
case 0:
%>
<jsp:useBean id="ws" class="rateworksheets.LGS" scope="request"/>
<%
application.getRequestDispatcher("/rateworksheets/reports/LGS.jsp").forward(request, response);
break;
case 1:
%>
<jsp:useBean id="ws" class="rateworksheets.MGS" scope="request"/>
<%
application.getRequestDispatcher("/rateworksheets/reports/MGS.jsp").forward(request, response);
break;
}


__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

Mime
View raw message