You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by footh <fo...@yahoo.com> on 2005/09/14 17:46:39 UTC
[CForms] Instantiating and showing form outsite of javaflow
When first using CForms within Javaflow, I created a
big if...then...else statement for insantiating the
form, adding validators and the correct bean depending
on the particular form.
I then decided that I didn't like the big, ugly
if...then...else statement in my flow so I conceived a
way to do the form code in a separate class depending
on the form (the flow looks at the form requested,
than calls the appropriate class). However, the
execution throws an exception on the form.show method.
Is it possible to instantiate and show a form (thus
generating the continuation) in a class outside of a
Javaflow? I would guess the answer is "no" given my
experience described above but I was wondering if
someone can offer insight so I don't have to have the
gigantic if...then...else statement in my flow.
Thanks,
JF
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForms] Instantiating and showing form outsite of javaflow
Posted by footh <fo...@yahoo.com>.
>
> While this worked, the rule syntax turned out to be
> very unintuitive so
> we have dropped that approach. Since then we have
> defined an XML syntax
> that is similar in some respects to JSF navigation
> rules, but it also
> includes definitions of the actions to perform. In
> my "infinite spare
> time" I'll be implementing this on top of Javaflow.
> In this way we will
> have a "stateful event controller". Perhaps this is
> also what you are
> looking for?
>
Yes, that sounds interesting. My whole goal was to
just eliminate the large amount of ugly repetitive
code in my flow and to make adding new forms easy.
What you're proposing sounds like it will do just the
trick. I look forward to checking it out (when you
have the time to finish it, of course).
Thanks again for your help.
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForms] Instantiating and showing form outsite of javaflow
Posted by Ralph Goers <Ra...@dslextreme.com>.
footh wrote:
>Ah, I see where you're getting at. Create another
>javaflow, register it in the sitemap and let cocoon
>take care of it.
>
>
I'm pretty sure it is even simpler than that. If your Javaflow class
references another class that also extends AbstractContinuable it will
also be able to participate. What you can't do is call a method in a
class that does not implement AbstractContinuable and then try to
instantiate a new AbstractContinuable. I'm not even sure that you can
call a method in the AbstractContinuable that the non-continuable was
called from.
>I may end up doing that and moving the form code over
>to a separate class, but I really don't see much
>improvement over simply relocating the big
>if...then...else.
>
>The way I was trying to do it was to have an xml
>config file that associated a form url with a class.
>Then the main javaflow would call the class based on
>the request url. The class would then execute the
>code that instantiates and shows the form (and does
>other stuff specific to the form). I liked this
>method because if I needed to add another form, I
>could just create a new class and add it to the config
>file.
>
>
Well, I was playing around with drools and wrote a generic javaflow
method that invoked the rules engine. Each rule would identify a url to
invoke or create a form to show. When the rule engine returned the
Javaflow would determine what it was supposed to do (there are really
only a few options) and then it did it. It would then loop again until
it got a "show last".
While this worked, the rule syntax turned out to be very unintuitive so
we have dropped that approach. Since then we have defined an XML syntax
that is similar in some respects to JSF navigation rules, but it also
includes definitions of the actions to perform. In my "infinite spare
time" I'll be implementing this on top of Javaflow. In this way we will
have a "stateful event controller". Perhaps this is also what you are
looking for?
Ralph
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForms] Instantiating and showing form outsite of javaflow
Posted by footh <fo...@yahoo.com>.
Ah, I see where you're getting at. Create another
javaflow, register it in the sitemap and let cocoon
take care of it.
I may end up doing that and moving the form code over
to a separate class, but I really don't see much
improvement over simply relocating the big
if...then...else.
The way I was trying to do it was to have an xml
config file that associated a form url with a class.
Then the main javaflow would call the class based on
the request url. The class would then execute the
code that instantiates and shows the form (and does
other stuff specific to the form). I liked this
method because if I needed to add another form, I
could just create a new class and add it to the config
file.
Now I will just have to add another "else" to the main
javaflow, or the "form" javaflow if I decide to use a
secondary flow.
--- Ralph Goers <Ra...@dslextreme.com> wrote:
> footh wrote:
>
> >Thanks for the reply.
> >
> >I guess that makes sense. I was wondering, is
> there a
> >lot of overhead to loading a bunch of
> >"AbstractContinuable" classes via the
> >ContinuationClassLoader? If so, I might just do it
> >once, or not at all and stick with the
> >if...then...else.
> >
> >
> >
> You are planning on calling the
> ContinuationClassLoader yourself? I
> don't think you really need to do that. If I recall
> correctly the
> classes are only loaded once. But it would be easy
> to check. Just stick
> a System.out.println(this.toString()) in the class
> and see if it changes
> on subsequent requests.
>
> Ralph
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
>
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForms] Instantiating and showing form outsite of javaflow
Posted by Ralph Goers <Ra...@dslextreme.com>.
footh wrote:
>Thanks for the reply.
>
>I guess that makes sense. I was wondering, is there a
>lot of overhead to loading a bunch of
>"AbstractContinuable" classes via the
>ContinuationClassLoader? If so, I might just do it
>once, or not at all and stick with the
>if...then...else.
>
>
>
You are planning on calling the ContinuationClassLoader yourself? I
don't think you really need to do that. If I recall correctly the
classes are only loaded once. But it would be easy to check. Just stick
a System.out.println(this.toString()) in the class and see if it changes
on subsequent requests.
Ralph
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForms] Instantiating and showing form outsite of javaflow
Posted by footh <fo...@yahoo.com>.
Thanks for the reply.
I guess that makes sense. I was wondering, is there a
lot of overhead to loading a bunch of
"AbstractContinuable" classes via the
ContinuationClassLoader? If so, I might just do it
once, or not at all and stick with the
if...then...else.
--- Ralph Goers <Ra...@dslextreme.com> wrote:
> You can instantiate and manipulate Form objects
> wherever you want.
> However, my experience is that you must show them
> from a class that
> extends AbstractContinuable which was loaded by the
> ContinuationClassLoader.
>
> Ralph
>
> footh wrote:
>
> >When first using CForms within Javaflow, I created
> a
> >big if...then...else statement for insantiating the
> >form, adding validators and the correct bean
> depending
> >on the particular form.
> >
> >I then decided that I didn't like the big, ugly
> >if...then...else statement in my flow so I
> conceived a
> >way to do the form code in a separate class
> depending
> >on the form (the flow looks at the form requested,
> >than calls the appropriate class). However, the
> >execution throws an exception on the form.show
> method.
> >
> >Is it possible to instantiate and show a form (thus
> >generating the continuation) in a class outside of
> a
> >Javaflow? I would guess the answer is "no" given
> my
> >experience described above but I was wondering if
> >someone can offer insight so I don't have to have
> the
> >gigantic if...then...else statement in my flow.
> >
> >Thanks,
> >
> >JF
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam? Yahoo! Mail has the best spam
> protection around
> >http://mail.yahoo.com
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail:
> users-help@cocoon.apache.org
> >
> >
> >
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
>
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForms] Instantiating and showing form outsite of javaflow
Posted by Ralph Goers <Ra...@dslextreme.com>.
You can instantiate and manipulate Form objects wherever you want.
However, my experience is that you must show them from a class that
extends AbstractContinuable which was loaded by the ContinuationClassLoader.
Ralph
footh wrote:
>When first using CForms within Javaflow, I created a
>big if...then...else statement for insantiating the
>form, adding validators and the correct bean depending
>on the particular form.
>
>I then decided that I didn't like the big, ugly
>if...then...else statement in my flow so I conceived a
>way to do the form code in a separate class depending
>on the form (the flow looks at the form requested,
>than calls the appropriate class). However, the
>execution throws an exception on the form.show method.
>
>Is it possible to instantiate and show a form (thus
>generating the continuation) in a class outside of a
>Javaflow? I would guess the answer is "no" given my
>experience described above but I was wondering if
>someone can offer insight so I don't have to have the
>gigantic if...then...else statement in my flow.
>
>Thanks,
>
>JF
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org