RE: instance names problem will pay $2 for solution

2003-04-02 Thread Barney Hamish
May I suggest you have a look at the Java Reflection package... java.lang.reflect also the java.lang.Class class, class.forName() will be of interest to you. -Original Message- From: Michael Ni [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2003 12:24 PM To: [EMAIL PROTECTED]

RE: instance names problem will pay $2 for solution

2003-04-02 Thread Michael Mattox
When you create the instances (blue, red, etc.) store them in a hashtable. SomeObject blue = new SomeObject(); ht.put(blue, blue); then: public void callUse(String color) { SomeObject o = ht.get(color); o.use(); } If your instances aren't of the same type, then define an Interface (for

Re: instance names problem will pay $2 for solution

2003-04-02 Thread Serges N. Zubkoff
Hello Michael, Wednesday, April 2, 2003, 2:24:21 PM, you wrote: MN i will pay $2 usd if you can solve my problem. i'll send check by mail or MN paypal. MN my problem is i have a String variable s which stores the name of the MN instance i want to create. how do i convert that variable to

RE: instance names problem will pay $2 for solution

2003-04-02 Thread Donie Kelly
This is a free service :) Don't think you can buy your answers here :) Donie -Original Message- From: Michael Mattox [mailto:[EMAIL PROTECTED] Sent: 02 April 2003 11:31 To: Tomcat Users List Subject: RE: instance names problem will pay $2 for solution When you create the instances (blue

Re: instance names problem will pay $2 for solution

2003-04-02 Thread Stephen Peterson
perhaps you might benefit from exploring the 'Big Moose Saloon' at http://www.javaranch.com. I've found it to be a great place for folks who have java language questions. I think it would be beneficial all around if this list could be kept to tomcat user problems :-). Stephen Peterson ---

Re: instance names problem will pay $2 for solution

2003-04-02 Thread Ramsay Domloge
Michael, I think what you need is some reflection to sort out your problem: String className = red; Class c = Class.forName(className); Object o = c.newInstance(); Red red = (Red)o; Does this help? Ramsay Michael Ni wrote: i will pay $2 usd if you can solve my problem. i'll

Re: instance names problem will pay $2 for solution

2003-04-02 Thread Hans Wichman
hi, i think you need to use the java.lang.reflect api for this kind of stuff. greetz Hans At 02:24 AM 4/2/2003 -0800, you wrote: i will pay $2 usd if you can solve my problem. i'll send check by mail or paypal. my problem is i have a String variable s which stores the name of the instance i

Re: instance names problem will pay $2 for solution

2003-04-02 Thread Michael Ni
jsp:useBean id=temp scope=request class=beangame.GameInstance / jsp:setProperty name=temp property=* / % String tempname = temp.getInstance_name(); beangame.Earthquake counter1 = (beangame.Earthquake)getServletContext().getAttribute(tempname); if (counter1 == null) { out.println(is

RE: instance names problem will pay $2 for solution

2003-04-02 Thread Barney Hamish
problem will pay $2 for solution jsp:useBean id=temp scope=request class=beangame.GameInstance / jsp:setProperty name=temp property=* / % String tempname = temp.getInstance_name(); beangame.Earthquake counter1 = (beangame.Earthquake)getServletContext().getAttribute

RE: instance names problem will pay $2 for solution

2003-04-02 Thread Michael Ni
the way i implemented From: Barney Hamish [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: RE: instance names problem will pay $2 for solution Date: Wed, 2 Apr 2003 13:24:27 +0200 Is there are reason you can't just use