tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David M. Holmes" <>
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?


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);
case 1:
<jsp:useBean id="ws" class="rateworksheets.MGS" scope="request"/>
application.getRequestDispatcher("/rateworksheets/reports/MGS.jsp").forward(request, response);

Do You Yahoo!?
Kick off your party with Yahoo! Invites.

View raw message