Jeff,
The error message itself occurs because you forgot the parens at the end of
the getBytes method call.
The following should do away with that message.
<% string s1, s2;
s1=request.getParameter("someString");
s2 = s1.getBytes();
%>
You do, however, probably want to use the primitive byte to receive the
output of the getBytes() method.
(In fact, the method returns an array of bytes.) The following should get
you an array of bytes representing
the characters in the string "someString".
<% string s;
byte b[];
s = request.getParameter("someString");
b = s.getBytes();
%>
-AMT
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Jeff Brown
> Sent: Wednesday, December 22, 1999 10:06 AM
> To: [EMAIL PROTECTED]
> Subject: Casting strings returned by input elements...
>
>
> I'm working with some COM objects that only accept bytes.
> However, the data
> I'm trying to send is in string form (sent by form input
> elements). In ASP
> this was not a problem since VBScript auto-casts everything. Java's a bit
> pickier and my knowledge of Java is shaky at best. I've tried:
>
> <% string s1, s2;
> s1=request.getParameter("someString");
> s2 = s1.getBytes;
> %>
>
> This returns the error: "Attempt to reference method getBytes in class
> java.lang.string as an instance variable."
>
> There's gotta be an easier way to do this :)
>
> ____________________
> Jeffrey W. Brown
> Test Engineer
> Citr!x Systems, Inc.
> PHONE: (954) 267-2846
> EMAIL: jeff.brown @ citrix.com
> ____________________
> The information contained in this message is confidential and may be
> legally privileged. It is intended solely for the addressee. Access to
> this message by anyone else is unauthorized. If you are not the intended
> recipient, any disclosure, copying or distribution of this message, or
> any action or omission taken by you in reliance on it, is prohibited and
> may be unlawful. Please immediately contact the sender if you have
> received this message in error.
>
>
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html