struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pablo Vázquez Blázquez <pvazq...@denodo.com>
Subject Re: s:datetimepicker
Date Tue, 30 Sep 2008 11:27:29 GMT
I have finally solved it! I did not modify any template.

This is the code in my subscribe function:

if (type == "load") {
            dojo.require("dojo.widget.Parse");
            var widgetParser = new dojo.widget.Parse();
            var xmlParser = new dojo.xml.Parse();
            var initIndex = data.indexOf("<form");
            var endIndex = data.indexOf("</form>");
            if ((initIndex != -1) && (endIndex != -1)) {
                var formStr = data.substring(initIndex, endIndex+7);
                var div = document.createElement("div");
                div.innerHTML = formStr;
                var results = widgetParser.createComponents(
                    xmlParser.parseElement(div.childNodes[0],null,true));
                for (var i = 0; i < results.length; i++) {
                    var formNode = results[i].formNode;
                    if (formNode && formNode != "") {
                        form1 = formNode;
                    }
                }
               
            } else {
                form1 = undefined;
            }

Sébastien Domergue escribió:
> When a jsp enters in struts' filter, it's read and each tag prefixed 
> by <s: (if such declared for struts tag use) is rewrite using the ftl 
> files in the template package. It's one of the core purposes and I 
> don't think it's a good idea to change this. I would rather recommend 
> you to modifiy the ftl instead or try not to use dojo by loocking at 
> the ftl. It seems that there is a way not to call dojo but another 
> mecanism with some parameter (but i'm not sure).
>
> You're welcome.
>
> Pablo Vázquez Blázquez a écrit :
>> I would prefer to call whatever struts calls to apply this template 
>> instead of changing it. Do you know how struts invokes this template?
>>
>> Thank you.
>>
>> Sébastien Domergue escribió:
>>> I finally found where struts call dojo. In struts' jar, check the 
>>> package template.simple. You'll find datetimepicker.ftl. This is the 
>>> base used by struts to generate HTML. The syntax is not very hard 
>>> and you'll easily see where dojo is called. If you want to modify 
>>> this, you can modify the inner ftl (use with caution) or build a new 
>>> external template. The problem when you create a template from 
>>> "simple" is that when you use all of the others, you call simple.
>>>
>>> Regards
>>>
>>> Sébastien
>>>
>>> Pablo Vázquez Blázquez a écrit :
>>>> Yes, that is my problem. Do you know how to do to get it? I don´t 
>>>> see where struts call dojo via javascript to parse the form...
>>>>
>>>> Thank you very much.
>>>>
>>>> Sébastien Domergue escribió:
>>>>> Sorry for the misunderstanding.
>>>>> The difference that you see between the form while loading and the 
>>>>> form loaded comes from dojo widget only. Struts rewrites the tag 
>>>>> <s:datetimepicker> with a call to dojo (in javascript) which is

>>>>> executed on the client side. You could find the process 
>>>>> construction in dojo's source (widget>DatePicker.js).
>>>>>
>>>>> Regards,
>>>>> Sébastien
>>>>>
>>>>> Pablo Vázquez Blázquez a écrit :
>>>>>> Thank you Sébastien, but this is not actually my issue, but when

>>>>>> does dojo do create the hidden inputs for each s:datetimepicker 
>>>>>> tag. (why if I have the form when loads and once it is loaded, 
>>>>>> they are different.)
>>>>>>
>>>>>> Sébastien Domergue escribió:
>>>>>>> Hello,
>>>>>>>
>>>>>>> We are using Struts 2 + Dojo too and it seems that 
>>>>>>> datetimepicker separate informations into a list with two 
>>>>>>> elements. The first one is the date and the second one is the
time.
>>>>>>> Nevertheless, we still have problems to repopulate our inputs

>>>>>>> after an action. So we "rebuild" Strings to render informations.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Sébastien
>>>>>>>
>>>>>>> Pablo Vázquez Blázquez a écrit :
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> I am using Struts 2.0.9 + dojo 0.4.
>>>>>>>>
>>>>>>>> I would like to know when dojo adds two hidden inputs for
each 
>>>>>>>> <s:datetimepicker> tag.
>>>>>>>>
>>>>>>>> I have a topic that is published when I load a form and when
I 
>>>>>>>> recieve the data and parse the form (type == "load"), it
has 
>>>>>>>> "N" elements. When the form is rendered, if I see it in the

>>>>>>>> DOM, it has N+2*m elements (where "m" is the number of  
>>>>>>>> s:datetimepicker tags the form has). So, why when I get the

>>>>>>>> form from the data response in the subscribed topic those
input 
>>>>>>>> tags are not present? When are they created?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------

>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------

>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------

>>>>>>>
>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>> ---------------------------------------------------------------------

>>>>>>
>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------

>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>> ------------------------------------------------------------------------ 
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message