SCJP 1.5(97%) My Blog
SCJP 1.5(97%) My Blog
Priti Sharma wrote:I hope my understanding is correct
--> The "action" path in HTML is related to the URL of the that HTML page. Accordingly browser appends the context name (web application name). This also depends on whether action path has leading "/".
shivendra tripathi wrote:Priti,
Let me explain it in detail.
1. I have a html page a.html where i have code written to call a servlet ("<form method="POST" action="publicUrlName">, "). And server will append the context when you submit this page from browser since it's not absolute.
2. Now first of all I have to acess the a.html and suppose it is in war file MyApp. So my caontext path will be MyApp
3. I will submit URL sth like Http://hostname:port/MyAppp/a.html
4. Browser will display a.html
5. When I will submit a.Html, browser will see the form action without "/"(so it's relative), it will take context from step 3 which is MyApp and prepend before action name. Now your URL will be Http://hostname:port/MyAppp/publicUrlName
6. In case your action is "/publicUrlName" your URL will become Http://hostname:port/publicUrlName
Hope this will be helpful.
Balu Sadhasivam wrote:
Priti Sharma wrote:I hope my understanding is correct
--> The "action" path in HTML is related to the URL of the that HTML page. Accordingly browser appends the context name (web application name). This also depends on whether action path has leading "/".
Thats perfectly right.