You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Deep Blue <de...@gmail.com> on 2006/12/07 15:34:31 UTC

Decision of whether to use tapestry

Hi,

My project has the following requirements:
1. It is a poll component that can be inserted in any page, at any place
that user like.
2. We don't have the control on how it should be display in the page, so,
cannot have one global template page (e.g. jsp) to insert inside the page.
But, we can specify some rules to tell the client how to put dynamic
behaviour to the poll section in the page. The poll can appear as a table,
or just plain text inside div. The appearance style of the poll should be
done directly inside the page.
3. Pages is composed by client, and they can add pages (with poll
inside) into the website from time to time. After they uploaded the page to
server, the dynamic section (poll) is supposed to work without doing any
configuration. It is sort of like plug and play concept.

May I know if Tapestry is suitable for the above requirement? If not, anyone
can suggest some better frameworks which can fullfill the requirement?

Thanks!!!

Best Regards,
Deep Blue

Re: Re: Decision of whether to use tapestry

Posted by Deep Blue <de...@gmail.com>.
One of the requirement that struts/tiles can never fulfill is the preview
ability of the page and flexibility of changing the layout. That's why I'm
trying to look into Tapestry if it allows me to do that. Thanks!

Best Regards,
Deep Blue


On 12/8/06, Sam Gendler <sg...@ideasculptor.com> wrote:
>
> Well, the asnwer to your question is still yes, but it isn't a
> 'normal' use of Tapestry much as it isn't obvious how to do it in
> struts, either. As a result, I'd recommend that you don't use
> Tapestry.  Given your tight schedule and lack of familiarity with the
> framework, I suspect you'll have a working application faster if you
> stick with what you know.
>
> --sam
>
>
> On 12/7/06, Deep Blue <de...@gmail.com> wrote:
> > Hi,
> >
> > Wow! Thanks for your reply! I didn't figure out that anyone will bother
> to
> > help me out as this is not a technical question.
> >
> > Actually, I haven't been expressed my question very well. Here are a few
> > points I like to clarify:
> > 1. The page that my client submit will eventually sit inside the the
> same
> > web application as the tapestry component (just copy the page into the
> > exploded folder under web application server). There will be only one
> web
> > application (pages that client submitted, together with the tapestry
> > component/code, service, persistence classes).
> > 2. Only one framework will be chosen. Currently I'm using Struts Tiles
> as
> > I'm familiar with struts, and it took a lot of pain to do this kind of
> > 'portlet' thing and it requires another template file to specify the
> look &
> > feel of the poll.
> > 3. I have a very tight schedule.. haha.. Therefore, I can't afford to
> learn
> > tapestry and throw it away. So, have to ask experts like you who have
> worked
> > with Tapestry before.
> >
> >
> > My question is, can tapestry do this kind of thing like:
> > Users are flexible to choose the layout, look & feel of the poll
> > It can be in a table:
> > <if display result>
> > <table>
> >   <tr jwcid="answer@Block">
> >      sample answer
> >   </tr>....</table>
> > </if>
> >
> > It can also be a plain text:
> > <if display result>
> > <span jwcid="answer@Block">      sample answer
> > </span>
> > </if>
> >
> > The page consists of the code above doesn't need extra configuration
> (eg. in
> > xml files) in order to use the component.
> >
> > Thanks alot!
> >
> >
> > Best Regards,
> > Guang Sheng
> >
> >
> > On 12/8/06, Sam Gendler <sg...@ideasculptor.com> wrote:
> > >
> > > I typed up a long response, but then reread your question and I think
> > > maybe I need some clarification. I included my original response below
> > > in case it answers your question. If you are looking for something
> > > that can be included in any page, rendered by any framework, then I'm
> > > not sure you really want to use Tapestry.  The only way you are going
> > > to build something that can be used absolutely anywhere is to render
> > > the poll entirely in html and javascript.  Take a look at dojo for
> > > examples of lots of widgets that can be used in any web page by simply
> > > including the correct js files.  However, dojo does leave the backend
> > > processing as an exercise for the user, rather than providing a
> > > service to handle storing and rendering user input.
> > >
> > > The difficult thing in your concept is submitting the results back to
> > > a server which will maintain totals and render them back to the
> > > browser, either graphically, or maybe just as a data structure that
> > > the browser can then use to render graphically.  Tapestry can be used
> > > to do this, fairly easily, but in general, Tapestry is a fairly
> > > stateful framework that is used for building applications rather than
> > > just widgets that can be inserted into other apps. You could implement
> > > an IExternalPage which receives the selected answer and poll id in the
> > > URL, stores the answer against the poll id, and serves up totals.  The
> > > only real caveat is that your tapestry-based pollserver is likely to
> > > be on a different host than the containing page, so you'll have to use
> > > cross domain techniques to allow tapestry to serve up js that can
> > > interact with the template provided in the containing page.  This is
> > > basically just a matter of serving up js as a string and then
> > > eval()'ing that string within the context of the containing document.
> > > There are lots of discussions of cross-domain js on the web, so I'll
> > > leave that to you to research.  You'd have the same problem with any
> > > framework you might choose to implement the backend in.
> > >
> > > Now, if you were just talking about building a tapestry poll component
> > > that can be used only in other Tapestry applications, the answer is
> > > definitely yes and I have a fairly detailed answer below:
> > >
> > > Yes, it is possible.  There are a lot of parallels between your
> > > component and the contrib:Table component that comes with Tapestry
> > > (although the table is likely to be much more complex).
> > >
> > > Just to give you some concepts to refer to in your research, here's
> > > brief outline if what you'd likely do.
> > >
> > > Create a poll component that takes some data structure that defines
> > > the poll and the current results (assuming you also want to display
> > > results there). The poll component iterates over each poll answer
> > > rendering an @Block component that is provided by the page template.
> > > The @Block component contains all of the template code necessary to
> > > render a single answer of the poll.  If the user wants a table, they
> > > open the table tag in their template, then include an @Block component
> > > which renders a single table row (or column, depending upon
> > > preference).  You can use a different Block component to render a link
> > > to the results, a submit button, or anything else you care for.
> > >
> > > If you provide reasonable defaults, many users will never have to
> > > define a Block at all in order to use your poll.  Your component is
> > > only responsible for providing default layout and data structures, but
> > > everything is overloadable via Blocks.  Something like the following
> > > (I'll use a list this time, just to show the difference):
> > >
> > > <ul jwcid="myPoll@Poll" questions="ognl:answers"
> > > index="ognl:currentanswer" element="literal:ul">
> > >    <span jwcid="answer@Block">
> > >        <li><span jwcid="@Insert" value="ognl:currentAnswer"/></li>
> > >    </span>
> > > </ul>
> > >
> > > My little example above excludes the actual selection mechanism,
> > > submit button, or results display, but all of that is easy enough.
> > > You might find that your default 'Poll' component consists of multiple
> > > sub components - PollView, PollResults, PollSubmit. The little sample
> > > above is probably actually a PollView component which would be wrapped
> > > the Poll component.  The PollView, PollResults, and PollSubmit can be
> > > placed in different locations, relative to each other, by simply
> > > replacing the outer Poll layer, or by using them without an outer Poll
> > > layer.  This is exactly how the table component works, using a
> > > TableView to render the table, a TablePages component to render the
> > > page changing mechanism.  The TableView itself consists of
> > > TableColumns, TableRows, etc.
> > >
> > > OK, assuming you are a tapestry novice, that probably went WAY over
> > > your head.  However, it will hopefully give you some keywords to watch
> > > out for as you read documentation.  I recommend that you read the
> > > first 4 chapters of the Enjoy Web Development with Tapestry ebook that
> > > is linked from the tapestry home page.  You should also check out the
> > > tapestry tables tutorial webapp and then look at the source code to
> > > contrib:Table.  You could probably read through all of that in a long
> > > day, if you don't actually implement any of the tutorial code, anyway.
> > > At the end of it, you should have a pretty good idea how to go about
> > > building your component, even though you'll still have a steep lerning
> > > curve to get through before you can actually get it working.
> > >
> > > --sam
> > >
> > > On 12/7/06, Deep Blue <de...@gmail.com> wrote:
> > > > Hi,
> > > >
> > > > My project has the following requirements:
> > > > 1. It is a poll component that can be inserted in any page, at any
> place
> > > > that user like.
> > > > 2. We don't have the control on how it should be display in the
> page,
> > > so,
> > > > cannot have one global template page (e.g. jsp) to insert inside the
> > > page.
> > > > But, we can specify some rules to tell the client how to put dynamic
> > > > behaviour to the poll section in the page. The poll can appear as a
> > > table,
> > > > or just plain text inside div. The appearance style of the poll
> should
> > > be
> > > > done directly inside the page.
> > > > 3. Pages is composed by client, and they can add pages (with poll
> > > > inside) into the website from time to time. After they uploaded the
> page
> > > to
> > > > server, the dynamic section (poll) is supposed to work without doing
> any
> > > > configuration. It is sort of like plug and play concept.
> > > >
> > > > May I know if Tapestry is suitable for the above requirement? If
> not,
> > > anyone
> > > > can suggest some better frameworks which can fullfill the
> requirement?
> > > >
> > > > Thanks!!!
> > > >
> > > > Best Regards,
> > > > Deep Blue
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > 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: Re: Decision of whether to use tapestry

Posted by Sam Gendler <sg...@ideasculptor.com>.
Well, the asnwer to your question is still yes, but it isn't a
'normal' use of Tapestry much as it isn't obvious how to do it in
struts, either. As a result, I'd recommend that you don't use
Tapestry.  Given your tight schedule and lack of familiarity with the
framework, I suspect you'll have a working application faster if you
stick with what you know.

--sam


On 12/7/06, Deep Blue <de...@gmail.com> wrote:
> Hi,
>
> Wow! Thanks for your reply! I didn't figure out that anyone will bother to
> help me out as this is not a technical question.
>
> Actually, I haven't been expressed my question very well. Here are a few
> points I like to clarify:
> 1. The page that my client submit will eventually sit inside the the same
> web application as the tapestry component (just copy the page into the
> exploded folder under web application server). There will be only one web
> application (pages that client submitted, together with the tapestry
> component/code, service, persistence classes).
> 2. Only one framework will be chosen. Currently I'm using Struts Tiles as
> I'm familiar with struts, and it took a lot of pain to do this kind of
> 'portlet' thing and it requires another template file to specify the look &
> feel of the poll.
> 3. I have a very tight schedule.. haha.. Therefore, I can't afford to learn
> tapestry and throw it away. So, have to ask experts like you who have worked
> with Tapestry before.
>
>
> My question is, can tapestry do this kind of thing like:
> Users are flexible to choose the layout, look & feel of the poll
> It can be in a table:
> <if display result>
> <table>
>   <tr jwcid="answer@Block">
>      sample answer
>   </tr>....</table>
> </if>
>
> It can also be a plain text:
> <if display result>
> <span jwcid="answer@Block">      sample answer
> </span>
> </if>
>
> The page consists of the code above doesn't need extra configuration (eg. in
> xml files) in order to use the component.
>
> Thanks alot!
>
>
> Best Regards,
> Guang Sheng
>
>
> On 12/8/06, Sam Gendler <sg...@ideasculptor.com> wrote:
> >
> > I typed up a long response, but then reread your question and I think
> > maybe I need some clarification. I included my original response below
> > in case it answers your question. If you are looking for something
> > that can be included in any page, rendered by any framework, then I'm
> > not sure you really want to use Tapestry.  The only way you are going
> > to build something that can be used absolutely anywhere is to render
> > the poll entirely in html and javascript.  Take a look at dojo for
> > examples of lots of widgets that can be used in any web page by simply
> > including the correct js files.  However, dojo does leave the backend
> > processing as an exercise for the user, rather than providing a
> > service to handle storing and rendering user input.
> >
> > The difficult thing in your concept is submitting the results back to
> > a server which will maintain totals and render them back to the
> > browser, either graphically, or maybe just as a data structure that
> > the browser can then use to render graphically.  Tapestry can be used
> > to do this, fairly easily, but in general, Tapestry is a fairly
> > stateful framework that is used for building applications rather than
> > just widgets that can be inserted into other apps. You could implement
> > an IExternalPage which receives the selected answer and poll id in the
> > URL, stores the answer against the poll id, and serves up totals.  The
> > only real caveat is that your tapestry-based pollserver is likely to
> > be on a different host than the containing page, so you'll have to use
> > cross domain techniques to allow tapestry to serve up js that can
> > interact with the template provided in the containing page.  This is
> > basically just a matter of serving up js as a string and then
> > eval()'ing that string within the context of the containing document.
> > There are lots of discussions of cross-domain js on the web, so I'll
> > leave that to you to research.  You'd have the same problem with any
> > framework you might choose to implement the backend in.
> >
> > Now, if you were just talking about building a tapestry poll component
> > that can be used only in other Tapestry applications, the answer is
> > definitely yes and I have a fairly detailed answer below:
> >
> > Yes, it is possible.  There are a lot of parallels between your
> > component and the contrib:Table component that comes with Tapestry
> > (although the table is likely to be much more complex).
> >
> > Just to give you some concepts to refer to in your research, here's
> > brief outline if what you'd likely do.
> >
> > Create a poll component that takes some data structure that defines
> > the poll and the current results (assuming you also want to display
> > results there). The poll component iterates over each poll answer
> > rendering an @Block component that is provided by the page template.
> > The @Block component contains all of the template code necessary to
> > render a single answer of the poll.  If the user wants a table, they
> > open the table tag in their template, then include an @Block component
> > which renders a single table row (or column, depending upon
> > preference).  You can use a different Block component to render a link
> > to the results, a submit button, or anything else you care for.
> >
> > If you provide reasonable defaults, many users will never have to
> > define a Block at all in order to use your poll.  Your component is
> > only responsible for providing default layout and data structures, but
> > everything is overloadable via Blocks.  Something like the following
> > (I'll use a list this time, just to show the difference):
> >
> > <ul jwcid="myPoll@Poll" questions="ognl:answers"
> > index="ognl:currentanswer" element="literal:ul">
> >    <span jwcid="answer@Block">
> >        <li><span jwcid="@Insert" value="ognl:currentAnswer"/></li>
> >    </span>
> > </ul>
> >
> > My little example above excludes the actual selection mechanism,
> > submit button, or results display, but all of that is easy enough.
> > You might find that your default 'Poll' component consists of multiple
> > sub components - PollView, PollResults, PollSubmit. The little sample
> > above is probably actually a PollView component which would be wrapped
> > the Poll component.  The PollView, PollResults, and PollSubmit can be
> > placed in different locations, relative to each other, by simply
> > replacing the outer Poll layer, or by using them without an outer Poll
> > layer.  This is exactly how the table component works, using a
> > TableView to render the table, a TablePages component to render the
> > page changing mechanism.  The TableView itself consists of
> > TableColumns, TableRows, etc.
> >
> > OK, assuming you are a tapestry novice, that probably went WAY over
> > your head.  However, it will hopefully give you some keywords to watch
> > out for as you read documentation.  I recommend that you read the
> > first 4 chapters of the Enjoy Web Development with Tapestry ebook that
> > is linked from the tapestry home page.  You should also check out the
> > tapestry tables tutorial webapp and then look at the source code to
> > contrib:Table.  You could probably read through all of that in a long
> > day, if you don't actually implement any of the tutorial code, anyway.
> > At the end of it, you should have a pretty good idea how to go about
> > building your component, even though you'll still have a steep lerning
> > curve to get through before you can actually get it working.
> >
> > --sam
> >
> > On 12/7/06, Deep Blue <de...@gmail.com> wrote:
> > > Hi,
> > >
> > > My project has the following requirements:
> > > 1. It is a poll component that can be inserted in any page, at any place
> > > that user like.
> > > 2. We don't have the control on how it should be display in the page,
> > so,
> > > cannot have one global template page (e.g. jsp) to insert inside the
> > page.
> > > But, we can specify some rules to tell the client how to put dynamic
> > > behaviour to the poll section in the page. The poll can appear as a
> > table,
> > > or just plain text inside div. The appearance style of the poll should
> > be
> > > done directly inside the page.
> > > 3. Pages is composed by client, and they can add pages (with poll
> > > inside) into the website from time to time. After they uploaded the page
> > to
> > > server, the dynamic section (poll) is supposed to work without doing any
> > > configuration. It is sort of like plug and play concept.
> > >
> > > May I know if Tapestry is suitable for the above requirement? If not,
> > anyone
> > > can suggest some better frameworks which can fullfill the requirement?
> > >
> > > Thanks!!!
> > >
> > > Best Regards,
> > > Deep Blue
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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: Decision of whether to use tapestry

Posted by Deep Blue <de...@gmail.com>.
Hi,

Wow! Thanks for your reply! I didn't figure out that anyone will bother to
help me out as this is not a technical question.

Actually, I haven't been expressed my question very well. Here are a few
points I like to clarify:
1. The page that my client submit will eventually sit inside the the same
web application as the tapestry component (just copy the page into the
exploded folder under web application server). There will be only one web
application (pages that client submitted, together with the tapestry
component/code, service, persistence classes).
2. Only one framework will be chosen. Currently I'm using Struts Tiles as
I'm familiar with struts, and it took a lot of pain to do this kind of
'portlet' thing and it requires another template file to specify the look &
feel of the poll.
3. I have a very tight schedule.. haha.. Therefore, I can't afford to learn
tapestry and throw it away. So, have to ask experts like you who have worked
with Tapestry before.


My question is, can tapestry do this kind of thing like:
Users are flexible to choose the layout, look & feel of the poll
It can be in a table:
<if display result>
<table>
  <tr jwcid="answer@Block">
     sample answer
  </tr>....</table>
</if>

It can also be a plain text:
<if display result>
<span jwcid="answer@Block">      sample answer
</span>
</if>

The page consists of the code above doesn't need extra configuration (eg. in
xml files) in order to use the component.

