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/StrutsTaglibHtmlLink ------------------------------------------------------------------------------ <html:link action="userpage.do">Goto homepage (5)</html:link> <html:link action="/userpage.do">Goto homepage (6)</html:link> }}} - Generated HTML would look like this: + The links in generated HTML are normalized using application context name; extensions are stripped; because {{{web.xml}}} defines extension mapping, default extension is added to action names in all links: {{{ - <a href="/mysite/userpage.page">Goto homepage (1)</a> + <a href="/myapp/userpage.page">Goto homepage (1)</a> - <a href="/mysite/userpage.page">Goto homepage (2)</a> + <a href="/myapp/userpage.page">Goto homepage (2)</a> - <a href="/mysite/userpage.page">Goto homepage (3)</a> + <a href="/myapp/userpage.page">Goto homepage (3)</a> - <a href="/mysite/userpage.page">Goto homepage (4)</a> + <a href="/myapp/userpage.page">Goto homepage (4)</a> - <a href="/mysite/userpage.page">Goto homepage (5)</a> + <a href="/myapp/userpage.page">Goto homepage (5)</a> - <a href="/mysite/userpage.page">Goto homepage (6)</a> + <a href="/myapp/userpage.page">Goto homepage (6)</a> }}} - All links are normalized using application context name. Extensions are stripped. Because web.xml defines extension mapping, default extension is added to action names in all links. - When browser resolves the links it prepends them with "http://mysite:8080". + When browser resolves the links it prepends them with server name and port number to build full address. ==== Example 2: Using "href" attribute ==== @@ -60, +59 @@ <html:link href="userpage.do">Goto homepage (5)</html:link> <html:link href="/userpage.do">Goto homepage (6)</html:link> }}} - Generated HTML would look like this: + The value of the links in generated HTML is unchanged: {{{ <a href="userpage.jsp">Goto homepage (1)</a> <a href="/userpage.jsp">Goto homepage (2)</a> @@ -69, +68 @@ <a href="userpage.do">Goto homepage (5)</a> <a href="/userpage.do">Goto homepage (6)</a> }}} - The value of the links is unchanged, the leading slash is not added and extensions are unmodified. Browser resolves these links using <base> locaiton as follows (shown is the full address that can be seen in the browser status bar when hovering over a link): + Browser resolves these links using <base> location as follows (shown is the full address that can be seen in the browser status bar when hovering over a link): {{{ - <a href="http://mysite:8080/myapp/pages/userpage.jsp">Goto homepage (1)</a> - <a href="http://mysite:8080/userpage.jsp">Goto homepage (2)</a> - <a href="http://mysite:8080/myapp/pages/userpage">Goto homepage (3)</a> - <a href="http://mysite:8080/userpage">Goto homepage (4)</a> - <a href="http://mysite:8080/myapp/pages/userpage.do">Goto homepage (5)</a> - <a href="http://mysite:8080/userpage.do">Goto homepage (6)</a> + <a href="userpage.jsp">Goto homepage (1)</a> <== http://mysite:8080/myapp/pages/userpage.jsp"> + <a href="/userpage.jsp">Goto homepage (2)</a> <== http://mysite:8080/userpage.jsp + <a href="userpage">Goto homepage (3)</a> <== http://mysite:8080/myapp/pages/userpage + <a href="/userpage">Goto homepage (4)</a> <== http://mysite:8080/userpage + <a href="userpage.do">Goto homepage (5)</a> <== http://mysite:8080/myapp/pages/userpage.do + <a href="/userpage.do">Goto homepage (6)</a> <== http://mysite:8080/userpage.do }}} If you use "href" attribute for relative addressing, strip leading slash. Otherwise browser will resolve the link as server-absolute location. ==== Example 3: Using "page" attribute ==== @@ -99, +98 @@ <a href="/myappuserpage.do">Goto homepage (5)</a> <a href="/myapp/userpage.do">Goto homepage (6)</a> }}} - When browser resolves the links it prepends them with "http://mysite:8080". + When browser resolves the links it prepends them with server name and port number: {{{ - <a href="http://mysite:8080/myappuserpage.jsp">Goto homepage (1)</a> - <a href="http://mysite:8080/myapp/userpage.jsp">Goto homepage (2)</a> - <a href="http://mysite:8080/myappuserpage">Goto homepage (3)</a> - <a href="http://mysite:8080/myapp/userpage">Goto homepage (4)</a> - <a href="http://mysite:8080/myappuserpage.do">Goto homepage (5)</a> - <a href="http://mysite:8080/myapp/userpage.do">Goto homepage (6)</a> + <a href="/myappuserpage.jsp">Goto homepage (1)</a> <== http://mysite:8080/myappuserpage.jsp + <a href="/myapp/userpage.jsp">Goto homepage (2)</a> <== http://mysite:8080/myapp/userpage.jsp + <a href="/myappuserpage">Goto homepage (3)</a> <== http://mysite:8080/myappuserpage + <a href="/myapp/userpage">Goto homepage (4)</a> <== http://mysite:8080/myapp/userpage + <a href="/myappuserpage.do">Goto homepage (5)</a> <== http://mysite:8080/myappuserpage.do + <a href="/myapp/userpage.do">Goto homepage (6)</a> <== http://mysite:8080/myapp/userpage.do }}} This is probably not the result that you wanted to achieve. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]