Hi,

  I was trying to connect to a servlet through an applet.I created an html
page with two frame.At the top frame the applet was embedded and in the bottom
frame the servlet was server side included.I used the GET method to
communicate to the servlet.So in the init method of the applet I added the
following code to get a connection to the servlet.And pass information through
the URL.
////////////////////////////////////////////////////////

 String
servletLocation="http://172.100.8.213:8080/servlet/serv.HelloWorldServlet1?LastName='Jones'";
try{
 testServlet = new URL( servletLocation );
}
catch (MalformedURLException e){
}

try{
servletConnection = testServlet.openConnection(); 
}
catch(IOException e){
}



///////////////////////////////////////////////////////////////////////
The code of the servlet is shown below,where I tried to get the information
passed from the applet

public class HelloWorldServlet1 extends HttpServlet {

   
    public void doGet (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    {
        PrintWriter             out;

        res.setContentType("text/html");
        out = res.getWriter();
  String name=req.getParameter("LastName");
  
        out.println("<html>");
        out.println("<head><title>Hello World</title></head>");
        out.println("<body>");
        out.println("<h1>LastName="+name+"</h1>");
        out.println("</body></html>");
    }
}
/////////////////////////////////////////////

The output is showing a null value for the name.Is it wrong to send the
information to the servlet from the init method.Can you suggest some other
method or simple code for the communication.

regards,
Rakesh.


____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to