You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Apache Wiki <wi...@apache.org> on 2006/01/10 01:48:42 UTC

[Struts Wiki] Update of "StrutsTaglibHtmlBase" by MichaelJouravlev

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Struts Wiki" for change notification.

The following page has been changed by MichaelJouravlev:
http://wiki.apache.org/struts/StrutsTaglibHtmlBase

------------------------------------------------------------------------------
  While HTML <base> tag does additional processing of request elements, its basic functionality boils down to the following expression:
  {{{
   <base href="
-    <%= request.getScheme()+
+    <%= request.getScheme()+ "://"+
-        "://"+request.getServerName()+":"+
+        request.getServerName()+":"+
         request.getServerPort()+
         request.getRequestURI()
     %>">
  }}}
  
- Note: if you access an action from the browser and then forward to a JSP page, then you can use request.getRequestURL() to obtain address of the action, and request.getRequestURI() to obtain address of the JSP page. For example, consider that the action is defined in struts-config.xml as "/Home", JSP page is stored in directory "pages" as "home.jsp" and context is defined as "myapp". The results obtained from JSP page will be similar to the following:
+ Note: if you access an action from the browser and then forward to a JSP page, then you can use request.getRequestURL() to obtain address of the action, and request.getRequestURI() to obtain address of the JSP page.
+ 
+ For example, consider that the action is defined in struts-config.xml as "/Home", JSP page is stored in directory "pages" as "home.jsp" and context is defined as "myapp". The results obtained from JSP page will be similar to the following:
  {{{
  request.getRequestURL() ==> http://myserver:8080/myapp/Home.do
  request.getRequestURI() ==> /myapp/pages/home.jsp
  }}}
+ The above behavior is specified in Servlet documentation. It states that request.getRequestURI() points to location that was forwarded to. See [http://www.javaworld.com/javaworld/jw-03-2003/jw-0328-servlet_p.html this article] for insight.
  
  ==== Attributes ====
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org