java - Wrong URL after clicking submit on JSP from -
i new jsp , dealing confusing issue. have jsp form located in sub folder called "admin" in web-app (named "cms").
cms/admin/display_content.jsp
my form has following values action , method attribute
<form action="/deletecontent" method="post">
/deletecontent url pattern servlet named deletecontentservlet. deletes db user selections. anyway, problem once click on submit notice incorrect url in address bar. instead of getting
http://localhost:8080/cms/deletecontent
i
http://localhost:8080/deletecontent
how can fix ? when have sub folders, files used imports maybe ? thank you.
use jstl <c:url>
tag urls:
- it prepends context path (whatever is) absolute urls
it writes session id in url in case browser doesn't accept cookies:
<form action="<c:url value='/deletecontent'/>" method="post">
for links, allows passing parameters url, , encodes them (via <c:param>
inner tag).
Comments
Post a Comment