Hi..!

I am trying to get whole browser in my jsp page.
I have a sample url as, "http://www.ab.com/#/pages/ab"
I need this whole URL to be print in my scriptlet code in jsp.

I can't use javascript as that is disabled. I tried with REQUEST objets several methods like getURL and all but still not able to get whole URL as it displays in browser.

If you have a answer then can you please reply with snippet of code please.

Thank you in advance.

Recommended Answers

All 4 Replies

Hi..!

I am trying to get whole browser in my jsp page.
I have a sample url as, "http://www.ab.com/#/pages/ab"
I need this whole URL to be print in my scriptlet code in jsp.

I can't use javascript as that is disabled. I tried with REQUEST objets several methods like getURL and all but still not able to get whole URL as it displays in browser.

If you have a answer then can you please reply with snippet of code please.

Thank you in advance.

Strange I've never encountered getURL method in the HttpServletRequest's javadocs, Try searching here.

Hi

I am writing a jsp/servlet which can check that the requested URL is having "#" or not.?

Let's say my URL is like, http://abc.com/#/efg/hij.jsp

As it is having "#' sign in the URL string, So I need to check the existence of "#" in requested URL.

My problem is when I write ..

StringBuffer url = request.getRequestURL();
String requestedURL = url.toString();

requestedURL only provides me the string before "#" i.e. http://abc.com/
I need to check if it has "#" or not with whole URL string.

Is there any way to check that into jsp/servlet.?

see, i am not a JSP Developer so i don't know about it, but as a php developer i can suggest you to find some fuction like strpos() in php which is used to find the position occurrence of a given string.

I already gave you the link to the Javadocs, and from what you mention I think you need the getRequestURI() method and not the getRequestURL() method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.