FileDocCategorySizeDatePackage
Head.javaAPI DocExample4598Mon Jul 23 13:26:36 BST 2007org.apache.struts2.components

Head

public class Head extends UIBean
Renders parts of the HEAD section for an HTML file. This is useful as some themes require certain CSS and JavaScript includes.

If, for example, your page has ajax components integrated, without having the default theme set to ajax, you might want to use the head tag with theme="ajax" so that the typical ajax header setup will be included in the page.

The tag also includes the option to set a custom datepicker theme if needed. See calendarcss parameter for description for details.

If you use the ajax theme you can turn a debug flag on by setting the debug parameter to true.

Examples


<head>
<title>My page</title>
<s:head/>
</head>


<head>
<title>My page</title>
<s:head theme="ajax" calendarcss="calendar-green"/>
</head>


<head>
<title>My page</title>
<s:head theme="ajax" debug="true"/>
</head>

Fields Summary
public static final String
TEMPLATE
private String
calendarcss
private boolean
debug
private String
encoding
Constructors Summary
public Head(com.opensymphony.xwork2.util.ValueStack stack, HttpServletRequest request, HttpServletResponse response)


           
        super(stack, request, response);
    
Methods Summary
public voidevaluateParams()

        super.evaluateParams();

        if (calendarcss != null) {
            String css = findString(calendarcss);
            if (css != null && css.trim().length() > 0) {
                if (css.lastIndexOf(".css") < 0) {
                    addParameter("calendarcss", css + ".css");
                } else {
                    addParameter("calendarcss", css);
                }
            }
        }

        addParameter("encoding", encoding);
        addParameter("debug", Boolean.valueOf(debug).toString());
    
public java.lang.StringgetCalendarcss()

        return calendarcss;
    
protected java.lang.StringgetDefaultTemplate()

        return TEMPLATE;
    
public booleanisDebug()

        return debug;
    
public voidsetCalendarcss(java.lang.String calendarcss)

        //TODO remove this one
        this.calendarcss = calendarcss;
    
public voidsetDebug(boolean debug)

        this.debug = debug;
    
public voidsetEncoding(java.lang.String encoding)

        this.encoding = encoding;