Lesezeichen

Doubt about getContextPath(), getServletPath, getPathInfo() (OCPJWCD forum at Coderanch)


Beschreibung

For example: ? 1 2 3 4 5 6 7 8

<servlet> <servlet-name>A</servlet-name> <jsp-file>/WEB-INF/A/B/C/start.jsp</jsp-file> </servlet> <servlet-mapping> <servlet-name>A</servlet-name> <url-pattern>/A/*</url-pattern> </servlet-mapping>

When you now use the following URL: http://localhost:8080/myApp/A/hallo?q=a

getServletPath() /A
getContextPath() /myApp
getPathInfo() /hallo
getQueryString() q=a

or http://localhost:8080/myApp/A/B/C/hallo?q=a

getServletPath() /A
getContextPath() /myApp
getPathInfo() /B/C/hallo
getQueryString() q=a 

Vorschau

Tags

Nutzer

  • @jil

Kommentare und Rezensionen