You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken <ki...@gmail.com> on 2008/05/21 07:23:40 UTC

[T5] JavaScript in template files

Hi,

I wrote a template file like below:


<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<script type="text/javascript">
if (true && true) {
  alert("!!!");
}
</script>
</head>
</html>


and prepare empty Java file.
then I accessed to this page and got an error:


An unexpected application exception has occurred.

Failure parsing template classpath:com/example/myapp/Test.tml: The
entity name must immediately follow the '&' in the entity reference.


I'm using Tapestry 5.0.11.

somebody help me.
thanks.

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


Re: [T5] JavaScript in template files

Posted by Ken <ki...@gmail.com>.
Thanks Szemere!
It's works!

Szemere wote:
> Take a look at
> http://wiki.apache.org/tapestry/Tapestry5HowToIncludeJavaScript


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


Re: [T5] JavaScript in template files

Posted by Szemere Szemere <sz...@googlemail.com>.
Take a look at
http://wiki.apache.org/tapestry/Tapestry5HowToIncludeJavaScript

This explains how to do it.

Szemere

On Wed, May 21, 2008 at 6:23 AM, Ken <ki...@gmail.com> wrote:

> Hi,
>
> I wrote a template file like below:
>
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <head>
> <script type="text/javascript">
> if (true && true) {
>  alert("!!!");
> }
> </script>
> </head>
> </html>
>
>
> and prepare empty Java file.
> then I accessed to this page and got an error:
>
>
> An unexpected application exception has occurred.
>
> Failure parsing template classpath:com/example/myapp/Test.tml: The
> entity name must immediately follow the '&' in the entity reference.
>
>
> I'm using Tapestry 5.0.11.
>
> somebody help me.
> thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: [T5] JavaScript in template files

Posted by Ken <ki...@gmail.com>.
Thank you Chris.

After I prepare CDATA block, the error was gone.
But my firebug pointed as below and dialog doesn't work.

missing ) after condition
 if (true &amp;&amp; true) {\n

Anyway I think this is my homework.
I have to try a little.

thanks again!

Chris wrote:
> Ken,
> 
> You need to specify your script block as containing CDATA, like so:
> 
> <script type="text/javascript"><![CDATA[
> if(true && true) {
> alert("!!!");
> }
> ]]></script>
> 
> Tapestry treats templates as XML, and & is an invalid character unless
> processed as cdata.
> 
> chris

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


Re: [T5] JavaScript in template files

Posted by Chris Lewis <ch...@bellsouth.net>.
Ken,

You need to specify your script block as containing CDATA, like so:

<script type="text/javascript"><![CDATA[
if(true && true) {
alert("!!!");
}
]]></script>

Tapestry treats templates as XML, and & is an invalid character unless
processed as cdata.

chris

Ken wrote:
> Hi,
>
> I wrote a template file like below:
>
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <head>
> <script type="text/javascript">
> if (true && true) {
>   alert("!!!");
> }
> </script>
> </head>
> </html>
>
>
> and prepare empty Java file.
> then I accessed to this page and got an error:
>
>
> An unexpected application exception has occurred.
>
> Failure parsing template classpath:com/example/myapp/Test.tml: The
> entity name must immediately follow the '&' in the entity reference.
>
>
> I'm using Tapestry 5.0.11.
>
> somebody help me.
> thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>   

-- 
http://thegodcode.net


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