How can I put an active URL in a textbox?
Using JSP, how can I put an active URL in a t开发者_开发百科extbox?
Well there are 2 ways [server side and client side]:
in JSP you can do something like this to retrieve the URL that is currently loaded:
<input type="text" id="currentURL" value="<%= request.getRequestURI() %> " />
you can also try to use request.getRequestURL() depending on what you need.
More info on this page: http://www.theserverside.com/discussions/thread.tss?thread_id=5651
You can also retrieve the same info by using JavaScript:
var currentURL = document.location;
and then assign it to the input field you require.
精彩评论