cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <>
Subject Re: Cocoon Form Handling
Date Sun, 17 Mar 2002 16:50:36 GMT
On Sun, 17 Mar 2002, Ivelin Ivanov wrote:

> > ok - then we are on the same track... but please consider the population
> > syntax I proposed. I think resetting something is misleading and it works
> > fine without.
> I certainly would. You put a lot more thought into your code than I have for
> the snippet above.
> Can you please paste your code <here/> so that I can match exactly your
> syntax to the one above?

see it action or event based rather than page based. a hit on a button
generates an event or action that populates and (maybe) validates. So you
are completely free to populate or not populate, to validate or not
validate on this specific event.

> > I have already implemented an abstraction for the binding. So binding a
> > bean is the same a having no a simple DOM as instance store instead.
> Yammy!
> How does one choose JavaBean vs DOM binding?

Currently you just use a different implementation. But this should go
into a factory instead.

look a this multiaction example:

public class PreceptorDemoAction extends AbstractPreceptorAction {
  public Map introspection(Redirector redirector, SourceResolver resolver, Map objectModel,
String src, Parameters par) throws Exception {
    Session session = createSession(objectModel);

    Preceptor preceptor = preceptorRegistry.lookupPreceptor("cocoon-installation");

    // for a DOM
    Instance instance = instanceFactory.createDOMInstance();
    // for a Bean
    MyBean bean = new MyBean();
    Instance instance = instanceFactory.createBeanInstance(bean);


    // if DOM or Bean you can always use
    instance.setValue("cocoon-installation/user/name","enter here");


  public Map doNext(Redirector redirector, SourceResolver resolver, Map objectModel, String
src, Parameters par) throws Exception {
    populate(objectModel, "feedbackform", "cocoon-installation/user/*");

    List errors = validate(objectModel, "feedbackform", "cocoon-installation/user/*");
    if(errors != null) {
      getLogger().debug("there are errors on the page");
      return (page(FIRST));
    else {
      getLogger().debug("all constraints are ok");
      return (page(SECOND));

So a 3 page wizard basically means 3 event hooks aka methods like the "doNext".

So if we manage to have a preceptor

  public interface Preceptor {
    public ConstraintList getConstraitsFor( String xpath );
    public boolean isValidNode( String xpath );

...wrapping the different validation APIs we can drop in
each validating schema: XSD,RELAX,DTD and (with the API link you sent)
maybe even Schematron...

Later I'd like to see this configurable with a XML descriptor.

To unsubscribe, e-mail:
For additional commands, email:

View raw message