Mike,
What kind of parameters do you want to pass to your servlet? If they are
initialization parameters, then if you are using Tomcat, you would add them
to your web.xml file
ex.
<web-app>
<servlet>
<servlet-name>
myServlet
</servlet-name>
<servlet-class>
myPackageName.MyServlet
</servlet-class>
<init-param>
<param-name>
message
</param-name>
<param-value>
myParameterValue1
</param-value>
<param-name>
message
</param-name>
<param-value>
myParameterValue2
</param-value>
...etc....
</init-param>
</servlet>
</web-app>
If, on the other hand, you mean request parameters, then you either add
them to the URL as query parameters or submit them in a form w/ the POST
method. You would then use the HttpServletRequest.getParameter method to
obtain the individual parameters from the request.
As far as converting the application logic to the servlet, if your old code
is written so that the main method just does initialization and
instantiates the worker class, then the conversion is pretty trivial. Just
move the code into a method, called processRequest(HttpServletRequest req,
HttpServletResponse resp) for example, and then call this method from your
doPost() and doGet() methods
ex.
public void doPost(HttpServletRequest req, HttpServletResponse resp)
{
processRequest(req,resp);
}
In your processRequest method, you would extract the request parameters,
call your init method or your constructors w/ the parameters and then
output the result.
Regards,
Richard
At 10:41 AM 11/15/2001 -0600, you wrote:
>Are there any sites that explain this process of coverting a Java program to
>a servlet?
>
>Also how do I pass parmeters to the servlet?
>
>Mike Wills
>AS400 Programmer
>[EMAIL PROTECTED]
>
>Comming soon to a web browser near you... koldark.net
>
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>___________________________________________________________________________
>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