the thing is I’d like to get the current url in a jsp page, but not showing the .jsp page but the action name. For example:
I have the action http://www.mypage.com/Index, which displays the page http://www.mypage.com/pages/index.jsp. Is there any way I could obtain the first Url in a jsp file? What I have always returns the path to the jsp, but what I want is the action name. What I have is:
<%= (request.getServletPath()) %>
and
${pageContext.request.requestURL}?${pageContext.request.queryString} //to get the id attached
I want this for a simple facebook share button:
<div class="fb-like" data-href="${pageContext.request.requestURL}?${pageContext.request.queryString}" data-send="true" data-width="450" data-show-faces="true"></div>
Use
<s:url>tag for that.The
forceAddSchemeHostAndPortattribute setted totruewill add your host name with port andincludeParamssetted toallwill include all parameters to it.