Struts <html:rewrite> is a useful taglib to render a request URI, but without creating the <a> hyperlink, it is always used to generate the JavaScript or CSS file name.

For example

1. Css file

Struts rewrite to include a CSS file in HTML page.

<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
 
<link rel="stylesheet" href="<html:rewrite page='/styles/base.css'/>" 
type="text/css" media="screen" />

It will convert to the following HTML code.

<link rel="stylesheet" href="/StrutsExample/styles/base.css" 
type="text/css" media="screen" />

2. Javascript file

Struts rewrite to include a Javascript file in HTML page.

<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
 
<script type="text/javascript" src="<html:rewrite page='/scripts/base.js'/>">
</script>

It will converted to following HTML code.

<script type="text/javascript" src="/StrutsExample/scripts/base.js">
</script>

P.S the “StrutsExample” is the Struts project root folder.

Reference

http://struts.apache.org/1.x/struts-taglib/tlddoc/html/rewrite.html

Note : You can find more similar articles at - Struts 1.x Tutorials