Good Afternoon Milan

forgive the mid-thread interruption but 
Dave is talking about the theme setting for struts head tag set to simple or 
ajax as in
<ww:head theme="ajax"/>

so if you specified attribute theme=simple you will reference  
$classpath/template/simple/head.ftl
or if you specified attribute theme=ajax you will reference  
$classpath/template/ajax/head.ftl

The referenced head.ftl contains the dojo code you will be using so in the case 
of simple/head.ftl
<script language="JavaScript" type="text/javascript">
    // Dojo configuration
    djConfig = {
        baseRelativePath: "<@s.url includeParams='none' value='/struts/dojo' 
includeParams="none" encode='false'/>",
        isDebug: ${parameters.debug?default(false)},
        bindEncoding: "${parameters.encoding}",
        debugAtAllCosts: ${parameters.debug?default(false)}, // not needed, but 
allows the Venkman debugger to work with the includes
    };
</script>
<script language="JavaScript" type="text/javascript"
        src="<@s.url includeParams='none' value='/struts/dojo/dojo.js' 
includeParams="none" encode='false'/>"></script>
<script language="JavaScript" type="text/javascript"
        src="<@s.url includeParams='none' value='/struts/simple/dojoRequire.js' 
includeParams="none" encode='false'/>">
</script>whereas the ajax head.ftl would look something like
<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' />"
        <#else>
          ,baseRelativePath: "${base}/struts/dojo/"
          ,baseScriptUri: "${base}/struts/dojo/"
        </#if>  
        <#if parameters.locale?if_exists != "">
          ,locale: "${parameters.locale}"
        </#if>
        <#if parameters.extraLocales?exists>
          ,extraLocale: [
            <#list parameters.extraLocales as locale>
                "${locale}"<#if locale_has_next>,</#if>
            </#list>
          ]
        </#if>
         ,parseWidgets : ${parameters.parseContent?string}
        
    };
</script>

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

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

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

<script language="JavaScript" type="text/javascript"
        src="${base}/struts/ajax/dojoRequire.js"></script>
<#if parameters.debug?default(false)>
<script language="JavaScript" type="text/javascript">
    dojo.hostenv.writeIncludes(true);
</script>     
</#if>        
<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>

Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 




