Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Can I redirect/forward from a non existing url?

  Asked By: Aysel    Date: Mar 04    Category: Java    Views: 780
  

I would like to type have user friendly urls

http://localhost:8840/app/about

(note than "about" does not exist neither as a directory or file.)

and then being redirected to

http://localhost:8840/app/index.jsp

Is there any filter / servlet which does that?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Jamie Roberts     Answered On: Mar 04

in web.xml you may declare your jsp file  as servlet  and assign a pattern to its url  mapping:


<servlet>
<servlet-name>myIndex</servlet-name>
<jsp-file>/app/index.jsp</jsp-file>
</servlet>

<servlet-mapping>
<servlet-name>myIndex</servlet-name>
<url-pattern>/app/about</url-pattern>
</servlet-mapping>

 
Didn't find what you were looking for? Find more on Can I redirect/forward from a non existing url? Or get search suggestion and latest updates.




Tagged: