You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by am...@yahoo.com on 2005/11/08 23:22:08 UTC

Problem using 'Script' component

Hi,
 
I am new to Tapestry and I am having some problems with the Script component.
 
I get the an exception when I try to include a script. 
 
Here is my .html:
 
...

<body jwcid="@Body">

<span jwcid="insertFocusScript"/>

</body>
...
 
And my .page:
 
<page-specification>
...
    <component id="insertFocusScript" type="Script">
        <binding name="script" value="literal:/focus.script"/>
        <binding name="symbols" value="symbols"/>
    </component>
</page-specification>
 
Here is the excpetion:
 
org.apache.hivemind.ApplicationRuntimeExceptionUnable to parse script context:/focus.script.location:context:/focus.script, line 4, column 61
1<?xml version="1.0" encoding="UTF-8"?>2<!DOCTYPE page-specification PUBLIC3"-//Apache Software Foundation//Tapestry Specification 4.0//EN"4"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">5<script>6<input-symbol key="component" required="yes"/>7<body>8function setupFocus() {9${component}.focus();   org.apache.tapestry.util.xml.DocumentParseExceptionUnable to parse jndi:/localhost/ifd-dev/focus.script: jakarta.apache.orglocation:context:/focus.script, line 4, column 61
1<?xml version="1.0" encoding="UTF-8"?>2<!DOCTYPE page-specification PUBLIC3"-//Apache Software Foundation//Tapestry Specification 4.0//EN"4"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">5<script>6<input-symbol key="component" required="yes"/>7<body>8function setupFocus() {9${component}.focus(); 

I am using Tapestry 4.0 beta 12.

 

Thanks,

Amir

Re: Problem using 'Script' component

Posted by Philip Lopez <ta...@philiplopez.com>.
Amir,

Couldn't quite tell from your output, but check that the script has the 
following structure... notice the DOCTYPE ("script" and "3_0"). This is 
working for me in 4.0beta12.

hth
- Phil

<!DOCTYPE script PUBLIC
  "-//Apache Software Foundation//Tapestry Script Specification 3.0//EN"
        "http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">
<script>

<body>
	// functions
</body>

<initialization>
	// code to be run onload
</initialization>

</script>


On Wed, 9 Nov 2005 08:24, amirsguard-tapestry@yahoo.com wrote:
> Sorry,
>
> I forgot to mention that the script is located under the /WEB-INF
> directory.
>
> Thanks,
> Amir
>
> amirsguard-tapestry@yahoo.com wrote:
> Hi,
>
> I am new to Tapestry and I am having some problems with the Script
> component.
>
> I get the an exception when I try to include a script.
>
> Here is my .html:
>
> ...
>
>
>
>
>
>
> ...
>
> And my .page:
>
>
>
> ...
>
>
>
>
>
>
>
> Here is the excpetion:
>
> org.apache.hivemind.ApplicationRuntimeExceptionUnable to parse script
> context:/focus.script.location:context:/focus.script, line 4, column 61
> 1256 [input] 78function setupFocus() {9${component}.focus();  
> org.apache.tapestry.util.xml.DocumentParseExceptionUnable to parse
> jndi:/localhost/ifd-dev/focus.script:
> jakarta.apache.orglocation:context:/focus.script, line 4, column 61 1256
> [input] 78function setupFocus() {9${component}.focus();
>
> I am using Tapestry 4.0 beta 12.
>
>
>
> Thanks,
>
> Amir

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


Re: More problem using 'Script' component

Posted by am...@yahoo.com.
Ron,
 
I had the script element, the problem was that I had a servlet filter that had prevented its 
download, so it's all working now. Thanks!
 
-Amir


Ron Piterman <rp...@gmx.net> wrote:
look if there is a script element just after the 
something like
src="/port/app?digest=b4909c59529064c46eb8843b65911500&path=%2Forg%2Fapache%2Ftapestry%2Fform%2FForm.js&service=asset">

if there is not, then something is very wrong.
next try to remove your script and see if the problem is still there...
next post a reply... ;-)
Cheers,
Ron


ציטוט amirsguard-tapestry@yahoo.com:
> Hi Ron,
> 
> Yes I do have a 'loginForm', and a 'username' form element. The javascript error I get is "'Tapestry' is undefined" and when I look at the generated HTML I confirmed that it was not defined anywhere (the only references to 'Tapestry' object was in the generated function I had pasted earlier). 
> 
> Thanks,
> Amir
> 
> Ron Piterman wrote:
> This is the standard tapestry form javascript contribution. You surely 
> have a form on your page (called "loginForm" :) )
> Its strange that it generates a JS error - are you sure it this code? do 
> you overwrite the Tapestry object in your generated JS?
> Cheers,
> ROn
> 
> ציטוט amirsguard-tapestry@yahoo.com:
> 
>>Hi,
>>
>>
>>
>>I am including a 'Script' component in my page which renders fine (my function gets created 
>>
>>as planned). However, at the bottom of the HTML, the following gets generated:
>>
>>
>>
>>
>> setFocus(); // this is fine, the function I defined in my script file
>>
>> 
>>
>> Tapestry.register_form('loginForm'); 
>>
>> Tapestry.set_focus('username');
>>
>>// --> 
>>
>>
>>
>>The generated page knows nothing about a 'Tapestry' object so this creates a javascript
>>
>>error. I am not sure what or why this occurs.
>>
>>
>>
>>Thanks,
>>
>>Amir
>>
>>
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: More problem using 'Script' component

Posted by Ron Piterman <rp...@gmx.net>.
look if there is a script element just after the <body>
something like
<script type="text/javascript" 
src="/port/app?digest=b4909c59529064c46eb8843b65911500&amp;path=%2Forg%2Fapache%2Ftapestry%2Fform%2FForm.js&amp;service=asset"></script>

if there is not, then something is very wrong.
next try to remove your script and see if the problem is still there...
next post a reply... ;-)
Cheers,
Ron


ציטוט amirsguard-tapestry@yahoo.com:
> Hi Ron,
>  
> Yes I do have a 'loginForm', and a 'username' form element. The javascript error I get is "'Tapestry' is undefined" and when I look at the generated HTML I confirmed that it was not defined anywhere (the only references to 'Tapestry' object was in the generated function I had pasted earlier). 
>  
> Thanks,
> Amir
> 
> Ron Piterman <rp...@gmx.net> wrote:
> This is the standard tapestry form javascript contribution. You surely 
> have a form on your page (called "loginForm" :) )
> Its strange that it generates a JS error - are you sure it this code? do 
> you overwrite the Tapestry object in your generated JS?
> Cheers,
> ROn
> 
> ציטוט amirsguard-tapestry@yahoo.com:
> 
>>Hi,
>>
>>
>>
>>I am including a 'Script' component in my page which renders fine (my function gets created 
>>
>>as planned). However, at the bottom of the HTML, the following gets generated:
>>
>>
>>
>>
>>    setFocus(); // this is fine, the function I defined in my script file
>>
>>    
>>
>>    Tapestry.register_form('loginForm'); 
>>
>>    Tapestry.set_focus('username');
>>
>>// --> 
>>
>>
>>
>>The generated page knows nothing about a 'Tapestry' object so this creates a javascript
>>
>>error. I am not sure what or why this occurs.
>>
>>
>>
>>Thanks,
>>
>>Amir
>>
>>
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: More problem using 'Script' component

