开发者

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 :

*but this should refer as. http://localhost:8080/myProjectName/english.html *

http://localhost:8080/myProjectName/hin :

*but this should refer as. 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 :

  1. What you need to do? file configuration
  2. 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