----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Try this signature for init():

public void init(ServletConfig config) throws ServletException
{
        //don't forget this call to the super class
        super.init(config);

        // initialize your y String here
}

You used to always have to override this method and explicitly call the 
super.init(config), but a newer version of the Servlet API has made it so 
you can just overide your init() wih the simple signtaure, and the version 
above will call it for you.   Are you using an older version of HttpServlet?

HTH,

Peter
--On Wednesday, December 13, 2000 12:30:58 AM -0500 Ilya 
<[EMAIL PROTECTED]> wrote:

> ----------------------------------------------------------------
> BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> WHEN YOU POST, include all relevant version numbers, log files,
> and configuration files.  Don't make us guess your problem!!!
> ----------------------------------------------------------------
>
> I have the following servlet , if i dont initialize y in doGet or when I
> declare it null is printed out. why doesnt Init() run? log says its ran:
> [13/12/2000 00:25:18:292 EST] yp: init
> any ideas?
>
> public class yp extends HttpServlet
> {
>  private String y;
>
>  public void init()
>  {
>    y="tttttttt";
>  }
>   public void doGet(HttpServletRequest request, HttpServletResponse res)
> throws IOException, ServletException
>     {
>   PrintWriter pw = res.getWriter();
>   pw.println(y);
>     }
> }
>
>
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Search Archives:
> <http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
> Problems?:           [EMAIL PROTECTED]




--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search Archives: 
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to