On Tue, 19 Jun 2001, Davanum Srinivas wrote:
> Christian,
>
> Thanks a ton.
>
> 1. Checked in your docs. Please take a look.
> 2. XSP should be working now.
> 3. Did you try using "context:///" (note the extra '/') instead of context://. If
>this does not
> work, please let me know.
We need to fix that down as we all agreed that it must be
context://blabla instead of the now needed context:///blabla
Does anyone has some free cycles to fix it?
Giacomo
>
> If all's well, please submit your sample.
>
> Thanks,
> dims
>
> --- Christian Haul <[EMAIL PROTECTED]> wrote:
> > On 15.Jun.2001 -- 04:34 AM, Davanum Srinivas wrote:
> > > Also, It will be *REALLY* helpful if you could submit a sample that shows off
>how to use the
> > > LogicSheet and actions. Finally Please consider submitting some documentation
>similar to the
> > ones
> > > in xdocs directory to make it easy for people to make use of your contribution.
>FYI, You can
> > use
> > > "build docs" to build the documentation.
> >
> > Davanum,
> >
> > the attached file is the reworked documentation from the patch
> > accompanying mail. I have not provided entries for docs-book.xml or
> > site-book.xml since I was unsure about where to put it.
> >
> > Would be quite nice if there would be some guide line for
> > docs eg. what documents qualify as "overview" and what as
> > "technical".
> >
> > An example is not included because
> > a) xsp seems to be broken right now (CVS monday)
> > b) I'm still not able to use context:// in a sub-sitemap. The file is
> > always searched for in $COCOON_DIR
> >
> > Chris.
> >
> > --
> > C h r i s t i a n H a u l
> > [EMAIL PROTECTED]
> > fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08
> > > <?xml version="1.0"?>
> > <!DOCTYPE document SYSTEM "dtd/document-v10.dtd">
> > <document>
> > <header>
> > <title>Using Form Validation</title>
> > <version>0.1</version>
> > <type>Overview document</type>
> > <authors>
> > <person name="Christian Haul" email="[EMAIL PROTECTED]"/>
> > </authors>
> > </header>
> > <body>
> > <s1 title="Introduction?">
> > <p>
> > For most web applicatipns input is essential. Cocoon provides a
> > variety of modules to support basic interaction like simple syntax
> > checking of input data or writing input data to databases.
> > </p>
> > <p>
> > This is about sntax checking. See
> > org.apache.cocoon.acting.DatabaseAbstractAction (in javadocs) for
> > details on database interaction.
> > </p>
> > <p>
> > FormValidatorAction communicates to the application a verbose
> > error status through an request attribute. In addition a taglib
> > allows easy access to the results. On top of that this taglib
> > gives access to the attributes for parameters declared in those
> > sections in descriptor.xml relevant to the validation process.
> > </p>
> > <s2 title="The Descriptor File">
> > <p>
> > For details on the syntax of the descriptor file see
> > javadocs. Basically it constists of two sections, a list of
> > parameters and their properties and a list of constraints or
> > constraint sets. The file syntax is set up so that it can be
> > shared with the database actions.
> > </p>
> > <source>
> > <![CDATA[
> > <?xml version="1.0"?>
> > <root>
> >
> > <parameter name="persons" type="long" min="1" default="4"/>
> > <parameter name="deposit" type="double" min="10.0" max="999.99" nullable="no"/>
> > <parameter name="email" type="string" max-len="50"
> > match-regex="^[\d\w][\d\w\-_\.]*@([\d\w\-_]+\.)\w\w\w?$">
> >
> > <constraint-set name="car-reservation">
> > <validate name="persons"/>
> > <validate name="deposit" min="50.0"/>
> > <validate name="email"/>
> > </constraint-set>
> >
> > </root>
> > ]]>
> > </source>
> > <p>
> > The aboce could for example describe expected input from a reservation
> > form. Specifications in a constraint set take preceedence over
> > the general ones.
> > </p>
> > </s2>
> > <s2 title="Sitemap Usage">
> > <p>
> > To take advantage of the form validator action create two
> > pages. One for the input form and one indicating the acceptance of
> > the reservation. Create a pipeline in your sitemap so that the
> > confirmation page is only shown when the action completed
> > successfully and the input form is returned otherwise.
> > </p>
> > <source>
> > <![CDATA[
> > <?xml version="1.0"?>
> > <map:match pattern="car-reservation">
> > <map:act type="form-validator">
> > <!-- add you favourite database action here -->
> > <map:parameter name="descriptor" value="descriptor.xml"/>
> > <map:parameter name="validate-set" value="car-reservation"/>
> > <map:generate type="serverpages" src="OK.xsp"/>
> > <map:transform src="stylesheets/dynamic-page2html.xsl"/>
> > <map:serialize/>
> > </map:act>
> > <map:generate type="serverpages" src="test/ERROR.xsp"/>
> > <map:transform src="stylesheets/dynamic-page2html.xsl"/>
> > <map:serialize/>
> > </map:match>
> > ]]>
> > </source>
> > <p>
> > Note here that you may not use a redirection to point to the
> > pages if you would like to access the validation results e.g. on
> > the error page. A redirection would create a new request object
> > and thus discard the validation results.
> > </p>
> > </s2>
> > <s2 title="XSP Usage">
> > <p>
> > To give the user some feedback why her/his submitted data was rejected
> > there is a special taglib "xsp-formval". Declare its name space as
> > usual.
> > </p>
> > <p>
> > If only interested in validation results, just
> > </p>
> > <source>
> > <![CDATA[
> > <xsp:logic>
> > if (!<xsp-formval:is-ok name="persons"/>) {
> > <myapp:error>(ERROR)</myapp:error>
> > };
> > </xsp:logic>
> > ]]>
> > </source>
> > <p>
> > Internationalization issues are a separate concern and are not
> > discussed here.
> > </p>
> > <p>
> > Currently the following validation result codes are supported:
> > </p>
> > <table>
> > <tr><th>tag</th><th>Meaning</th></tr>
> > <tr><td>xsp-formval:is-ok</td><td>no error occurred,
> > parameter successfully
> > checked</td></tr>
> > <tr><td>xsp-formval:is-error</td><td>some error occurred,
> > this is a result that
> > is never set but serves
> > as a comparison target
> > </td></tr>
> > <tr><td>xsp-formval:is-null</td><td>the parameter is null but
> > isn't allowed to</td></tr>
> > <tr><td>xsp-formval:is-toosmall</td><td>either value or
> > length in case of a
> > string is less than
> > the specified
> > minimum</td></tr>
> > <tr><td>xsp-formval:is-toolarge</td><td>either value or
> > length in case of a
> > string is greater
> > than the specified
> > maximum</td></tr>
> > <tr><td>xsp-formval:is-nomatch</td><td>a string parameter's
> > value is not matched
> > by the specified
> > regular expression</td></tr>
> > <tr><td>xsp-formval:is-notpresent</td><td>this is returned
> > when the result of
> > a validation is
> > requested but no
> > such result is
> > found in the
> > request attribute </td></tr>
> > </table>
> > <p>
> > If you'd like to be more specific what went wrong, you can query
> > the descriptor file for attributes.
> > </p>
> > <p>
> > First set the url of the file or resource that contains the
> > parameter descriptions and constraint sets. This needs to be an
> > ancestor to all other tags (of this taglib). Multiple use of this
> > tag is allowed (although probably not necessary).
> > </p>
> > <p>
> > You need to do this only if you plan to query the
> > descriptor file or if you'd like to use the shorthand
> > below.
> > </p>
> > <source>
> > <![CDATA[
> > <xsp-formval:descriptor name="descriptor.xml" constraint-set="reservation">
> > deposit must be at least EUR <xsp-formval:get-attribute parameter="deposit"
>name="min"/>
> > </xsp-formval:descriptor>
> > ]]>
> > </source>
> > <p>
> > If you need to use one parameter a lot, there's a short hand. Use
> > this e.g. if you'd like to set up the properties of an input tag
> > according to the information from the descriptor file or if you'd
> > like to give detailed error messages.
> > </p>
> > <p>
> > Note that you can specify additional attributes in the
> > description file that are not understood (and therefore ignored)
> > by the FormValidatorAction but that could be queried here. This
> > might be e.g. the size of the input field which might be
> > different from the max-len a parameter can take.
> > </p>
> > <source>
> > <![CDATA[
> > <xsp-formval:descriptor name="descriptor.xml" constraint-set="car-reservation">
> > <xsp-formval:validate name="deposit">
> > <xsp:logic>
> > if (<xsp-formval:is-null/>) {
> > <myapp:error> (you must specify a deposit)) </myapp:error>
> > } else if ( <xsp-formval:is-toosmall/> ) {
> > <myapp:error> (deposit is too small (< <xsp-formval:get-attribute
> > name="min"/>))</myapp:error>
> > } else if ( <xsp-formval:is-toolarge/> ) {
> >
> === message truncated ===>
>---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, email: [EMAIL PROTECTED]
>
>
> =====
> Davanum Srinivas, JNI-FAQ Manager
> http://www.jGuru.com/faq/JNI
>
> __________________________________________________
> Do You Yahoo!?
> Spot the hottest trends in music, movies, and more.
> http://buzz.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]