Hello Hiren,

When the user clicks the submit button the form will get posted to the Servlet where 
you have the registerUser method. The action attribute of the form should point to the 
servlet. In the servlet you have either service method or doPost method which in turn 
will call your registerUser method.

Bhushan

-----Original Message-----
From: Hiren Dossani [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 20, 2002 6:55 AM
To: [EMAIL PROTECTED]
Subject: Re: methods on a servlet


hello richard,

i meant invoking methods on the servlet on receiving request from a jsp
page.
for example, i have method called registerUser(String username, String
password) in the servlet class.
how to invoke this method from a jsp page on user clicking the Submit button
?
thanks for your help.



-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Richard Yee
Sent: Wednesday, June 26, 2002 7:45 PM
To: [EMAIL PROTECTED]
Subject: Re: methods on a servlet


Dossani,
Yes, it is possible to invoke methods in a servlet class from a jsp page.
You need to import the servlet's class if it is in a package. What method
do you want to invoke? You shouldn't invoke any of the methods defined by
the HttpServlet interface. You would treat the servlet just like any other
class whose method's you want to invoke. You would need to create an
instance of the class unless the method is static. This would all be done
in a scriptlet.

Now just because you can do it, doesn't mean you should. A better approach
would be to put the method in its own class which would then be imported
and instantiated by the servlet or JSP as a bean.

Regards,

Richard




At 05:08 PM 6/26/2002 -0600, you wrote:
>hello,
>is it possible to invoke methods in a servlet class from a jsp page ?
>thanks for your help.
>
>___________________________________________________________________________
>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

___________________________________________________________________________
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

Reply via email to