> Date: Fri, 21 Nov 2008 06:39:07 -0800
> From: [EMAIL PROTECTED]
> To: user@struts.apache.org
> Subject: Re: Form submitted twice (no AJAX!)
> 
> 
> Dear Dave,
> 
> I don't understand. That is exactly what I get when page is generated. I
> omited some plain html code.
> 
> 
> --
> Milan
> 
> 
> newton.dave wrote:
> > 
> > I don't think that came through properly; perhaps try pastebin or similar.
> > 
> > Dave
> > 
> > 
> > --- On Thu, 11/20/08, Milan Milanovic <[EMAIL PROTECTED]> wrote:
> > 
> >> From: Milan Milanovic <[EMAIL PROTECTED]>
> >> Subject: Re: Form submitted twice (no AJAX!)
> >> To: user@struts.apache.org
> >> Date: Thursday, November 20, 2008, 3:33 PM
> >> Why is this form submitte twice ?
> >> 
> >> 
> >> Milan Milanovic wrote:
> >> > 
> >> > Yes, but it is the same when I remove ajax with
> >> simple. Here is my jsp
> >> > page, there is no AJAX word there and I still get
> >> submited twice:
> >> > 
> >> > <html
> >> xmlns="http://www.w3.org/1999/xhtml";
> >> xml:lang="en">
> >> > <head>
> >> > <script type="text/javascript">
> >> >     // Dojo configuration
> >> >     djConfig = {
> >> >         baseRelativePath:
> >> "/myApp/struts/dojo",
> >> >         isDebug: true,
> >> >         bindEncoding: "UTF-8",
> >> >         debugAtAllCosts: true // not needed, but
> >> allows the Venkman
> >> > debugger to work with the includes
> >> >     };
> >> > </script>
> >> > <script type="text/javascript"
> >> >        
> >> src="/myApp/struts/dojo/dojo.js"></script>
> >> > <script type="text/javascript"
> >> >        
> >> src="/myApp/struts/simple/dojoRequire.js"></script>
> >> > </head>
> >> > <body onload="">
> >> > 
> >> > 
> >> > <div id="menu"> /myApp/index.jsp Main 
> >> &nbsp; |&nbsp; 
> >> > /myApp/j_acegi_logout Logout </div>
> >> > 
> >> > <div id="sidebar">
> >> > <h1>Menu</h1>
> >> > <div class="project">
> >> > <p> /myApp/index.jsp Main page </p>
> >> > <p>&nbsp;</p>
> >> > <p>&nbsp;</p>
> >> > <p> # <br />
> >> >  </p>
> >> > </div>
> >> > </div>
> >> > 
> >> > <div>
> >> > <h2>Choose report</h2>
> >> > <br>
> >> >  <div align="left" style="width:
> >> 600px; border-width:thin;
> >> > border-style:solid; border-color:threedlightshadow;
> >> text-align: left;">
> >> > 
> >> >                  
> >> > <form namespace="/reports
> >> id="showReport" name="showReport"
> >> > onsubmit="return true;"
> >> action="/myApp/reports/showReport.action"
> >> > method="post">
> >> >    <table class="wwFormTable">
> >> >          
> >> >          From date: <script
> >> type="text/javascript">
> >> >     dojo.require("dojo.widget.DatePicker");
> >> > </script>
> >> > <div
> >> >      dojoType="dropdowndatepicker"   
> >> id="fromDate"   
> >> > value="2008-11-11T00:00:00"   
> >> name="dojo.fromDate"   
> >> > inputName="fromDate"    
> >> displayFormat="dd.MM.yyyy" 
> >> > saveFormat="rfc"></div><br/>
> >> >                  Do datuma: <script
> >> type="text/javascript">
> >> >     dojo.require("dojo.widget.DatePicker");
> >> > </script>
> >> > 
> >> >          <tr>
> >> >                  <td align="right"><label
> >> for="users"
> >> class="label">User:</label></td>
> >> >                  <td><select name="user.id"
> >> id="user">
> >> >     <option
> >> value="1">Mike</option>
> >> >     <option
> >> value="2">John</option>
> >> >     <option
> >> value="3">Peter</option>
> >> > </select></td>
> >> >          </tr>
> >> >          <tr>
> >> >                  <td colspan="2"><input
> >> type="submit" id="showReport_0"
> >> value="Show
> >> > report" class="submit"
> >> style="submit"/>
> >> > </td>
> >> >          </tr>
> >> > </table></form>
> >> > 
> >> > </div>
> >> > </body>
> >> > </html>
> >> > 
> >> > 
> >> > 
> >> > 
> >> > Jeromy Evans - Blue Sky Minds wrote:
> >> >> 
> >> >> Milan Milanovic wrote:
> >> >>> Hi,
> >> >>>
> >> >>> I have a simple jsp form:
> >> >>>
> >> >>> <head>
> >> >>>        <s:head theme="ajax"
> >> debug="true" />
> >> >>> </head>
> >> >>> <s:form action="showReport"
> >> namespace="/reports" validate="true">
> >> >>>   
> >> >> <snip>
> >> >> 
> >> >>>                And when user click submit button, this form
> >> get submitted twice, i.e.
> >> >>> showReport form action method is called twice!
> >> I'm NOT USING AJAX here,
> >> >>> I
> >> >>> DON'T HAVE ANY Javascript functions in
> >> this page.
> >> >>>
> >> >>>   
> >> >> 
> >> >> You DO have javascript in your page and you ARE
> >> using ajax.
> >> >> 
> >> >> <s:head theme="ajax"> instructs
> >> struts to include the dojo javascripts, 
> >> >> and sets the default theme to ajax.
> >> >> <s:form ...valudate="true">
> >> instructs struts to include client-side 
> >> >> javascript validation (or possibly ajax
> >> validation; I can't recall if 
> >> >> that requires the theme on the form itself or
> >> not).
> >> >> 
> >> >> Viewing the source of your page would tell you
> >> this.  Firefox with 
> >> >> Firebug will tell you what's happening.
> >> >> 
> >> >> Clean it up and see how you go.
> >> >> 
> >> >> 
> >> >>
> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail:
> >> [EMAIL PROTECTED]
> >> >> For additional commands, e-mail:
> >> [EMAIL PROTECTED]
> >> >> 
> >> >> 
> >> >> 
> >> > 
> >> > 
> >> 
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/Form-submitted-twice-%28no-AJAX%21%29-tp20584806p20609456.html
> >> Sent from the Struts - User mailing list archive at
> >> Nabble.com.
> >> 
> >> 
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail:
> >> [EMAIL PROTECTED]
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Form-submitted-twice-%28no-AJAX%21%29-tp20584806p20622377.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

_________________________________________________________________
Access your email online and on the go with Windows Live Hotmail.
http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_access_112008

Reply via email to