any example would be helpful! Pls

Does the getRequestURL() need any example?

Reconstructs the URL the client used to make the request.

classic example of "gif mi zu koduz", aka a homework kiddo that can't be bothered to do its own homework.
It probably didn't even bother to read the documentation I supplied, far too much trouble.

I guess he should realy show more interest in this case but he may be too busy with his blog. ;) <offTopic>Interesting things, but not coolest in my opinion</offTopic> I hope he will at least say thank you

classic example of "gif mi zu koduz", aka a homework kiddo that can't be bothered to do its own homework.
It probably didn't even bother to read the documentation I supplied, far too much trouble.

I guess he should realy show more interest in this case but he may be too busy with his blog. ;) <offTopic>Interesting things, but not coolest in my opinion</offTopic> I hope he will at least say thank you

bro thanks a lot.. was out of station for some days so wasn't replying.. thanks again... Sorry for late reply.. :)

Since this appears first on google for some related searches, it would be nice to have the answer, even if it is one line.

To get the full url:
String url = (request.getRequestURL()).toString();[/java][code=java]String url = (request.getRequestURL()).toString();[/java]

Edited 6 Years Ago by peter_budo: Keep it Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

I am looking for the answer to this, too. Our server used to use JRun and now uses Tomcat/JBoss. We cannot know the port number used to access the JSP since JRun got it from the URL itself while Tomcat/JBoss gets the port number from the HTTP request header for the host name. Unfortunately because of this, many of our client requests did not include the port number in the request header. When I RTFM, the documentation said that it recreates...I'm going to guess that it will be recreated without the port number.

<%
Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
int rows = 0;
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,"amar","amar123");
try{
Statement st = con.createStatement();
String query = "select count(*) from user_Register";
ResultSet rs = st.executeQuery(query);

while (rs.next()) {
rows =rs.getInt(1);

%>

i hope this will help u

Edited 6 Years Ago by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

Comments
Ignoring question, ignoring code tags and showing sample of bad programming practice

@ravi_fab69
1. You completely disregarded question and provided "code" for something else
2. You completely ignored forum rules to always wrap programming code within posts in code-tags
3. Get your self slap on hand for doing database connection directly from page instead of servlet

Edited 3 Years Ago by mike_2000_17: Fixed formatting

I think it is work <%=(String)request.getRequestURL()%>

Edited 1 Year Ago by peter_budo: Code formatting

This question has already been answered. Start a new discussion instead.