Thanks alot!


Best Regards,
Guang Sheng


On 12/8/06, Sam Gendler <sg...@ideasculptor.com> wrote:
>
> I typed up a long response, but then reread your question and I think
> maybe I need some clarification. I included my original response below
> in case it answers your question. If you are looking for something
> that can be included in any page, rendered by any framework, then I'm
> not sure you really want to use Tapestry.  The only way you are going
> to build something that can be used absolutely anywhere is to render
> the poll entirely in html and javascript.  Take a look at dojo for
> examples of lots of widgets that can be used in any web page by simply
> including the correct js files.  However, dojo does leave the backend
> processing as an exercise for the user, rather than providing a
> service to handle storing and rendering user input.
>
> The difficult thing in your concept is submitting the results back to
> a server which will maintain totals and render them back to the
> browser, either graphically, or maybe just as a data structure that
> the browser can then use to render graphically.  Tapestry can be used
> to do this, fairly easily, but in general, Tapestry is a fairly
> stateful framework that is used for building applications rather than
> just widgets that can be inserted into other apps. You could implement
> an IExternalPage which receives the selected answer and poll id in the
> URL, stores the answer against the poll id, and serves up totals.  The
> only real caveat is that your tapestry-based pollserver is likely to
> be on a different host than the containing page, so you'll have to use
> cross domain techniques to allow tapestry to serve up js that can
> interact with the template provided in the containing page.  This is
> basically just a matter of serving up js as a string and then
> eval()'ing that string within the context of the containing document.
> There are lots of discussions of cross-domain js on the web, so I'll
> leave that to you to research.  You'd have the same problem with any
> framework you might choose to implement the backend in.
>
> Now, if you were just talking about building a tapestry poll component
> that can be used only in other Tapestry applications, the answer is
> definitely yes and I have a fairly detailed answer below:
>
> Yes, it is possible.  There are a lot of parallels between your
> component and the contrib:Table component that comes with Tapestry
> (although the table is likely to be much more complex).
>
> Just to give you some concepts to refer to in your research, here's
> brief outline if what you'd likely do.
>
> Create a poll component that takes some data structure that defines
> the poll and the current results (assuming you also want to display
> results there). The poll component iterates over each poll answer
> rendering an @Block component that is provided by the page template.
> The @Block component contains all of the template code necessary to
> render a single answer of the poll.  If the user wants a table, they
> open the table tag in their template, then include an @Block component
> which renders a single table row (or column, depending upon
> preference).  You can use a different Block component to render a link
> to the results, a submit button, or anything else you care for.
>
> If you provide reasonable defaults, many users will never have to
> define a Block at all in order to use your poll.  Your component is
> only responsible for providing default layout and data structures, but
> everything is overloadable via Blocks.  Something like the following
> (I'll use a list this time, just to show the difference):
>
> <ul jwcid="myPoll@Poll" questions="ognl:answers"
> index="ognl:currentanswer" element="literal:ul">
>    <span jwcid="answer@Block">
>        <li><span jwcid="@Insert" value="ognl:currentAnswer"/></li>
>    </span>
> </ul>
>
> My little example above excludes the actual selection mechanism,
> submit button, or results display, but all of that is easy enough.
> You might find that your default 'Poll' component consists of multiple
> sub components - PollView, PollResults, PollSubmit. The little sample
> above is probably actually a PollView component which would be wrapped
> the Poll component.  The PollView, PollResults, and PollSubmit can be
> placed in different locations, relative to each other, by simply
> replacing the outer Poll layer, or by using them without an outer Poll
> layer.  This is exactly how the table component works, using a
> TableView to render the table, a TablePages component to render the
> page changing mechanism.  The TableView itself consists of
> TableColumns, TableRows, etc.
>
> OK, assuming you are a tapestry novice, that probably went WAY over
> your head.  However, it will hopefully give you some keywords to watch
> out for as you read documentation.  I recommend that you read the
> first 4 chapters of the Enjoy Web Development with Tapestry ebook that
> is linked from the tapestry home page.  You should also check out the
> tapestry tables tutorial webapp and then look at the source code to
> contrib:Table.  You could probably read through all of that in a long
> day, if you don't actually implement any of the tutorial code, anyway.
> At the end of it, you should have a pretty good idea how to go about
> building your component, even though you'll still have a steep lerning
> curve to get through before you can actually get it working.
>
> --sam
>
> On 12/7/06, Deep Blue <de...@gmail.com> wrote:
> > Hi,
> >
> > My project has the following requirements:
> > 1. It is a poll component that can be inserted in any page, at any place
> > that user like.
> > 2. We don't have the control on how it should be display in the page,
> so,
> > cannot have one global template page (e.g. jsp) to insert inside the
> page.
> > But, we can specify some rules to tell the client how to put dynamic
> > behaviour to the poll section in the page. The poll can appear as a
> table,
> > or just plain text inside div. The appearance style of the poll should
> be
> > done directly inside the page.
> > 3. Pages is composed by client, and they can add pages (with poll
> > inside) into the website from time to time. After they uploaded the page
> to
> > server, the dynamic section (poll) is supposed to work without doing any
> > configuration. It is sort of like plug and play concept.
> >
> > May I know if Tapestry is suitable for the above requirement? If not,
> anyone
> > can suggest some better frameworks which can fullfill the requirement?
> >
> > Thanks!!!
> >
> > Best Regards,
> > Deep Blue
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Decision of whether to use tapestry

Posted by Sam Gendler <sg...@ideasculptor.com>.
I typed up a long response, but then reread your question and I think
maybe I need some clarification. I included my original response below
in case it answers your question. If you are looking for something
that can be included in any page, rendered by any framework, then I'm
not sure you really want to use Tapestry.  The only way you are going
to build something that can be used absolutely anywhere is to render
the poll entirely in html and javascript.  Take a look at dojo for
examples of lots of widgets that can be used in any web page by simply
including the correct js files.  However, dojo does leave the backend
processing as an exercise for the user, rather than providing a
service to handle storing and rendering user input.

The difficult thing in your concept is submitting the results back to
a server which will maintain totals and render them back to the
browser, either graphically, or maybe just as a data structure that
the browser can then use to render graphically.  Tapestry can be used
to do this, fairly easily, but in general, Tapestry is a fairly
stateful framework that is used for building applications rather than
just widgets that can be inserted into other apps. You could implement
an IExternalPage which receives the selected answer and poll id in the
URL, stores the answer against the poll id, and serves up totals.  The
only real caveat is that your tapestry-based pollserver is likely to
be on a different host than the containing page, so you'll have to use
cross domain techniques to allow tapestry to serve up js that can
interact with the template provided in the containing page.  This is
basically just a matter of serving up js as a string and then
eval()'ing that string within the context of the containing document.
There are lots of discussions of cross-domain js on the web, so I'll
leave that to you to research.  You'd have the same problem with any
framework you might choose to implement the backend in.

Now, if you were just talking about building a tapestry poll component
that can be used only in other Tapestry applications, the answer is
definitely yes and I have a fairly detailed answer below:

Yes, it is possible.  There are a lot of parallels between your
component and the contrib:Table component that comes with Tapestry
(although the table is likely to be much more complex).

Just to give you some concepts to refer to in your research, here's
brief outline if what you'd likely do.

Create a poll component that takes some data structure that defines
the poll and the current results (assuming you also want to display
results there). The poll component iterates over each poll answer
rendering an @Block component that is provided by the page template.
The @Block component contains all of the template code necessary to
render a single answer of the poll.  If the user wants a table, they
open the table tag in their template, then include an @Block component
which renders a single table row (or column, depending upon
preference).  You can use a different Block component to render a link
to the results, a submit button, or anything else you care for.

If you provide reasonable defaults, many users will never have to
define a Block at all in order to use your poll.  Your component is
only responsible for providing default layout and data structures, but
everything is overloadable via Blocks.  Something like the following
(I'll use a list this time, just to show the difference):

<ul jwcid="myPoll@Poll" questions="ognl:answers"
index="ognl:currentanswer" element="literal:ul">
    <span jwcid="answer@Block">
        <li><span jwcid="@Insert" value="ognl:currentAnswer"/></li>
    </span>
</ul>

My little example above excludes the actual selection mechanism,
submit button, or results display, but all of that is easy enough.
You might find that your default 'Poll' component consists of multiple
sub components - PollView, PollResults, PollSubmit. The little sample
above is probably actually a PollView component which would be wrapped
the Poll component.  The PollView, PollResults, and PollSubmit can be
placed in different locations, relative to each other, by simply
replacing the outer Poll layer, or by using them without an outer Poll
layer.  This is exactly how the table component works, using a
TableView to render the table, a TablePages component to render the
page changing mechanism.  The TableView itself consists of
TableColumns, TableRows, etc.

OK, assuming you are a tapestry novice, that probably went WAY over
your head.  However, it will hopefully give you some keywords to watch
out for as you read documentation.  I recommend that you read the
first 4 chapters of the Enjoy Web Development with Tapestry ebook that
is linked from the tapestry home page.  You should also check out the
tapestry tables tutorial webapp and then look at the source code to
contrib:Table.  You could probably read through all of that in a long
day, if you don't actually implement any of the tutorial code, anyway.
 At the end of it, you should have a pretty good idea how to go about
building your component, even though you'll still have a steep lerning
curve to get through before you can actually get it working.

--sam

On 12/7/06, Deep Blue <de...@gmail.com> wrote:
> Hi,
>
> My project has the following requirements:
> 1. It is a poll component that can be inserted in any page, at any place
> that user like.
> 2. We don't have the control on how it should be display in the page, so,
> cannot have one global template page (e.g. jsp) to insert inside the page.
> But, we can specify some rules to tell the client how to put dynamic
> behaviour to the poll section in the page. The poll can appear as a table,
> or just plain text inside div. The appearance style of the poll should be
> done directly inside the page.
> 3. Pages is composed by client, and they can add pages (with poll
> inside) into the website from time to time. After they uploaded the page to
> server, the dynamic section (poll) is supposed to work without doing any
> configuration. It is sort of like plug and play concept.
>
> May I know if Tapestry is suitable for the above requirement? If not, anyone
> can suggest some better frameworks which can fullfill the requirement?
>
> Thanks!!!
>
> Best Regards,
> Deep Blue
>
>

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