You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Daniel Anguita O." <an...@austec.cl> on 2007/01/09 22:02:08 UTC

Ajax example with Tapestry 4.1.1(Dojo)

Anyone can help me to make this simple application works?
The idea is to make a button that when i click on it some DOM reload 
showing a message like "Ok. It works".
I first try with the *tapestry home page* example and i'm getting a 
dojo's error:

----------------------------------- Firefox shows ----------------
Big brother is watching you.
DEBUG: failed loading 
/Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget/html/ContentPane.js 
with error: [SyntaxError: XML tag name mismatch (expected HR), file: 
http://localhost:8080/RemoteControl/app?service=asset&path=%2Fdojo%2Fdojo.js, 
line: 96]
DEBUG: failed loading 
/Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget/html.js with error: 
[SyntaxError: XML tag name mismatch (expected HR), file: 
http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
line: 96]
DEBUG: failed loading 
/Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget.js with error: 
[SyntaxError: XML tag name mismatch (expected HR), file: 
http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
line: 96]
DEBUG: failed loading 
/Ajax/app?service=asset&path=%2Fdojo%2Fsrc/__package__.js with error: 
[SyntaxError: XML tag name mismatch (expected HR), file: 
http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
line: 96]
DEBUG: failed loading /Ajax/app?service=asset&path=%2Fdojo%2Fsrc.js with 
error: [SyntaxError: XML tag name mismatch (expected HR), file: 
http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
line: 96]
DEBUG: failed loading 
/Ajax/app?service=asset&path=%2Fdojo%2F__package__.js with error: 
[SyntaxError: XML tag name mismatch (expected HR), file: 
http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
line: 96]
FATAL: Could not load 'dojo.widget.html.ContentPane'; last tried 
'__package__.js'
DEBUG: failed loading 
/Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget/ContentPane.js with 
error: [Error: Could not load 'dojo.widget.html.ContentPane'; last tried 
'__package__.js', file: 
http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
line: 84]
DEBUG: failed loading 
/Ajax/app?service=asset&path=%2Fdojo%2F../tapestry/namespace.js with 
error: [TypeError: dojo.hostenv.moduleHasPrefix is not a function, file: 
http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
line: 116]
-------------------------------------------------------------------

I have three files, Home.java, Home.page and Home.html:
-----------Home.html----------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html     jwcid="@Shell"
        title="Ajax"
        ajaxEnabled="true"
        browserLogLevel="DEBUG">
<head>
<title>Ajax</title>
</head>
<body jwcid="@Body">
    <div id="myFavoriteDiv">Big brother is watching you.</div>
</body>
</html>
-----------------------------

------------Home.page------
<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.1//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_1.dtd">
<page-specification class="test.ttdev.ajax.Home">
</page-specification>
-----------------------------

-----------Home.java--------
package test.ttdev.ajax;

import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.annotations.EventListener;
// org.apache.tapestry.event.*;

public abstract class Home extends BasePage{
    @EventListener(elements = "myFavoriteDiv", events = "onmouseover")
    public void watchText()
    {
     System.out.println("Mouse over myFavoriteDiv");
    }
   
}
------------------------------


anyone knows what is wrong??? i tried everything (i guess)... but i keep 
getting that error. Tapestry thing works fine, but when i try tu use 
ajax i cant.
Thanks!


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Ajax example with Tapestry 4.1.1(Dojo)

Posted by Alexandru Dragomir <al...@gmail.com>.
Try removing the part

<head>
<title>Ajax</title>
<link jwcid="@Style" href="stylesheets/main.css" media="all"/>
</head>

from your template html file , because is already generated by the @Shell
component in the resulted html file.

Cheers,
Alex

