connecting servlet with jsp

S

soni29

hi,
i have a jsp page with a form on it and wish to submit the data to a
servlet, in the form's action property do i have to specify the
servlet class as http://localhost:8080/myApps/servlet/Test or is there
anyway without having to map the entire ip address into it. Without
having to map would help as this way i can easily move it to another
ip without having to change the code.

Thank you.
 
A

Andy Flowers

As long as the JSP page is in the same application then submit it back as
"/servlet/Test", the rest of the path is known by the browser.
 
W

Wendy S

soni29 said:
i have a jsp page with a form on it and wish to submit the data to a
servlet, in the form's action property do i have to specify the
servlet class as http://localhost:8080/myApps/servlet/Test or is there
anyway without having to map the entire ip address into it. Without
having to map would help as this way i can easily move it to another
ip without having to change the code.

You can use relative paths for the form's action element. In this case you
can probably use <form action="/myApps/servlet/Test" >. No guarantees, I'm
not sure how the port number will be handled as I don't use it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top