As another reply indicated, there is no reason to create a NEW string.
Strings are immutable objects. This means, you can NOT change any part of a
String without a NEW string being created for you automatically. Therefore,
its faster and less resources used to just point a reference variable to the
String returned from the request:
String s = request.getParameter("attribute-name");
The s variable now points to the SAME memory location the request object
uses to point to it.
There is really only one reason I can think of ever using new
String(string-source); That is if you want the NEW string to be modified in
some manner without changing the source string passed in. Even so..because
they are immutable, anytime you do anything on a String, a new String is
created.
> -----Original Message-----
> From: Richard Diaz [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 24, 2001 11:47 AM
> To: [EMAIL PROTECTED]
> Subject: how do I make a new class name = a variable?
>
>
> I'm taking the paramater from the previous page and moving it into the
> sLogingName varible.
>
> Then I try to create an Account Bean using the name of the
> variable... can I
> do this?
>
> <%
> String sLogingName = new String
> (request.getParameter("name"));
> %>
>
> <jsp:useBean id=LogingName scope="session" class="Account"/>
>
> <%
>
> etc...
>
>
>
> thanks!
> Rich
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
> http://explorer.msn.com/intl.asp
>
> ==============================================================
> =============
> To unsubscribe: mailto [EMAIL PROTECTED] with body:
> "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets