Anupama,
see if you can use the AppletContext's showDocument method which takes the URL
as the first argument and the "target" where you want your page to be printed
as the second argument.
for ex:
URL url = new URL("http://machine:port/servlet/servletname");
AppletContext appCon = getAppletContext(); // get the applet context
appCon.showDocument(url,"_blank"); // print the page in a new browser window
but the problem is how to get the output stream.does anyone know the solution?
Sundari
ANUPAMA PONNAPALLI wrote:
> Hi,
> My applet needs to show a report for which it gets from the
> database, and also uses some data entered by the user in the applets
> text boxes. Since there are about 20 parameters needed, I am sending
> the data to the servlet as a vector (using an object output stream). My
> intention is to display the resulting report in a new browser window.
>
> I find that the servlet is not invoked until I call the getInputStream
> method of the urlconnection. Calling setDoInput(false) doesn't work. I
> have tried calling the connect method before getting the object ouput
> stream, but it raises an exception - Connection already establish, cannot
> reset. I have enclosed the code. I have impelemented the doPost(),
> doGet() and service() methods in the servlet.
>
> String u = new String("http://" + machine + ":" + port + "/servlet/");
>
> public void review(String servlet, Vector send) {
> try
> {
> URL ptl = new URL(u + servlet);
> URLConnection c = (URLConnection) ptl.openConnection();
>
> c.setDoOutput(true);
> c.setDoInput(false);
>
> ObjectOutputStream out = new
> ObjectOutputStream(c.getOutputStream());
> out.writeObject(send);
> out.close();
>
> /* ObjectInputStream in = new
> ObjectInputStream(c.getInputStream());
> in.close();
> DOESN'T WORK WHEN THIS IS COMMENTED
> */
>
> }catch (Exception e) {
> System.out.println("Exception: " + e);
> }
> }
>
> If I uncomment the code, I get a malformed url exception in the applet
> when the servlet executes the redirect code :
> resp.sendRedirect("javascript:JSfuncName(" + arg + ")");
>
> Any mistakes detected in the code, or any other solution to the
> problem will be appreciated...
>
> Thanks in advance.
>
> Anupama
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html