Using XTiles component

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Using XTiles component

Surya Prakash
Hi,

 

I just started working with Tapestry and in my current project need to use
Tapestry with Ajax. I am trying to understand the working of XTiles
component and though I was able to send the request, not receiving any
response back. I am using the demo source given at t-deli.

 

Any help will be greatly appreciated.

 

Thanks in advance.

 

Surya

Reply | Threaded
Open this post in threaded view
|

<VERY STRANGE> Finding class path and all other details in HTML

Karthik Abram

I get a perfectly fine page on Mozilla Firefox 1.0.3, Tapestry 3.0.2. I
click browser back and then forward and I get a page which looks fine except
for this rendering of the class path, component names, properties, etc. etc.
Since it is appearing after the shell component's render time message, I'm
thinking this is some tapestry internal thing. Any takers? This doesn't
happen everytime - only now and then...

<!-- Render time: ~ 40 ms -->

ry/components/Foreach.jwc</li><li>context:/WEB-INF/components/table/PFTable.
jwc</li><li>classpath:/org/apache/tapestry/form/Form.jwc</li><li>classpath:/
org/apache/tapestry/form/PropertySelection.jwc</li><li>classpath:/org/apache
/tapestry/components/Block.jwc</li><li>classpath:/org/apache/tapestry/form/S
ubmit.jwc</li><li>context:/WEB-INF/components/app/page/AdvisorNavigation.jwc
</li><li>context:/WEB-INF/components/table/PFColumn.jwc</li></ul>]

</td></tr>
<tr
class="even"><th>org.apache.tapestry.StringsSource:Phoenix</th><td>org.apach
e.tapestry.engine.DefaultComponentMessagesSource@170eb94</td></tr>
<tr
class="odd"><th>org.apache.tapestry.TemplateSource:Phoenix</th><td>DefaultTe
mplateSource[844
tokens<ul><li>MultiKey[context:/WEB-INF/components/app/page/ShareholderNavig
ation.jwc, en_US] (267 tokens)
</li><li>MultiKey[context:/WEB-INF/components/archive/ArchiveSearchForm.jwc,
en_US] (43 tokens)
</li><li>MultiKey[context:/WEB-INF/components/app/page/Brand.jwc, en_US] (16
tokens)
</li><li>MultiKey[context:/WEB-INF/ClientSelector.jwc, en_US] (22 tokens)
</li><li>MultiKey[context:/WEB-INF/components/app/ErrorSummary.jwc, en_US]
(1 tokens)
</li><li>MultiKey[context:/WEB-INF/components/app/page/Blank.jwc, en_US] (12
tokens)
</li><li>MultiKey[context:/WEB-INF/pages/shareholder/archive/AccountStatemen
ts.page, en_US] (101 tokens)
</li><li>MultiKey[classpath:/org/apache/tapestry/html/ExceptionDisplay.jwc,
en_US] (36 tokens)
</li><li>MultiKey[classpath:/org/apache/tapestry/pages/Exception.page,
en_US] (15 tokens)
</li><li>MultiKey[context:/WEB-INF/components/app/page/AdvisorNavigation.jwc
, en_US] (327 tokens)
</li><li>MultiKey[context:/WEB-INF/components/app/PageHeader.jwc, en_US] (4
tokens)

</li></ul><br/>]</td></tr>
<tr
class="even"><th>org.apache.tapestry.global:Phoenix</th><td>com.acctaccess.u
i.common.Global@110f345</td></tr>
<tr class="odd"><th>weblogic.servlet.WebAppComponentMBean</th><td>[Caching
Stub]Proxy for
pros:ApplicationConfig=prds,Location=nea,Name=prds,Type=WebAppComponentConfi
g</td></tr>
<tr
class="even"><th>weblogic.servlet.WebAppComponentRuntimeMBean</th><td>weblog
ic.servlet.internal.WebAppRuntimeMBeanImpl:
p:ApplicationRuntime=neo_prs,Location=ne,Name=neo_neo_pro_prds,ServerRuntime
=na,Type=WebAppComponentRuntime
Set fields: [Name]
        Name -&gt; &lt;null&gt;
        Parent -&gt;
prds:Location=nea,Name=ne,ServerRuntime=nea,Type=ApplicationRuntime

</td></tr>
</table><span class="request-context-object">JVM System
Properties</span><table class="request-context-object"><tr
class="request-context-header"><th>Name</th><th>Value</th></tr><tr
class="even"><th>awt.toolkit</th><td>sun.awt.windows.WToolkit</td></tr>
<tr class="odd"><th>bea.home</th><td>C:\bea</td></tr>
<tr class="even"><th>file.encoding</th><td>Cp1252</td></tr>
<tr class="odd"><th>file.encoding.pkg</th><td>sun.io</td></tr>
<tr class="even"><th>file.separator</th><td>\</td></tr>

<tr
class="odd"><th>java.awt.graphicsenv</th><td>sun.awt.Win32GraphicsEnvironmen
t</td></tr>
<tr
class="even"><th>java.awt.printerjob</th><td>sun.awt.windows.WPrinterJob</td
></tr>
<tr class="odd"><th>java.class.path</th><td><ul><li/>C:\Program
Files\Java\j2re1.4.2_06\lib\tools.jar<li/>C:\bea\weblogic81\server\lib\weblo
gic_sp.jar<li/>C:\bea\weblogic81\server\lib\weblogic.jar<li/>C:\eclipse\work
space\Phoenix\pros\WEB-INF\classes<li/>C:\eclipse\plugins\com.iw.plugins.spi
ndle.core_0.1.17\lib\tapestry-3.0.2.jar<li/>C:\eclipse\plugins\com.iw.plugin
s.spindle.core_0.1.17\lib\tapestry-contrib-3.0.2.jar<li/>C:\eclipse\plugins\
com.iw.plugins.spindle.core_0.1.17\lib\ext\bsf-2.3.0.jar<li/>C:\eclipse\plug
ins\com.iw.plugins.spindle.core_0.1.17\lib\ext\commons-beanutils-1.6.1.jar<l
i/>C:\eclipse\plugins\com.iw.plugins.spindle.core_0.1.17\lib\ext\commons-cod
ec-1.2.jar


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Using XTiles component

Jamie Orchard-Hays
In reply to this post by Surya Prakash
Can you be more specific? It's hard to answer such a general question.

Surya Prakash wrote:

> Hi,
>
>  
>
> I just started working with Tapestry and in my current project need to use
> Tapestry with Ajax. I am trying to understand the working of XTiles
> component and though I was able to send the request, not receiving any
> response back. I am using the demo source given at t-deli.
>
>  
>
> Any help will be greatly appreciated.
>
>  
>
> Thanks in advance.
>
>  
>
> Surya
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Using XTiles component

Surya Prakash
In reply to this post by Surya Prakash
Hi,

Sorry for a bit vague.

Configuration:  JDK1.5, Tomcat 5.0, Tapestry 3.0.3, IE 6+, Firefox 1+,
Eclipse 3M7, Spindle, X-Tiles jar available from t-deli.com

Trying to replicate the X-Tiles demo given at given at T-Deli.com on the
local machine using above configuration.

Problem:  I downloaded the source code given at the t-deli site to display a
list of countries onkeyup script using Ajax.  The source I am using is given
below:
***********************************
Application file:

<application name="AjaxTest">
   
        <library id="xtile"
specification-path="/org/mb/tapestry/xtile/xtile.library"/>

</application>
************************************
Home Page
 
<html jwcid="@Shell" title="XTile example">
<body jwcid="@Body">
   
Start typing the name of a country in the field below. <br>
The page will connect to the server and ask for possible completions.
<p>
    <form name="f">
    <table cellspacing="0" cellpadding="0">
        <tr>
            <td>Country: </td>
            <td><input type="text" style="width: 200px"
onkeyup="sendValue(this.value)"/></td>
        </tr>
        <tr>
            <td></td>
            <td><textarea name="comps" rows="10" style="width: 200px"
></textarea></td>
        </tr>
    </table>
    </form>
   
    <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
        sendName="sendValue" receiveName="receiveCompletions"/>
   
    <script>
        function receiveCompletions(arr) {
        document.f.comps.value = arr.join("\n");
        }
    </script>
   
    <span jwcid="@xtile:Timeout"/>