On 1/10/07, Daniel Anguita O. <an...@austec.cl> wrote:
>
> Hi Mika
>
> Mika Tammilehto escribi�:
> > Hi Daniel
> >
> >> I wrote that to the page head and it's OK. I run the app and i don't
> >> get any error message... BUT, it doesnt works... the 'ajax-thing'
> >> dont do anything..
> >> What do you mean with : "same params apply for Shell-component as
> >> well". What Shell-component? sorry, but im learning :D
> >
> > The Shell component outputs the same script tags required for
> > dojo/ajax, but also the <html> as well as <head>, i.e. basically
> > everything required around the <body>.
> >
> >>
> >> im using the Firefox Console Error and it's everything all right now,
> >> but it doesnt works.
> >> to develope my app i'm using eclipse and tomcat for windows... I'm
> >> learning from the book "Enjoying Web Development with Tapestry".
> >>
> >> HELP! if you need to see the code just ask for it, please help!
> >>
> >
> > Maybe have a look at the html source that is rendered, e.g. if there
> > are onclick events on your DirectLinks etc.
> >
> > Did you set async="true" on the components (form, link)? Did you set
> > updateComponents="..."?
> >
> > Hope that helps you a little bit further!
> >
> > mika
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> This is what my:
> Class:---------------------------------------
> import org.apache.tapestry.html.BasePage;
> import org.apache.tapestry.annotations.EventListener;
> import org.apache.tapestry.event.*;
>
> public abstract class Ajax extends BasePage{
>
>     @EventListener(elements = "deDiv", events = "onclick", async=true)
>     public void watchText(BrowserEvent e)
>     {
>      System.out.println("Hola <script>alert('hola');</script>");
>     }
>
> }
> ---------------------------------------------
>
> Page:---------------------------------------
> <?xml version="1.0"?>
> <!DOCTYPE page-specification PUBLIC
> "-//Apache Software Foundation//Tapestry Specification 4.1//EN"
> "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_1.dtd">
> <page-specification class="austec.chileansky.remotecontrol.Ajax">
> </page-specification>
> --------------------------------------------
>
> Html---------------------------------------
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html jwcid="@Shell"
>     title="Ajax">
> <head>
> <title>Ajax</title>
> <link jwcid="@Style" href="stylesheets/main.css" media="all"/>
> </head>
> <body jwcid="@Body">
>     <div id="deDiv" class="box">Big brother is watching you.</div>
> </body>
> </html>
> --------------------------------------------
>
> and finally, the html rendered with Firefox:
>
> HTML Rendered---------------------------
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <!-- Application: RemoteControl -->
> <!-- Page: Ajax -->
> <!-- Generated: Wed Jan 10 17:50:45 CLST 2007 -->
> <html>
> <head>
> <meta name="generator" content="Tapestry Application Framework, version
> 4.1.1" />
> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
> <title>Ajax</title>
> <script type="text/javascript">djConfig =
>
> {"isDebug":true,"debugContainerId":"debug","baseRelativePath":"/RemoteControl/app?service=asset&path=%2Fdojo%2F","preventBackButtonFix":false,"parseWidgets":false,"locale":"es-ar"}
> </script>
>
> <script type="text/javascript"
> src="/RemoteControl/app?service=asset&path=%2Fdojo%2Fdojo.js"></script>
>
> <script type="text/javascript">
> dojo.registerModulePath("tapestry",
> "/RemoteControl/app?service=asset&path=%2Ftapestry%2F");
> </script>
> <script type="text/javascript"
>
> src="/RemoteControl/app?service=asset&path=%2Ftapestry%2Fcore.js"></script>
> <script type="text/javascript">
> dojo.require("dojo.logging.Logger");
> dojo.log.setLevel(dojo.log.getLevel("WARNING"));
> dojo.require("tapestry.namespace");
> </script>
> <link rel="stylesheet" type="text/css" media="all"
> href="stylesheets/main.css" />
> </head>
> <head>
> <title>Ajax</title>
>
> </head>
>
> <body id="Body">
> <script type="text/javascript"><!--
> dojo.require("tapestry.event");
> // --></script>
>
>         <div id="deDiv" class="box">Big brother is watching you.</div>
> <script type="text/javascript"><!--
> dojo.addOnLoad(function(e) {
> tapestry.cleanConnect(dojo.byId("deDiv"), "onclick", "event389921977");
>                 tapestry.event389921977=function(e){
>                     var content={beventname:"onclick"};
>                     tapestry.event.buildEventProperties(e, content);
>                     if (!content["beventtarget.id"])
> content["beventtarget.id"]="deDiv";
>
> tapestry.bind("/RemoteControl/app?page=Ajax&service=directevent",
> content);
>                 };
>                 dojo.event.connect(dojo.byId("deDiv"), "onclick",
> tapestry, "event389921977");});
> // --></script></body>
> -
> </html>
> <!-- Render time: ~ 78 ms -->
>
> --------------------------------------------
>
> Everything seems to be right and working... no error prompts and nothing
> bad...
> but, when i click de Div, nothing happens.. i can see that there's no
> "onclick" statement on my div, that I suppose tapestry have to insert..
> but it doesnt..
> or i have to put the onclick myself?.. with what paramas?.. etc... HELP!
>
> Cheers
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Ajax example with Tapestry 4.1.1(Dojo)

