Why can't you call the init() method from inside the execute() method (at the 
beginning of it )?
 
Anna

________________________________

From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Fri 17/09/2004 2:06 PM
To: [EMAIL PROTECTED]
Subject: No Way to Put the init() Method Inside the ActionForward Execute( ... ) Method



We cannot put a method inside another method.

When using the Struts, we start with:

public final class MyClass extends Action
{
    public ActionForward execute( ActionMapping
mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response )
        throws java.lang.Exception
    {

        .......
        .......

    }
}

I have a void init( ...) { ... } method shown below.
Of course, I cannot put this init( ... ) inside the
ActionForward Execute( ... ) { ... }

What am I supposed to do?  Do I put this void init(
... ) { ... } method before the ActionForward Execute(
... ) { ... } begins?

Code:
=================================================
       String smtpServer;
 
       public void init(ServletConfig config) throws
ServletException
       {
          super.init(config);
          smtpServer =
config.getInitParameter("smtpServer");
       }
=================================================


       
               
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to