</body>
</html>
****************************************************************

Home.java

package examples;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;

public class Home extends BasePage
{
        private final static int MAX_COMPLETIONS = 10;
       
        private static Set countries = new LinkedHashSet();
       
        static {
                System.out.println("Entered in static block");
                Locale[] locales = Locale.getAvailableLocales();
                for (int i = 0; i < locales.length; i++) {
                        String country = locales[i].getDisplayCountry();
                        if (country != null) {
                                //System.out.println("Country:"+country);
                                countries.add(country);
                        }
                }
        }

        private String[] findCompletions(String typed)
        {
                System.out.println("Entered in findCompletions and
typed:"+typed);
                if (typed.equals(""))
                        return null;
               
                typed = typed.toLowerCase();
               
                List completions = new ArrayList();
                for (Iterator it = countries.iterator(); it.hasNext();) {
                        String country = (String) it.next();
                        //System.out.println("Country:"+country);
                        if (country.toLowerCase().startsWith(typed)){
                                System.out.println("Added
country:"+country);
                                completions.add(country);
                        }
                        if (completions.size() == MAX_COMPLETIONS)
                                break;
                }
                Collections.sort(completions);
               
                return (String[]) completions.toArray(new
String[completions.size()]);
        }
       
       
        public void handleCallback(IRequestCycle cycle)
        {
                System.out.println("Entered in handleCallback");
                Object[] params = cycle.getServiceParameters();
                if (params.length == 0) return;
               
                String typed = params[0].toString();
                String[] ret = findCompletions(typed);
                for(int i=0; i<ret.length; i++){
                        System.out.println("return list:"+ret[i]);
                }
                cycle.setServiceParameters(ret);
        }
       
}
******************************************************

As shown in the source, the print statements are printing the list of
countries in the handleCallback and the returned String[] array ret is
correctly set to the service parameters, when I am typing a key but the list
is not shown in the text area in the html page.


Thanks in advance.

Surya


-----Original Message-----
From: Jamie [mailto:[hidden email]]
Sent: 10 May 2005 18:17
To: Tapestry users
Subject: Re: Using XTiles component

Can you be more specific? It's hard to answer such a general question.

Surya Prakash wrote:

> Hi,
>
>  
>
> I just started working with Tapestry and in my current project need to use
> Tapestry with Ajax. I am trying to understand the working of XTiles
> component and though I was able to send the request, not receiving any
> response back. I am using the demo source given at t-deli.
>
>  
>
> Any help will be greatly appreciated.
>
>  
>
> Thanks in advance.
>
>  
>
> Surya
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Using XTiles component

Mind Bridge
Hi,

The code seems okay on a first look, but here is one possible test. Change
    <script>
        function receiveCompletions(arr) {
        document.f.comps.value = arr.join("\n");
        }
    </script>

to sth like this

    <script>
        function receiveCompletions(arr) {
        alert(arr);
        }
    </script>

and see if you get any alerts with sth other than null. If you do then the
problem is with 'document.f.comps.value'. Otherwise receiveCompletions() is
not called at all. Is this specific to a particular browser?

----- Original Message -----
From: "Surya Prakash" <[hidden email]>
To: "Tapestry users" <[hidden email]>
Sent: Wednesday, May 11, 2005 11:33 AM
Subject: RE: Using XTiles component


> Hi,
>
> Sorry for a bit vague.
>
> Configuration:  JDK1.5, Tomcat 5.0, Tapestry 3.0.3, IE 6+, Firefox 1+,
> Eclipse 3M7, Spindle, X-Tiles jar available from t-deli.com
>
> Trying to replicate the X-Tiles demo given at given at T-Deli.com on the
> local machine using above configuration.
>
> Problem:  I downloaded the source code given at the t-deli site to display
a
> list of countries onkeyup script using Ajax.  The source I am using is
given

> below:
> ***********************************
> Application file:
>
> <application name="AjaxTest">
>
> <library id="xtile"
> specification-path="/org/mb/tapestry/xtile/xtile.library"/>
>
> </application>
> ************************************
> Home Page
>
> <html jwcid="@Shell" title="XTile example">
> <body jwcid="@Body">
>
> Start typing the name of a country in the field below. <br>
> The page will connect to the server and ask for possible completions.
> <p>
>     <form name="f">
>     <table cellspacing="0" cellpadding="0">
>         <tr>
>             <td>Country: </td>
>             <td><input type="text" style="width: 200px"
> onkeyup="sendValue(this.value)"/></td>
>         </tr>
>         <tr>
>             <td></td>
>             <td><textarea name="comps" rows="10" style="width: 200px"
> ></textarea></td>
>         </tr>
>     </table>
>     </form>
>
>     <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
>         sendName="sendValue" receiveName="receiveCompletions"/>
>
>     <script>
>         function receiveCompletions(arr) {
>         document.f.comps.value = arr.join("\n");
>         }
>     </script>
>
>     <span jwcid="@xtile:Timeout"/>
> </body>
> </html>
> ****************************************************************
>
> Home.java
>
> package examples;
>
> import java.util.ArrayList;
> import java.util.Collections;
> import java.util.Iterator;
> import java.util.LinkedHashSet;
> import java.util.List;
> import java.util.Locale;
> import java.util.Set;
>
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.html.BasePage;
>
> public class Home extends BasePage
> {
> private final static int MAX_COMPLETIONS = 10;
>
> private static Set countries = new LinkedHashSet();
>
> static {
> System.out.println("Entered in static block");
> Locale[] locales = Locale.getAvailableLocales();
> for (int i = 0; i < locales.length; i++) {
> String country = locales[i].getDisplayCountry();
> if (country != null) {
> //System.out.println("Country:"+country);
> countries.add(country);
> }
> }
> }
>
> private String[] findCompletions(String typed)
> {
> System.out.println("Entered in findCompletions and
> typed:"+typed);
> if (typed.equals(""))
> return null;
>
> typed = typed.toLowerCase();
>
> List completions = new ArrayList();
> for (Iterator it = countries.iterator(); it.hasNext();) {
> String country = (String) it.next();
> //System.out.println("Country:"+country);
> if (country.toLowerCase().startsWith(typed)){
> System.out.println("Added
> country:"+country);
> completions.add(country);
> }
> if (completions.size() == MAX_COMPLETIONS)
> break;
> }
> Collections.sort(completions);
>
> return (String[]) completions.toArray(new
> String[completions.size()]);
> }
>
>
> public void handleCallback(IRequestCycle cycle)
> {
> System.out.println("Entered in handleCallback");
> Object[] params = cycle.getServiceParameters();
> if (params.length == 0) return;
>
> String typed = params[0].toString();
> String[] ret = findCompletions(typed);
> for(int i=0; i<ret.length; i++){
> System.out.println("return list:"+ret[i]);
> }
> cycle.setServiceParameters(ret);
> }
>
> }
> ******************************************************
>
> As shown in the source, the print statements are printing the list of
> countries in the handleCallback and the returned String[] array ret is
> correctly set to the service parameters, when I am typing a key but the
list

> is not shown in the text area in the html page.
>
>
> Thanks in advance.
>
> Surya
>
>
> -----Original Message-----
> From: Jamie [mailto:[hidden email]]
> Sent: 10 May 2005 18:17
> To: Tapestry users
> Subject: Re: Using XTiles component
>
> Can you be more specific? It's hard to answer such a general question.
>
> Surya Prakash wrote:
> > Hi,
> >
> >
> >
> > I just started working with Tapestry and in my current project need to
use

> > Tapestry with Ajax. I am trying to understand the working of XTiles
> > component and though I was able to send the request, not receiving any
> > response back. I am using the demo source given at t-deli.
> >
> >
> >
> > Any help will be greatly appreciated.
> >
> >
> >
> > Thanks in advance.
> >
> >
> >
> > Surya
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Using XTiles component

Surya Prakash
In reply to this post by Surya Prakash
Hi,

That was my first try but could not get any alerts back.  As you said, it
seems, the receiveCompletions function is not being called at all and this
is not specific to any browser(I tried on IE, Firefox and Mozilla -- all
latest versions).

No clue what is going wrong and where?  I tried other similar tests with
functions like on mouse click, mouse over etc and the result is same, the
function is being called at the back end but no result is coming back to the
receive function.

Any help is greatly appreciated.

Thanks,
Surya

-----Original Message-----
From: Mind Bridge [mailto:[hidden email]]
Sent: 11 May 2005 23:53
To: Tapestry users
Subject: Re: Using XTiles component

Hi,

The code seems okay on a first look, but here is one possible test. Change
    <script>
        function receiveCompletions(arr) {
        document.f.comps.value = arr.join("\n");
        }
    </script>

to sth like this

    <script>
        function receiveCompletions(arr) {
        alert(arr);
        }
    </script>

and see if you get any alerts with sth other than null. If you do then the
problem is with 'document.f.comps.value'. Otherwise receiveCompletions() is
not called at all. Is this specific to a particular browser?

----- Original Message -----
From: "Surya Prakash" <[hidden email]>
To: "Tapestry users" <[hidden email]>
Sent: Wednesday, May 11, 2005 11:33 AM
Subject: RE: Using XTiles component


> Hi,
>
> Sorry for a bit vague.
>
> Configuration:  JDK1.5, Tomcat 5.0, Tapestry 3.0.3, IE 6+, Firefox 1+,
> Eclipse 3M7, Spindle, X-Tiles jar available from t-deli.com
>
> Trying to replicate the X-Tiles demo given at given at T-Deli.com on the
> local machine using above configuration.
>
> Problem:  I downloaded the source code given at the t-deli site to display
a
> list of countries onkeyup script using Ajax.  The source I am using is
given

> below:
> ***********************************
> Application file:
>
> <application name="AjaxTest">
>
> <library id="xtile"
> specification-path="/org/mb/tapestry/xtile/xtile.library"/>
>
> </application>
> ************************************
> Home Page
>
> <html jwcid="@Shell" title="XTile example">
> <body jwcid="@Body">
>
> Start typing the name of a country in the field below. <br>
> The page will connect to the server and ask for possible completions.
> <p>
>     <form name="f">
>     <table cellspacing="0" cellpadding="0">
>         <tr>
>             <td>Country: </td>
>             <td><input type="text" style="width: 200px"
> onkeyup="sendValue(this.value)"/></td>
>         </tr>
>         <tr>
>             <td></td>
>             <td><textarea name="comps" rows="10" style="width: 200px"
> ></textarea></td>
>         </tr>
>     </table>
>     </form>
>
>     <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
>         sendName="sendValue" receiveName="receiveCompletions"/>
>
>     <script>
>         function receiveCompletions(arr) {
>         document.f.comps.value = arr.join("\n");
>         }
>     </script>
>
>     <span jwcid="@xtile:Timeout"/>
> </body>
> </html>
> ****************************************************************
>
> Home.java
>
> package examples;
>
> import java.util.ArrayList;
> import java.util.Collections;
> import java.util.Iterator;
> import java.util.LinkedHashSet;
> import java.util.List;
> import java.util.Locale;
> import java.util.Set;
>
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.html.BasePage;
>
> public class Home extends BasePage
> {
> private final static int MAX_COMPLETIONS = 10;
>
> private static Set countries = new LinkedHashSet();
>
> static {
> System.out.println("Entered in static block");
> Locale[] locales = Locale.getAvailableLocales();
> for (int i = 0; i < locales.length; i++) {
> String country = locales[i].getDisplayCountry();
> if (country != null) {
> //System.out.println("Country:"+country);
> countries.add(country);
> }
> }
> }
>
> private String[] findCompletions(String typed)
> {
> System.out.println("Entered in findCompletions and
> typed:"+typed);
> if (typed.equals(""))
> return null;
>
> typed = typed.toLowerCase();
>
> List completions = new ArrayList();
> for (Iterator it = countries.iterator(); it.hasNext();) {
> String country = (String) it.next();
> //System.out.println("Country:"+country);
> if (country.toLowerCase().startsWith(typed)){
> System.out.println("Added
> country:"+country);
> completions.add(country);
> }
> if (completions.size() == MAX_COMPLETIONS)
> break;
> }
> Collections.sort(completions);
>
> return (String[]) completions.toArray(new
> String[completions.size()]);
> }
>
>
> public void handleCallback(IRequestCycle cycle)
> {
> System.out.println("Entered in handleCallback");
> Object[] params = cycle.getServiceParameters();
> if (params.length == 0) return;
>
> String typed = params[0].toString();
> String[] ret = findCompletions(typed);
> for(int i=0; i<ret.length; i++){
> System.out.println("return list:"+ret[i]);
> }
> cycle.setServiceParameters(ret);
> }
>
> }
> ******************************************************
>
> As shown in the source, the print statements are printing the list of
> countries in the handleCallback and the returned String[] array ret is
> correctly set to the service parameters, when I am typing a key but the
list

> is not shown in the text area in the html page.
>
>
> Thanks in advance.
>
> Surya
>
>
> -----Original Message-----
> From: Jamie [mailto:[hidden email]]
> Sent: 10 May 2005 18:17
> To: Tapestry users
> Subject: Re: Using XTiles component
>
> Can you be more specific? It's hard to answer such a general question.
>
> Surya Prakash wrote:
> > Hi,
> >
> >
> >
> > I just started working with Tapestry and in my current project need to
use

> > Tapestry with Ajax. I am trying to understand the working of XTiles
> > component and though I was able to send the request, not receiving any
> > response back. I am using the demo source given at t-deli.
> >
> >
> >
> > Any help will be greatly appreciated.
> >
> >
> >
> > Thanks in advance.
> >
> >
> >
> > Surya
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Using XTiles component

Surya Prakash
In reply to this post by Surya Prakash
Hi,

After a very good help from Mind Bridge, figured out what the problem is.
Just posting here, in case somebody encounters the same problem.

In the Tomcat lib, xalan jar file is not present and this is throwing an
error "javax.xml.transform.TransformerFactoryConfigurationError: Provider
org.apache.xalan.processor.TransformerFactoryImpl not found
        at javax.xml.transform.TransformerFactory.newInstance(Unknown
Source)
        at
org.mb.tapestry.xtile.XTileService.generateOutputString(XTileService.java:10
4)"

I placed the jar and it is working fine.

Excellent help and good work from the people over here.

Thanks once again.
Surya

-----Original Message-----
From: Surya Prakash
Sent: 11 May 2005 09:33
To: Tapestry users
Subject: RE: Using XTiles component

Hi,

Sorry for a bit vague.

Configuration:  JDK1.5, Tomcat 5.0, Tapestry 3.0.3, IE 6+, Firefox 1+,
Eclipse 3M7, Spindle, X-Tiles jar available from t-deli.com

Trying to replicate the X-Tiles demo given at given at T-Deli.com on the
local machine using above configuration.

Problem:  I downloaded the source code given at the t-deli site to display a
list of countries onkeyup script using Ajax.  The source I am using is given
below:
***********************************
Application file:

<application name="AjaxTest">
   
        <library id="xtile"
specification-path="/org/mb/tapestry/xtile/xtile.library"/>

</application>
************************************
Home Page
 
<html jwcid="@Shell" title="XTile example">
<body jwcid="@Body">
   
Start typing the name of a country in the field below. <br>
The page will connect to the server and ask for possible completions.
<p>
    <form name="f">
    <table cellspacing="0" cellpadding="0">
        <tr>
            <td>Country: </td>
            <td><input type="text" style="width: 200px"
onkeyup="sendValue(this.value)"/></td>
        </tr>
        <tr>
            <td></td>
            <td><textarea name="comps" rows="10" style="width: 200px"
></textarea></td>
        </tr>
    </table>
    </form>
   
    <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
        sendName="sendValue" receiveName="receiveCompletions"/>
   
    <script>
        function receiveCompletions(arr) {
        document.f.comps.value = arr.join("\n");
        }
    </script>
   
    <span jwcid="@xtile:Timeout"/>
</body>
</html>
****************************************************************

Home.java

package examples;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;

public class Home extends BasePage
{
        private final static int MAX_COMPLETIONS = 10;
       
        private static Set countries = new LinkedHashSet();
       
        static {
                System.out.println("Entered in static block");
                Locale[] locales = Locale.getAvailableLocales();
                for (int i = 0; i < locales.length; i++) {
                        String country = locales[i].getDisplayCountry();
                        if (country != null) {
                                //System.out.println("Country:"+country);
                                countries.add(country);
                        }
                }
        }

        private String[] findCompletions(String typed)
        {
                System.out.println("Entered in findCompletions and
typed:"+typed);
                if (typed.equals(""))
                        return null;
               
                typed = typed.toLowerCase();
               
                List completions = new ArrayList();
                for (Iterator it = countries.iterator(); it.hasNext();) {
                        String country = (String) it.next();
                        //System.out.println("Country:"+country);
                        if (country.toLowerCase().startsWith(typed)){
                                System.out.println("Added
country:"+country);
                                completions.add(country);
                        }
                        if (completions.size() == MAX_COMPLETIONS)
                                break;
                }
                Collections.sort(completions);
               
                return (String[]) completions.toArray(new
String[completions.size()]);
        }
       
       
        public void handleCallback(IRequestCycle cycle)
        {
                System.out.println("Entered in handleCallback");
                Object[] params = cycle.getServiceParameters();
                if (params.length == 0) return;
               
                String typed = params[0].toString();
                String[] ret = findCompletions(typed);
                for(int i=0; i<ret.length; i++){
                        System.out.println("return list:"+ret[i]);
                }
                cycle.setServiceParameters(ret);
        }
       
}
******************************************************

As shown in the source, the print statements are printing the list of
countries in the handleCallback and the returned String[] array ret is
correctly set to the service parameters, when I am typing a key but the list
is not shown in the text area in the html page.


Thanks in advance.

Surya


-----Original Message-----
From: Jamie [mailto:[hidden email]]
Sent: 10 May 2005 18:17
To: Tapestry users
Subject: Re: Using XTiles component

Can you be more specific? It's hard to answer such a general question.

Surya Prakash wrote:

> Hi,
>
>  
>
> I just started working with Tapestry and in my current project need to use
> Tapestry with Ajax. I am trying to understand the working of XTiles
> component and though I was able to send the request, not receiving any
> response back. I am using the demo source given at t-deli.
>
>  
>
> Any help will be greatly appreciated.
>
>  
>
> Thanks in advance.
>
>  
>
> Surya
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Using XTiles component

Mind Bridge
Hi,

I believe this implementation is included in Java 1.4 (and further), but it
is definitely missing in 1.3 and earlier and xalan.jar is necessary.
It is a good point that I had not considered -- will make a note on T-Deli.

Thank you,
- mb

----- Original Message -----
From: "Surya Prakash" <[hidden email]>
To: "Tapestry users" <[hidden email]>
Sent: Thursday, May 12, 2005 1:13 PM
Subject: RE: Using XTiles component


> Hi,
>
> After a very good help from Mind Bridge, figured out what the problem is.
> Just posting here, in case somebody encounters the same problem.
>
> In the Tomcat lib, xalan jar file is not present and this is throwing an
> error "javax.xml.transform.TransformerFactoryConfigurationError: Provider
> org.apache.xalan.processor.TransformerFactoryImpl not found
> at javax.xml.transform.TransformerFactory.newInstance(Unknown
> Source)
> at
>
org.mb.tapestry.xtile.XTileService.generateOutputString(XTileService.java:10

> 4)"
>
> I placed the jar and it is working fine.
>
> Excellent help and good work from the people over here.
>
> Thanks once again.
> Surya
>
> -----Original Message-----
> From: Surya Prakash
> Sent: 11 May 2005 09:33
> To: Tapestry users
> Subject: RE: Using XTiles component
>
> Hi,
>
> Sorry for a bit vague.
>
> Configuration:  JDK1.5, Tomcat 5.0, Tapestry 3.0.3, IE 6+, Firefox 1+,
> Eclipse 3M7, Spindle, X-Tiles jar available from t-deli.com
>
> Trying to replicate the X-Tiles demo given at given at T-Deli.com on the
> local machine using above configuration.
>
> Problem:  I downloaded the source code given at the t-deli site to display
a
> list of countries onkeyup script using Ajax.  The source I am using is
given

> below:
> ***********************************
> Application file:
>
> <application name="AjaxTest">
>
> <library id="xtile"
> specification-path="/org/mb/tapestry/xtile/xtile.library"/>
>
> </application>
> ************************************
> Home Page
>
> <html jwcid="@Shell" title="XTile example">
> <body jwcid="@Body">
>
> Start typing the name of a country in the field below. <br>
> The page will connect to the server and ask for possible completions.
> <p>
>     <form name="f">
>     <table cellspacing="0" cellpadding="0">
>         <tr>
>             <td>Country: </td>
>             <td><input type="text" style="width: 200px"
> onkeyup="sendValue(this.value)"/></td>
>         </tr>
>         <tr>
>             <td></td>
>             <td><textarea name="comps" rows="10" style="width: 200px"
> ></textarea></td>
>         </tr>
>     </table>
>     </form>
>
>     <span jwcid="@xtile:XTile" listener="ognl:listeners.handleCallback"
>         sendName="sendValue" receiveName="receiveCompletions"/>
>
>     <script>
>         function receiveCompletions(arr) {
>         document.f.comps.value = arr.join("\n");
>         }
>     </script>
>
>     <span jwcid="@xtile:Timeout"/>
> </body>
> </html>
> ****************************************************************
>
> Home.java
>
> package examples;
>
> import java.util.ArrayList;
> import java.util.Collections;
> import java.util.Iterator;
> import java.util.LinkedHashSet;
> import java.util.List;
> import java.util.Locale;
> import java.util.Set;
>
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.html.BasePage;
>
> public class Home extends BasePage
> {
> private final static int MAX_COMPLETIONS = 10;
>
> private static Set countries = new LinkedHashSet();
>
> static {
> System.out.println("Entered in static block");
> Locale[] locales = Locale.getAvailableLocales();
> for (int i = 0; i < locales.length; i++) {
> String country = locales[i].getDisplayCountry();
> if (country != null) {
> //System.out.println("Country:"+country);
> countries.add(country);
> }
> }
> }
>
> private String[] findCompletions(String typed)
> {
> System.out.println("Entered in findCompletions and
> typed:"+typed);
> if (typed.equals(""))
> return null;
>
> typed = typed.toLowerCase();
>
> List completions = new ArrayList();
> for (Iterator it = countries.iterator(); it.hasNext();) {
> String country = (String) it.next();
> //System.out.println("Country:"+country);
> if (country.toLowerCase().startsWith(typed)){
> System.out.println("Added
> country:"+country);
> completions.add(country);
> }
> if (completions.size() == MAX_COMPLETIONS)
> break;
> }
> Collections.sort(completions);
>
> return (String[]) completions.toArray(new
> String[completions.size()]);
> }
>
>
> public void handleCallback(IRequestCycle cycle)
> {
> System.out.println("Entered in handleCallback");
> Object[] params = cycle.getServiceParameters();
> if (params.length == 0) return;
>
> String typed = params[0].toString();
> String[] ret = findCompletions(typed);
> for(int i=0; i<ret.length; i++){
> System.out.println("return list:"+ret[i]);
> }
> cycle.setServiceParameters(ret);
> }
>
> }
> ******************************************************
>
> As shown in the source, the print statements are printing the list of
> countries in the handleCallback and the returned String[] array ret is
> correctly set to the service parameters, when I am typing a key but the
list

> is not shown in the text area in the html page.
>
>
> Thanks in advance.
>
> Surya
>
>
> -----Original Message-----
> From: Jamie [mailto:[hidden email]]
> Sent: 10 May 2005 18:17
> To: Tapestry users
> Subject: Re: Using XTiles component
>
> Can you be more specific? It's hard to answer such a general question.
>
> Surya Prakash wrote:
> > Hi,
> >
> >
> >
> > I just started working with Tapestry and in my current project need to
use

> > Tapestry with Ajax. I am trying to understand the working of XTiles
> > component and though I was able to send the request, not receiving any
> > response back. I am using the demo source given at t-deli.
> >
> >
> >
> > Any help will be greatly appreciated.
> >
> >
> >
> > Thanks in advance.
> >
> >
> >
> > Surya
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]