Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


ajax:htmlContent load baseURL by default

Luis Pedro
  • Luis Pedro
    Luis Pedro

    Dear all,
         I'd like to know if it is possible in ajax:htmlContent load the baseURL (or another URL) automatically. Like, for example, in

    <ajax:tabPanel   id="ajaxCurrentTab">
      <ajax:tab defaultTab="true"  baseUrl=""/>

    the baseURL defined in the defaultTab is automatically loaded.

    Any idea how can I do this without using tabPanel?

    Thanks very much in advance for your time and help

  • If you want to include just another JSP in your project, use JSP directive

    <%@include file=""%>


    <jsp:include page="" />

    . If you need other resource (possibly from another host) use JSTL tag

    <c:import url="" />


    Or, if you want more JavaScript, remember JS object generated with ajax:htmlContent and invoke execute() manually:

    Your JSP:
    <ajax:htmlContent var="hc" ... />
    Your JavaScript:

    or in single JSP file:

    <ajax:htmlContent var="hc" ... />
    <script type="text/javascript">document.observe("dom:loaded",hc.execute);</script>
  • <ajax:htmlContent var="hc" ...=""/>
    <script type="text/javascript">document.observe("dom:loaded",hc.execute.bind(hc));</script>

  • Or maybe

    <ajax:htmlContent var="hc" ... />
    <script type="text/javascript">document.observe("dom:loaded", hc.listener);</script>