jspstruts2struts-configstruts1struts-tags

How to use a global forward (struts-config.xml) in Struts2 JSP?


I am migrating a Struts1 web app to Struts2. I have the following in my struts-config.xml file:

<global-forwards >
    <forward name="css" path="/common/css/app-global.css" />
</global-forwards>

In my JSP today (Struts 1), I have this call:

<link rel="stylesheet" id="default" type="text/css" href="<html:rewrite forward='css'/>" />

What is the equivalent way to do this in the JSP in Struts 2? I tried <s:url value="css"> but no luck.

I just want to point to the reference in global-forwards. I'm sure it's something simple I'm overlooking.

UPDATE: Listen, if there is a better way than using struts-config.xml (which I'm wondering if that should even be used in Struts 2), then by all means, set me straight. I just didn't know if using the actual path was superior/inferior to using the specified forward name.


Solution

  • No need for some global forward mapping or whatever. Just use <s:url> tag with value attribute.

    <link rel="stylesheet" id="default" type="text/css" 
          href="<s:url value='/common/css/app-global.css'/>" />