I would think that it was because you (he?) were trying to issue a
getBytes() on bias when you were probably supposed to do it on New_val

String New_val = request.getParameter("packet");
java.io.ByteArrayInputStream bais = new
java.io.ByteArrayInputStream(New_val.getBytes());

You are converting the string (request.getParameter("packet")) into an array
of bytes. Correct?

----- Original Message -----
From: Paul Beer <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, January 29, 2000 3:54 AM
Subject: Re: Passing xml into a JSP page


> I am getting a variable initialization error when I try to do this .... I
> dont think I understood your code suggestion well enough... could someone
> please look at this code and tell me why I get the error posted below ?
>
> <%
> String New_val = request.getParameter("packet");
> java.io.ByteArrayInputStream bais = new
> java.io.ByteArrayInputStream(bais.getBytes());
> org.xml.sax.InputSource is = new org.xml.sax.InputSource(bais);
> XSLTInputSource inputXML = new XSLTInputSource(New_val);
> XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
> processor.process(new XSLTInputSource(inputXML),new
> XSLTInputSource("wddx.xsl"),new XSLTResultTarget(out));
> %>
>
>
> 500 Internal Server Error
> Java Server Page Translation Error
> Error during compilation :
>
D:\Java\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_xml\_convert.java:8
> 2: Variable bais may not have been initialized.
>                 java.io.ByteArrayInputStream bais = new
> java.io.ByteArrayInputStream(bais.getBytes());
>
>
> Passing a string to new InputSource() expects
> the string to represent an URL.
>
> What you want to do is:
>
> <%
>
>  String New_val = request.getParameter("packet");
>  ByteArrayInputStream bais = new ByteArrayInputStream(bais.getBytes());
>  InputSource is = new InputSource(bais);
>    :
>
>
> %>
>
> This will feed the XML document in a string
> as an InputStream

===========================================================================
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

Reply via email to