Posted by am...@yahoo.com.
Hi Ron,
 
Yes I do have a 'loginForm', and a 'username' form element. The javascript error I get is "'Tapestry' is undefined" and when I look at the generated HTML I confirmed that it was not defined anywhere (the only references to 'Tapestry' object was in the generated function I had pasted earlier). 
 
Thanks,
Amir

Ron Piterman <rp...@gmx.net> wrote:
This is the standard tapestry form javascript contribution. You surely 
have a form on your page (called "loginForm" :) )
Its strange that it generates a JS error - are you sure it this code? do 
you overwrite the Tapestry object in your generated JS?
Cheers,
ROn

ציטוט amirsguard-tapestry@yahoo.com:
> Hi,
> 
> 
> 
> I am including a 'Script' component in my page which renders fine (my function gets created 
> 
> as planned). However, at the bottom of the HTML, the following gets generated:
> 
> 
> 
>> 
>     setFocus(); // this is fine, the function I defined in my script file
> 
>     
> 
>     Tapestry.register_form('loginForm'); 
> 
>     Tapestry.set_focus('username');
> 
> // --> 
> 
> 
> 
> The generated page knows nothing about a 'Tapestry' object so this creates a javascript
> 
> error. I am not sure what or why this occurs.
> 
> 
> 
> Thanks,
> 
> Amir
> 
> 
> 
> 
> 


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


Re: More problem using 'Script' component

Posted by Ron Piterman <rp...@gmx.net>.
This is the standard tapestry form javascript contribution. You surely 
have a form on your page (called "loginForm" :) )
Its strange that it generates a JS error - are you sure it this code? do 
you overwrite the Tapestry object in your generated JS?
Cheers,
ROn

ציטוט amirsguard-tapestry@yahoo.com:
> Hi,
> 
>  
> 
> I am including a 'Script' component in my page which renders fine (my function gets created 
> 
> as planned). However, at the bottom of the HTML, the following gets generated:
> 
>  
> 
> <script language="JavaScript" type="text/javascript"><!--
> 
>     setFocus(); // this is fine, the function I defined in my script file
> 
>     
> 
>     Tapestry.register_form('loginForm'); 
> 
>     Tapestry.set_focus('username');
> 
> // --></script>
> 
>  
> 
> The generated page knows nothing about a 'Tapestry' object so this creates a javascript
> 
> error. I am not sure what or why this occurs.
> 
>  
> 
> Thanks,
> 
> Amir
> 
>  
> 
>  
> 


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


More problem using 'Script' component

Posted by am...@yahoo.com.
Hi,

 

I am including a 'Script' component in my page which renders fine (my function gets created 

as planned). However, at the bottom of the HTML, the following gets generated:

 

<script language="JavaScript" type="text/javascript"><!--

    setFocus(); // this is fine, the function I defined in my script file

    

    Tapestry.register_form('loginForm'); 

    Tapestry.set_focus('username');

// --></script>

 

The generated page knows nothing about a 'Tapestry' object so this creates a javascript

error. I am not sure what or why this occurs.

 

Thanks,

Amir

 

 

Re: Problem using 'Script' component

Posted by am...@yahoo.com.
Sorry,
 
I forgot to mention that the script is located under the /WEB-INF directory.
 
Thanks,
Amir

amirsguard-tapestry@yahoo.com wrote:
Hi,

I am new to Tapestry and I am having some problems with the Script component.

I get the an exception when I try to include a script. 

Here is my .html:

...






...

And my .page:



...







Here is the excpetion:

org.apache.hivemind.ApplicationRuntimeExceptionUnable to parse script context:/focus.script.location:context:/focus.script, line 4, column 61
1256 [input] 78function setupFocus() {9${component}.focus();   org.apache.tapestry.util.xml.DocumentParseExceptionUnable to parse jndi:/localhost/ifd-dev/focus.script: jakarta.apache.orglocation:context:/focus.script, line 4, column 61
1256 [input] 78function setupFocus() {9${component}.focus(); 

I am using Tapestry 4.0 beta 12.

 

Thanks,

Amir