How to redirect the url
I am not sure what would be the exact techn开发者_StackOverflow中文版ical term for this but i wanted to access a file which is avail in server(Apache Tomcat
). i just wanted to type this in browser e.g.
http://localhost:8080/myProjectName/eng
:
http://localhost:8080/myProjectName/english.html
*
http://localhost:8080/myProjectName/hin
:
http://localhost:8080/myProjectName/hindi.html
*
my project structure is
myProjectName
|
webContent
|
|----WEB-INF
| |_ _ _ web.xml
|
|--- english.html
|--- hindi.html
is there any way to get the possible result by writing something in web.xml.
Environment : java servlet html js jQuery tomcat6.0
if i am understanding your question, here is the solution :
- What you need to do? file configuration
- use
<jsp-file>
mapping instead of<servlet-class>
http://localhost:8080/myProjectName/eng
Just define mapping in web.xml
<servlet>
<servlet-name>config</servlet-name>
<jsp-file>/english.html</jsp-file> /* referential page */
</servlet>
<servlet-mapping>
<servlet-name>config</servlet-name>
<url-pattern>/eng</url-pattern> /* url pattern */
</servlet-mapping>
精彩评论