Home Jsp JSP Get URL
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

JSP Get URL

Advertisement
JSP Get URL is used to get the url of the current JSP page. The HttpServletRequest interface has a method getRequestURL ( ) that return the url of the current page.

JSP Get URL

        

JSP Get URL is used to get the url of the current JSP page. The HttpServletRequest interface has a method getRequestURL ( ) that return the url of the current page.

Understand with Example

The Tutorial illustrate an example from 'JSP Get URL'. To understand the example we create a getUrl.jsp that include a scriptlet. Inside the Scriptlet we have used the method getRequestURL that gives you the URL of the current JSP page.

<%=request.getRequestURL()%> : The method is used to obtain the URL of the current JSP page.

 

Here is the code of getUrl.jsp

<html>
<head>
<title>Get URL</title>
</head>
<h2>Get URL of Current JSP</h2>
URL is: <font color="red"><%=request.getRequestURL()%></font>
</html>

Output will be displayed as:

Download Source Code:

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 4, 2009

Ask Questions?    Discuss: JSP Get URL   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
rajnish singh
December 11, 2012
url fetching

url fetching facebook style
DMCA.com