What is happening is that there is an error on the request, probably the action mapping is wrong, and it is returning a page with the error, but that page has the same menu as showcase, that's why your are seeing it twice. Put the full url for the action on the address bar, after you get that to show the right page (what you expect to see in the div tag), then try the div.

musachy

walidito wrote:
I don't hink I'm adding anything.
Here is my code :
the action :
        public String execute() throws Exception
        {
                return SUCCESS;
        }

the struts.xml:

        <action name="AjaxTestAction"
class="dashboard.actions.AjaxTestAction">
                <result>/JSPs/Menu.jsp</result>
        </action>
and the jsp :
<head>
... <s:head theme="ajax" debug="false"/>
        ...
</head>
<body>
               <s:div
        id="once"
                cssStyle="border: 2px solid red;"
                href="%{ajaxTest}"
                 theme="ajax">
                                   hhookayy
                        </s:div>
</body>


I know it's working on the shwocase, but my app is not working... Since the
showcase action and struts sources are not available...
What I see on my screen is the "top" of jsp that is written twice, in fact,
the top html is loaded once (normal), but after the action call, the top is
written another time, I don't know why... Moreover, the eclipse console
displays the same error (dojo.transport) again and again...

Regards,
Walid




Musachy Barroso-2 wrote:
Are you sure you are not adding anything else to it and you are looking at the right one? I just check it out on showcase and it only loads once. Can you see if you have the same problem on showcase?

regards
musachy

walidito wrote:
Sorry but it didn't...
It loads it many times....


Musachy Barroso-2 wrote:
That needs to be fixed in struts, this is the jira ticket: https://issues.apache.org/struts/browse/WW-1551

from showcase:

<s:div
        id="once"
        theme="ajax"
        cssStyle="border: 1px solid yellow;"
        href="%{ajaxTest}">
    Initial Content</s:div>

That should load the div only once.

musachy

walidito wrote:
Hi,
Actually, I get this error both in my eclipse "console" and in my web
page
(debug enabled).
First of all here is the "jsp" code that I use:
    <s:div
                    id="reportDivId"
                cssStyle="border: 2px solid red;"
                href="/AjaxTestAction.do"
                    theme="ajax"
                    delay="3000"
                errorText="There was an error"
                loadingText="loading...">
                <s:property value="count"/> @ <s:property
value="serverTime"/>
<br/>
     </s:div>

 this is the redundant error that I get on my eclipse console :

-SEVERE: Error setting expr 'dojo.transport' with value
'[Ljava.lang.String;@e8f27e'
ognl.OgnlException: target is null for setProperty(null, "transport",
[Ljava.lang.String;@e8f27e)
        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1624)
        at ognl.ASTProperty.setValueBody(ASTProperty.java:105)
        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
                ...

and after a first call of the action I get this on my browser :
....
DEBUG:  widget ID collision on ID: reportDivId
...

I think this must come from the fact that with my code, I want (for the
moment) that the action is called only once, but in fact after the 3000
ms
delay, the action is called again, and it returns a success to the same
"<div id=reportDivId ...>", that's why there is a collision. Isn't it?

If so, what it is the way to make sure that my div tag doesn't recall
my
action more than once ?
Moreover, how come th samples of the Showcase does NOTprovide the
corresponding action and struts.xml files. Because it works on the
showcase,
so with the right code it should work "at home"

thanks.

Walid



Musachy Barroso-2 wrote:
You are seeing that error in your server logs right? There's a couple
of things that we still need to fix for this integration between Struts and Dojo, but the application should work anyway.

musachy

walidito wrote:
thanks, but I get an error with the code you gave me :
SEVERE: Error setting expr 'dojo.transport' with value
'[Ljava.lang.String;@179567c'
ognl.OgnlException: target is null for setProperty(null, "transport",
[Ljava.lang.String;@179567c)

thanks


Musachy Barroso-2 wrote:
I think you should take a look at the Struts2/Webwork tutorials http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and http://struts.apache.org/2.x/docs/tutorials.html

If you look at the showcase code you will see this for the AjaxTest
action:

in struts-ajax.xml:

<action name="AjaxTest" class="org.apache.struts2.showcase.ajax.AjaxTestAction">
    <result>/ajax/AjaxResult.jsp</result>
 </action>

in AjaxTestAction.java:

public class AjaxTestAction implements Action, Serializable {

    private static int counter = 0;
    private String data;

    public long getServerTime() {
        return System.currentTimeMillis();
    }

    public int getCount() {
        return ++counter;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String execute() throws Exception {
        return SUCCESS;
    }
}

and AjaxResult.jsp:

<%@ taglib prefix="s" uri="/struts-tags" %>

<%
    request.setAttribute("decorator", "none");
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>

Result: <s:property value="count"/> @ <s:property
value="serverTime"/>
<br/>
<s:property value="data"/>

musachy

walidito wrote:
I,
I wanna run this type of example app :
http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp :
<s:div
13:         id="once"
14:         theme="ajax"
15:         cssStyle="border: 1px solid yellow;"
16:         href="/AjaxTest.action"
17:         delay="5000"
18:         loadingText="loading...">
19:     Initial Content
</s:div>

In other word, a basic ajax component that allows a refreshment of
only
a
part of my page.

But I didn't get how to write the corresonding action and action
mapping. For the moment I've tried to put a "success" return in my action (
is
it
enough ?), but I don't see what to put in my action mapping (i mean
inside
the <action name="blablabla" ...> tag. If I put nothing, of course
it's
wrong.
If I only put a success-type result, It creates an infinite loop
(always
displays "loading").
Can sobdy help please?
---------------------------------------------------------------------
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]



---------------------------------------------------------------------
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]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to