简体   繁体   中英

How Can I Hide jsp folder path and file name in application

I have a web application - But when I navigate from menus and other links, the address bar displays folder and file name. What I would like to have is whatever navigation the user do, the address bare should only display

http://domain:port/daswebapp

rather than

http://domain:port/daswebapp/admin/index.jsp

Can anybody help on this. I don't use any other framework.Its a pure MVC pattern. Thanks n Regards Noufal

Use url rewrite filter such as urlrewritefilter , for JSF based app go for Pretty faces

The main things it is used for are:

  • URL Tidyness / URL Abstraction - keep URLs tidy irrespective of the underlying technology or framework (JSP, Servlet, Struts etc).

  • Browser Detection - Allows you to rewrite URLs based on request HTTP headers (such as user-agent or charset).

  • Date based rewriting - Allows you to forward or redirect to other URL's based on the

    date/time (good for planned outages).

  • Moved content - enable a graceful move of content or even a change in CMS.

  • Tiny/Friendly URL's (ie blah.com/latest can be redirected to blah.com/download/ver1.2.46.2/setup.exe)

  • A Servlet mapping engine (see Method Invocation)

you can use RequestDispatcher,

RequestDispatcher dispatcher = getRequestDispatcher("daswebapp/admin/index.jsp");
   dispatcher.forward( request, response );

you can use something like this try out and let me know

RequestDispatcher reqDisp = getServletContext().getRequestDispatcher("/index.jsp");
            reqDisp.forward(request, response);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM