Apache Struts 2 Documentation > Home > Guides > Tag Developers Guide > Struts Tags > UI Tags > Themes and Templates > ajax theme > ajax head template

The ajax head template builds upon the xhtml head template by providing additional JavaScript includes for the Dojo Toolkit, which is used by the ajax a template, ajax div template , and the ajax tabbedPanel template. It is required to use this tag, <ww:head theme="ajax"/>, in your HTML <head> block if you wish to use AJAX feature. The contents of head.ftl are:

 * $Id$
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *  http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
<script language="JavaScript" type="text/javascript">
    // Dojo configuration
    djConfig = {
        isDebug: ${parameters.debug?default(false)?string},
        bindEncoding: "${parameters.encoding}"
        <#if parameters.baseRelativePath?if_exists != "">
          ,baseRelativePath: "<@s.url value='${parameters.baseRelativePath}' includeParams='none' encode='false' />"
          ,baseScriptUri: "<@s.url value='${parameters.baseRelativePath}' includeParams='none' encode='false' />"
          ,baseRelativePath: "${base}/struts/dojo/"
          ,baseScriptUri: "${base}/struts/dojo/"
        <#if parameters.locale?if_exists != "">
          ,locale: "${parameters.locale}"
        <#if parameters.extraLocales?exists>
          ,extraLocale: [
        	<#list parameters.extraLocales as locale>
        		"${locale}"<#if locale_has_next>,</#if>
         ,parseWidgets : ${parameters.parseContent?string}

<#if parameters.compressed?default(true)>
  <#assign dojoFile="dojo.js">
  <#assign dojoFile="dojo.js.uncompressed.js">

<#if parameters.cache?default(true)>
  <#assign profile="struts_">
  <#assign profile="">

<#if parameters.baseRelativePath?if_exists != "">
  <script language="JavaScript" type="text/javascript"
        src="<@s.url value='${parameters.baseRelativePath}/${profile}${dojoFile}' includeParams='none' encode='false'  />"></script>
  <script language="JavaScript" type="text/javascript"

<script language="JavaScript" type="text/javascript"
<#if parameters.debug?default(false)>
<script language="JavaScript" type="text/javascript">
<link rel="stylesheet" href="${base}/struts/xhtml/styles.css" type="text/css"/>

<script language="JavaScript" src="${base}/struts/utils.js" type="text/javascript"></script>
<script language="JavaScript" src="${base}/struts/xhtml/validation.js" type="text/javascript"></script>
<script language="JavaScript" src="${base}/struts/css_xhtml/validation.js" type="text/javascript"></script>
If you are having trouble getting the AJAX theme to work, you should include the above JavaScript in your page manually, changing "isDebug: false" to "isDebug: true". This will log out debugging information directly to the screen.

Note that Dojo is configured to use the same character encoding specified in struts.properties, typically UTF-8. For a simple example of how to use the head tag with the AJAX theme, simply do the following in your HTML:

<sx:head cache="true"/>
The above sample is from Struts trunk; for 2.0.6 you should use <s:head debug="true"/>.