Posted by Mika Tammilehto <mi...@imis.ch>.
Hi Daniel

What Alexandru proposed is certainly right. All head-content is rendered 
by the Shell. To render additional stylesheet links, etc. you might 
provide them as params (assets) to the Shell.

However, I'm not sure if this extra head tag makes it not to work...

The onclick event is bound by the script rendered at the bottom of the 
page; you don't have to do this yourself:

 > dojo.addOnLoad(function(e) {
 > tapestry.cleanConnect(dojo.byId("deDiv"), "onclick","event389921977");

Is your event listener method called on server, i.e. is there any output 
in the server log? Are you trying to update the content of the div??? If 
so, try starting with a DirectLink on the page... something like this:
-----
<div jwcid="output@Any">
   <span jwcid="@Insert" value="ognl:text">output here</span>
</div>

<a href="#" jwcid="@DirectLink" listener="listener:update" async="true" 
updateComponents="ognl: { 'output' }">click here</a>
-----

and on the page's java class:

-----

public String getText() { return "Hello world"; }

public void update() {}

------

Cheers,
mika



Daniel Anguita O. wrote:
> Hi Mika
> 
> Mika Tammilehto escribió:
>> Hi Daniel
>>
>>> I wrote that to the page head and it's OK. I run the app and i don't 
>>> get any error message... BUT, it doesnt works... the 'ajax-thing' 
>>> dont do anything..
>>> What do you mean with : "same params apply for Shell-component as 
>>> well". What Shell-component? sorry, but im learning :D
>>
>> The Shell component outputs the same script tags required for 
>> dojo/ajax, but also the <html> as well as <head>, i.e. basically 
>> everything required around the <body>.
>>
>>>
>>> im using the Firefox Console Error and it's everything all right now, 
>>> but it doesnt works.
>>> to develope my app i'm using eclipse and tomcat for windows... I'm 
>>> learning from the book "Enjoying Web Development with Tapestry".
>>>
>>> HELP! if you need to see the code just ask for it, please help!
>>>
>>
>> Maybe have a look at the html source that is rendered, e.g. if there 
>> are onclick events on your DirectLinks etc.
>>
>> Did you set async="true" on the components (form, link)? Did you set 
>> updateComponents="..."?
>>
>> Hope that helps you a little bit further!
>>
>> mika
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> This is what my:
> Class:---------------------------------------
> import org.apache.tapestry.html.BasePage;
> import org.apache.tapestry.annotations.EventListener;
> import org.apache.tapestry.event.*;
> 
> public abstract class Ajax extends BasePage{
> 
>    @EventListener(elements = "deDiv", events = "onclick", async=true)
>    public void watchText(BrowserEvent e)
>    {
>     System.out.println("Hola <script>alert('hola');</script>");
>    }
> 
> }
> ---------------------------------------------
> 
> Page:---------------------------------------
> <?xml version="1.0"?>
> <!DOCTYPE page-specification PUBLIC
> "-//Apache Software Foundation//Tapestry Specification 4.1//EN"
> "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_1.dtd">
> <page-specification class="austec.chileansky.remotecontrol.Ajax">
> </page-specification>
> --------------------------------------------
> 
> Html---------------------------------------
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html jwcid="@Shell"
>    title="Ajax">
> <head>
> <title>Ajax</title>
> <link jwcid="@Style" href="stylesheets/main.css" media="all"/>
> </head>
> <body jwcid="@Body">
>    <div id="deDiv" class="box">Big brother is watching you.</div>
> </body>
> </html>
> --------------------------------------------
> 
> and finally, the html rendered with Firefox:
> 
> HTML Rendered---------------------------
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
> "http://www.w3.org/TR/html4/loose.dtd">
> <!-- Application: RemoteControl -->
> <!-- Page: Ajax -->
> <!-- Generated: Wed Jan 10 17:50:45 CLST 2007 -->
> <html>
> <head>
> <meta name="generator" content="Tapestry Application Framework, version 
> 4.1.1" />
> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
> <title>Ajax</title>
> <script type="text/javascript">djConfig = 
> {"isDebug":true,"debugContainerId":"debug","baseRelativePath":"/RemoteControl/app?service=asset&path=%2Fdojo%2F","preventBackButtonFix":false,"parseWidgets":false,"locale":"es-ar"} 
> </script>
> 
> <script type="text/javascript" 
> src="/RemoteControl/app?service=asset&path=%2Fdojo%2Fdojo.js"></script>
> 
> <script type="text/javascript">
> dojo.registerModulePath("tapestry", 
> "/RemoteControl/app?service=asset&path=%2Ftapestry%2F");
> </script>
> <script type="text/javascript" 
> src="/RemoteControl/app?service=asset&path=%2Ftapestry%2Fcore.js"></script>
> <script type="text/javascript">
> dojo.require("dojo.logging.Logger");
> dojo.log.setLevel(dojo.log.getLevel("WARNING"));
> dojo.require("tapestry.namespace");
> </script>
> <link rel="stylesheet" type="text/css" media="all" 
> href="stylesheets/main.css" />
> </head>
> <head>
> <title>Ajax</title>
> 
> </head>
> 
> <body id="Body">
> <script type="text/javascript"><!--
> dojo.require("tapestry.event");
> // --></script>
> 
>     <div id="deDiv" class="box">Big brother is watching you.</div>
> <script type="text/javascript"><!--
> dojo.addOnLoad(function(e) {
> tapestry.cleanConnect(dojo.byId("deDiv"), "onclick", "event389921977");
>                tapestry.event389921977=function(e){
>                    var content={beventname:"onclick"};
>                    tapestry.event.buildEventProperties(e, content);
>                    if (!content["beventtarget.id"]) 
> content["beventtarget.id"]="deDiv";
> 
> tapestry.bind("/RemoteControl/app?page=Ajax&service=directevent", content);
>                };
>                dojo.event.connect(dojo.byId("deDiv"), "onclick", 
> tapestry, "event389921977");});
> // --></script></body>
> -
> </html>
> <!-- Render time: ~ 78 ms -->
> 
> --------------------------------------------
> 
> Everything seems to be right and working... no error prompts and nothing
> bad...
> but, when i click de Div, nothing happens.. i can see that there's no
> "onclick" statement on my div, that I suppose tapestry have to insert..
> but it doesnt..
> or i have to put the onclick myself?.. with what paramas?.. etc... HELP!
> 
> Cheers
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Ajax example with Tapestry 4.1.1(Dojo)

Posted by "Daniel Anguita O." <an...@austec.cl>.
Hi Mika

Mika Tammilehto escribió:
> Hi Daniel
>
>> I wrote that to the page head and it's OK. I run the app and i don't 
>> get any error message... BUT, it doesnt works... the 'ajax-thing' 
>> dont do anything..
>> What do you mean with : "same params apply for Shell-component as 
>> well". What Shell-component? sorry, but im learning :D
>
> The Shell component outputs the same script tags required for 
> dojo/ajax, but also the <html> as well as <head>, i.e. basically 
> everything required around the <body>.
>
>>
>> im using the Firefox Console Error and it's everything all right now, 
>> but it doesnt works.
>> to develope my app i'm using eclipse and tomcat for windows... I'm 
>> learning from the book "Enjoying Web Development with Tapestry".
>>
>> HELP! if you need to see the code just ask for it, please help!
>>
>
> Maybe have a look at the html source that is rendered, e.g. if there 
> are onclick events on your DirectLinks etc.
>
> Did you set async="true" on the components (form, link)? Did you set 
> updateComponents="..."?
>
> Hope that helps you a little bit further!
>
> mika
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
This is what my:
Class:---------------------------------------
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.annotations.EventListener;
import org.apache.tapestry.event.*;

public abstract class Ajax extends BasePage{

    @EventListener(elements = "deDiv", events = "onclick", async=true)
    public void watchText(BrowserEvent e)
    {
     System.out.println("Hola <script>alert('hola');</script>");
    }

}
---------------------------------------------

Page:---------------------------------------
<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.1//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_1.dtd">
<page-specification class="austec.chileansky.remotecontrol.Ajax">
</page-specification>
--------------------------------------------

Html---------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html jwcid="@Shell"
    title="Ajax">
<head>
<title>Ajax</title>
<link jwcid="@Style" href="stylesheets/main.css" media="all"/>
</head>
<body jwcid="@Body">
    <div id="deDiv" class="box">Big brother is watching you.</div>
</body>
</html>
--------------------------------------------

and finally, the html rendered with Firefox:

HTML Rendered---------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<!-- Application: RemoteControl -->
<!-- Page: Ajax -->
<!-- Generated: Wed Jan 10 17:50:45 CLST 2007 -->
<html>
<head>
<meta name="generator" content="Tapestry Application Framework, version 
4.1.1" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>Ajax</title>
<script type="text/javascript">djConfig = 
{"isDebug":true,"debugContainerId":"debug","baseRelativePath":"/RemoteControl/app?service=asset&path=%2Fdojo%2F","preventBackButtonFix":false,"parseWidgets":false,"locale":"es-ar"} 
</script>

<script type="text/javascript" 
src="/RemoteControl/app?service=asset&path=%2Fdojo%2Fdojo.js"></script>

<script type="text/javascript">
dojo.registerModulePath("tapestry", 
"/RemoteControl/app?service=asset&path=%2Ftapestry%2F");
</script>
<script type="text/javascript" 
src="/RemoteControl/app?service=asset&path=%2Ftapestry%2Fcore.js"></script>
<script type="text/javascript">
dojo.require("dojo.logging.Logger");
dojo.log.setLevel(dojo.log.getLevel("WARNING"));
dojo.require("tapestry.namespace");
</script>
<link rel="stylesheet" type="text/css" media="all" 
href="stylesheets/main.css" />
</head>
<head>
<title>Ajax</title>

</head>

<body id="Body">
<script type="text/javascript"><!--
dojo.require("tapestry.event");
// --></script>

	<div id="deDiv" class="box">Big brother is watching you.</div>
<script type="text/javascript"><!--
dojo.addOnLoad(function(e) {
tapestry.cleanConnect(dojo.byId("deDiv"), "onclick", "event389921977");
                tapestry.event389921977=function(e){
                    var content={beventname:"onclick"};
                    tapestry.event.buildEventProperties(e, content);
                    if (!content["beventtarget.id"]) 
content["beventtarget.id"]="deDiv";
 
tapestry.bind("/RemoteControl/app?page=Ajax&service=directevent", content);
                };
                dojo.event.connect(dojo.byId("deDiv"), "onclick", 
tapestry, "event389921977");});
// --></script></body>
-
</html>
<!-- Render time: ~ 78 ms -->

--------------------------------------------

Everything seems to be right and working... no error prompts and nothing
bad...
but, when i click de Div, nothing happens.. i can see that there's no
"onclick" statement on my div, that I suppose tapestry have to insert..
but it doesnt..
or i have to put the onclick myself?.. with what paramas?.. etc... HELP!

Cheers



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Ajax example with Tapestry 4.1.1(Dojo)

Posted by Mika Tammilehto <mi...@imis.ch>.
Hi Daniel

> I wrote that to the page head and it's OK. I run the app and i don't get 
> any error message... BUT, it doesnt works... the 'ajax-thing' dont do 
> anything..
> What do you mean with : "same params apply for Shell-component as well". 
> What Shell-component? sorry, but im learning :D

The Shell component outputs the same script tags required for dojo/ajax, 
but also the <html> as well as <head>, i.e. basically everything 
required around the <body>.

> 
> im using the Firefox Console Error and it's everything all right now, 
> but it doesnt works.
> to develope my app i'm using eclipse and tomcat for windows... I'm 
> learning from the book "Enjoying Web Development with Tapestry".
> 
> HELP! if you need to see the code just ask for it, please help!
> 

Maybe have a look at the html source that is rendered, e.g. if there are 
onclick events on your DirectLinks etc.

Did you set async="true" on the components (form, link)? Did you set 
updateComponents="..."?

Hope that helps you a little bit further!

mika

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Ajax example with Tapestry 4.1.1(Dojo)

Posted by "Daniel Anguita O." <an...@austec.cl>.
Hi Mika!

Mika Tammilehto escribió:
> Hi Daniel
>
> In what environment is your application running? I had the same 
> problem that the classpath lookup failed for the dojo-assets when 
> deploying my webapp as part of an EAR in JBoss.
>
> You may change the dojo-assets to be looked up in application context 
> instead of classpath.
> In your page / component spec add:
>
> <asset name="tapestrySource"
>    path="context:/assets/static/tapestry/core.js" />
> <asset name="dojoSource"
>    path="context:/assets/static/dojo/dojo.js" />
> <asset name="dojoPath" path="context:/assets/static/dojo/" />
>
OK! this works fine.. but...

>
> In the page head:
>
> <script jwcid="@ScriptIncludes"
>    tapestrySource="asset:tapestrySource"
>    dojoSource="asset:dojoSource"
>    dojoPath="asset:dojoPath"></script>
>
> (same params apply for Shell-component as well)
>
I wrote that to the page head and it's OK. I run the app and i don't get 
any error message... BUT, it doesnt works... the 'ajax-thing' dont do 
anything..
What do you mean with : "same params apply for Shell-component as well". 
What Shell-component? sorry, but im learning :D

im using the Firefox Console Error and it's everything all right now, 
but it doesnt works.
to develope my app i'm using eclipse and tomcat for windows... I'm 
learning from the book "Enjoying Web Development with Tapestry".

HELP! if you need to see the code just ask for it, please help!

> Then unpack the tapestry-framework.jar and copy the folders "tapestry" 
> and "dojo" to webapps context for packaging.
>
> This worked for me.
>
> Cheers,
> mika
>
>
> Daniel Anguita O. wrote:
>> Anyone can help me to make this simple application works?
>> The idea is to make a button that when i click on it some DOM reload 
>> showing a message like "Ok. It works".
>> I first try with the *tapestry home page* example and i'm getting a 
>> dojo's error:
>>
>> ----------------------------------- Firefox shows ----------------
>> Big brother is watching you.
>> DEBUG: failed loading 
>> /Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget/html/ContentPane.js 
>> with error: [SyntaxError: XML tag name mismatch (expected HR), file: 
>> http://localhost:8080/RemoteControl/app?service=asset&path=%2Fdojo%2Fdojo.js, 
>> line: 96]
>> DEBUG: failed loading 
>> /Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget/html.js with error: 
>> [SyntaxError: XML tag name mismatch (expected HR), file: 
>> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
>> line: 96]
>> DEBUG: failed loading 
>> /Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget.js with error: 
>> [SyntaxError: XML tag name mismatch (expected HR), file: 
>> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
>> line: 96]
>> DEBUG: failed loading 
>> /Ajax/app?service=asset&path=%2Fdojo%2Fsrc/__package__.js with error: 
>> [SyntaxError: XML tag name mismatch (expected HR), file: 
>> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
>> line: 96]
>> DEBUG: failed loading /Ajax/app?service=asset&path=%2Fdojo%2Fsrc.js 
>> with error: [SyntaxError: XML tag name mismatch (expected HR), file: 
>> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
>> line: 96]
>> DEBUG: failed loading 
>> /Ajax/app?service=asset&path=%2Fdojo%2F__package__.js with error: 
>> [SyntaxError: XML tag name mismatch (expected HR), file: 
>> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
>> line: 96]
>> FATAL: Could not load 'dojo.widget.html.ContentPane'; last tried 
>> '__package__.js'
>> DEBUG: failed loading 
>> /Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget/ContentPane.js with 
>> error: [Error: Could not load 'dojo.widget.html.ContentPane'; last 
>> tried '__package__.js', file: 
>> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
>> line: 84]
>> DEBUG: failed loading 
>> /Ajax/app?service=asset&path=%2Fdojo%2F../tapestry/namespace.js with 
>> error: [TypeError: dojo.hostenv.moduleHasPrefix is not a function, 
>> file: 
>> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
>> line: 116]
>> -------------------------------------------------------------------
>>
>> I have three files, Home.java, Home.page and Home.html:
>> -----------Home.html----------
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html     jwcid="@Shell"
>>        title="Ajax"
>>        ajaxEnabled="true"
>>        browserLogLevel="DEBUG">
>> <head>
>> <title>Ajax</title>
>> </head>
>> <body jwcid="@Body">
>>    <div id="myFavoriteDiv">Big brother is watching you.</div>
>> </body>
>> </html>
>> -----------------------------
>>
>> ------------Home.page------
>> <?xml version="1.0"?>
>> <!DOCTYPE page-specification PUBLIC
>> "-//Apache Software Foundation//Tapestry Specification 4.1//EN"
>> "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_1.dtd">
>> <page-specification class="test.ttdev.ajax.Home">
>> </page-specification>
>> -----------------------------
>>
>> -----------Home.java--------
>> package test.ttdev.ajax;
>>
>> import org.apache.tapestry.html.BasePage;
>> import org.apache.tapestry.annotations.EventListener;
>> // org.apache.tapestry.event.*;
>>
>> public abstract class Home extends BasePage{
>>    @EventListener(elements = "myFavoriteDiv", events = "onmouseover")
>>    public void watchText()
>>    {
>>     System.out.println("Mouse over myFavoriteDiv");
>>    }
>>   }
>> ------------------------------
>>
>>
>> anyone knows what is wrong??? i tried everything (i guess)... but i 
>> keep getting that error. Tapestry thing works fine, but when i try tu 
>> use ajax i cant.
>> Thanks!
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Ajax example with Tapestry 4.1.1(Dojo)

Posted by Mika Tammilehto <mi...@imis.ch>.
Hi Daniel

In what environment is your application running? I had the same problem 
that the classpath lookup failed for the dojo-assets when deploying my 
webapp as part of an EAR in JBoss.

You may change the dojo-assets to be looked up in application context 
instead of classpath.
In your page / component spec add:

<asset name="tapestrySource"
    path="context:/assets/static/tapestry/core.js" />
<asset name="dojoSource"
    path="context:/assets/static/dojo/dojo.js" />
<asset name="dojoPath" path="context:/assets/static/dojo/" />


In the page head:

<script jwcid="@ScriptIncludes"
    tapestrySource="asset:tapestrySource"
    dojoSource="asset:dojoSource"
    dojoPath="asset:dojoPath"></script>

(same params apply for Shell-component as well)

Then unpack the tapestry-framework.jar and copy the folders "tapestry" 
and "dojo" to webapps context for packaging.

This worked for me.

Cheers,
mika


Daniel Anguita O. wrote:
> Anyone can help me to make this simple application works?
> The idea is to make a button that when i click on it some DOM reload 
> showing a message like "Ok. It works".
> I first try with the *tapestry home page* example and i'm getting a 
> dojo's error:
> 
> ----------------------------------- Firefox shows ----------------
> Big brother is watching you.
> DEBUG: failed loading 
> /Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget/html/ContentPane.js 
> with error: [SyntaxError: XML tag name mismatch (expected HR), file: 
> http://localhost:8080/RemoteControl/app?service=asset&path=%2Fdojo%2Fdojo.js, 
> line: 96]
> DEBUG: failed loading 
> /Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget/html.js with error: 
> [SyntaxError: XML tag name mismatch (expected HR), file: 
> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
> line: 96]
> DEBUG: failed loading 
> /Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget.js with error: 
> [SyntaxError: XML tag name mismatch (expected HR), file: 
> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
> line: 96]
> DEBUG: failed loading 
> /Ajax/app?service=asset&path=%2Fdojo%2Fsrc/__package__.js with error: 
> [SyntaxError: XML tag name mismatch (expected HR), file: 
> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
> line: 96]
> DEBUG: failed loading /Ajax/app?service=asset&path=%2Fdojo%2Fsrc.js with 
> error: [SyntaxError: XML tag name mismatch (expected HR), file: 
> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
> line: 96]
> DEBUG: failed loading 
> /Ajax/app?service=asset&path=%2Fdojo%2F__package__.js with error: 
> [SyntaxError: XML tag name mismatch (expected HR), file: 
> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
> line: 96]
> FATAL: Could not load 'dojo.widget.html.ContentPane'; last tried 
> '__package__.js'
> DEBUG: failed loading 
> /Ajax/app?service=asset&path=%2Fdojo%2Fsrc/widget/ContentPane.js with 
> error: [Error: Could not load 'dojo.widget.html.ContentPane'; last tried 
> '__package__.js', file: 
> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
> line: 84]
> DEBUG: failed loading 
> /Ajax/app?service=asset&path=%2Fdojo%2F../tapestry/namespace.js with 
> error: [TypeError: dojo.hostenv.moduleHasPrefix is not a function, file: 
> http://localhost:8080/Ajax/app?service=asset&path=%2Fdojo%2Fdojo.js, 
> line: 116]
> -------------------------------------------------------------------
> 
> I have three files, Home.java, Home.page and Home.html:
> -----------Home.html----------
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html     jwcid="@Shell"
>        title="Ajax"
>        ajaxEnabled="true"
>        browserLogLevel="DEBUG">
> <head>
> <title>Ajax</title>
> </head>
> <body jwcid="@Body">
>    <div id="myFavoriteDiv">Big brother is watching you.</div>
> </body>
> </html>
> -----------------------------
> 
> ------------Home.page------
> <?xml version="1.0"?>
> <!DOCTYPE page-specification PUBLIC
> "-//Apache Software Foundation//Tapestry Specification 4.1//EN"
> "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_1.dtd">
> <page-specification class="test.ttdev.ajax.Home">
> </page-specification>
> -----------------------------
> 
> -----------Home.java--------
> package test.ttdev.ajax;
> 
> import org.apache.tapestry.html.BasePage;
> import org.apache.tapestry.annotations.EventListener;
> // org.apache.tapestry.event.*;
> 
> public abstract class Home extends BasePage{
>    @EventListener(elements = "myFavoriteDiv", events = "onmouseover")
>    public void watchText()
>    {
>     System.out.println("Mouse over myFavoriteDiv");
>    }
>   }
> ------------------------------
> 
> 
> anyone knows what is wrong??? i tried everything (i guess)... but i keep 
> getting that error. Tapestry thing works fine, but when i try tu use 
> ajax i cant.
> Thanks!
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Tapestry 5 screencasts

Posted by Howard Lewis Ship <hl...@gmail.com>.
I'm touching a number of things inside Tapestry 5 right now to get ready for
the next screencast. Probably be a couple of weeks.

On 1/10/07, Jack Horror <su...@hotmail.com> wrote:
>
> The screencasts about Tapestry 5.0.0
> (http://tapestry.apache.org/tapestry5/screencast.html)
>
> made me look into the doc's & the code,
> and it's going to be a giant leap forward (since 2.3) ;-)
>
> thanx Howard
>
> _________________________________________________________________
> Type your favorite song. Get a customized station. Try MSN Radio powered
> by Pandora. http://radio.msn.com/?icid=T002MSN03A07001
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Tapestry 5 screencasts

Posted by Jack Horror <su...@hotmail.com>.
The screencasts about Tapestry 5.0.0
(http://tapestry.apache.org/tapestry5/screencast.html)

made me look into the doc's & the code,
and it's going to be a giant leap forward (since 2.3) ;-)

thanx Howard

_________________________________________________________________
Type your favorite song.  Get a customized station.  Try MSN Radio powered 
by Pandora. http://radio.msn.com/?icid=T002MSN03A07001


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org