Avatar of VBBRett
VBBRett
 asked on

How do I pass in HttpServletRequest and HttpServletResponse into a function from Main?

How do I pass in HttpServletRequest and HttpServletResponse into a function in a Java class Main function?  my function header is the following:

public void service(HttpServletRequest request, HttpServletResponse response) throws IOException
Java

Avatar of undefined
Last Comment
Manikandan Thiagarajan

8/22/2022 - Mon
CEHJ

What is the connection between the servlet and the class with a main method?

For class Foo, you can invoke the main method by simply doing

Foo.main(someStringArray);

Open in new window

ASKER CERTIFIED SOLUTION
girionis

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
VBBRett

ASKER
I'm trying to make sure that my Servlet works.  I have since created a Dynamic Web Project, added some gradle folders and files; added some Twilio references and then attempted to push my project onto the Tomcat local server.  I created a Hello World html page just to make sure that my app is in the right place, but the problem that I am having is attempting to get the service or Servlet to propogate upon navigation.  I just get a 404 error when I attempt to the url address of the Servlet into the browser.  Can you please tell me what I am doing wrong?  If you need more details, I can share with  you exactly what the code looks like.  Thanks!
rrz

Please show us how you mapped your Servlet. You could have mapped your Servlet in your app's web.xml file or with an annotation in your Servlet.
Also, show us the url you are using to try to access your Servlet.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Manikandan Thiagarajan

please check that webinf/web.xml and please make sure the you given correct path

in jsp  in action you give correct servelet path