JSP & Servlets
1.0.0
1.0.0
  • Setting up
  • Pre-requisites
  • Servlet Part 1
  • Servlet Part 2
  • Understanding the servlet
  • Servlet XML Configuration
  • POST method and passing parameters
  • Passing more parameters
  • Understanding GET and POST
  • Request, Session and Context Part -1
  • Request , Session and Context Part - 2
  • Understanding init, service and ServletConfig
  • Hello JSP
  • Understanding JSP
  • JSP Page directives
  • HttpServletRequest Path Decoding
  • Scopes in JSP and the PageContext Object
  • Understanding MVC pattern
  • PART -1 Writing an MVC app
  • JSTL
    • For-each
  • CRUD-1
  • Project Work
    • Create a Simple Java Web Application Using Servlet, JSP/JSTL and JDBC/Transaction
  • Locale Filter
  • Action Plan
    • Schedule
    • Hit webservice
Powered by GitBook
On this page

Was this helpful?

HttpServletRequest Path Decoding

PreviousJSP Page directivesNextScopes in JSP and the PageContext Object

Last updated 5 years ago

Was this helpful?

The documentation on HttpServletRequest is very poor, and this fills in a critical set of facts that you need to know to write a TomCat application.

The HttpServletRequest object will return the path to the current request with the following methods:

  • getContextPath()

  • getPathInfo()

  • getPathTranslated()

  • getQueryString()

  • getRequestURI()

  • getRequestURL()

  • getServletPath()

Imagine you have a tomcat server installed at

Imagine you install an application in this server at “myapp”

That application has a servlet mounted at “servlet1”

The user then makes a request:

http://server:port/myapp/servlet1/path/file.doc?q1=foo&q2=bar

Here is the map of how the various functions decode this:

http://server:8080/