You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bobby Mitchell <bm...@niac.usra.edu> on 2002/09/11 23:29:32 UTC

Need help with mod-db and XMLForm (Please disregard my earlier posts)

  To start with, I apologize for posting so many different posts lately. 
I'm stuck and I'm not sure which way to go, but I have been working to 
find a solution. Please disregard the several earlier posts.
I'm trying to use XMLForms and Mod-db actions together. My problem stems 
from the fact that mod-db uses request parameters from a key column to 
set the ?'s in the query and when setting the request parameters to the 
column values retrieved it sets them by appending table_name. to the 
column/req-param name. My request parameters and column names are the same.

Assume my query is select ID, EMAIL from NIAC_MAILLIST where EMAIL=?  
Mod-db is now looking for a request parameter called NIAC_MAILLIST.EMAIL 
and if found it successfully grabs the data from the database. Otherwise 
it exits. If I append &NIAC_MAILLIST.EMAIL="b@n" to the query string 
mod-db works and creates the variables for the data, but XMLForm 
generates an "Invalid data format" error. I created a session attribute 
called NIAC_MAILLIST.EMAIL and am setting it to EMAIL. If mod-db would 
set  the ? from the session attributes instead of request parameters I 
could set it that way. Otherwise I need to find a way to get mod-db to 
not append the table name to the front of the column.
Any ideas?

database.xml
<root>
  <connection>niac_db</connection>
   <table name="NIAC_MAILLIST" alias="NIAC_MAILLIST">
   <keys>          <key name="EMAIL" type="string" autoincrement="false">
        </key>
     </keys>      <values>
       <value name="ID"  type="int"></value>
       <value name="EMAIL" type="string"></value>
     </values>
  </table>
  <table-set name="MAILLIST-sel">
     <table name="NIAC_MAILLIST" others-mode="session"/>
  </table-set>
</root>

sitemap snippet where I declare the select action
<map:action name="mod-db-sel     
src="org.apache.cocoon.acting.modular.DatabaseSelectAction">
         <descriptor>database.xml</descriptor>
         <throw-exception>true</throw-exception>
</map:action>

pipeline where I'm trying to use it.   
                                                                               

   <map:pipeline>

     <!-- A non-trivial interactive example - Cocoon Usage Feedback 
Wizard -->
     <map:match pattern="wizard*">

       <map:match type="request-parameter" pattern="cocoon-xmlform-view">
         <map:select type="request-parameter">
           <map:parameter name="parameter-name" 
value="cocoon-xmlform-view"/>
           <map:when test="registration">
<!--
             <map:act type="request">
               <map:parameter name="parameters" value="true"/>
-->
             <map:act type="req-params">
               <map:parameter name="parameters" value="EMAIL"/>
               <map:act type="session-propagator">
                 <map:parameter name="NIAC_MAILLIST.EMAIL" 
value="{EMAIL}"/>
               </map:act>
               <map:act type="mod-db-sel" src="optional src">
                 <map:parameter name="table-set" value="MAILLIST-sel"/>
               </map:act>
             </map:act>
           </map:when>
         </map:select>
       </map:match>

       <map:act type="WizardAction">

         <!-- XMLForm parameters for the AbstractXMLFormAction -->
         <map:parameter name="xmlform-validator-schema-ns" value= 
"http://www.ascc.net/xml/schematron" />
         <map:parameter name="xmlform-validator-schema" 
value="schematron/wizard-xmlform-sch-report.xml"/>
         <map:parameter name="xmlform-id" value="form-feedback"/>
         <map:parameter name="xmlform-scope" value="session"/>
         <map:parameter name="xmlform-model" value="niac.list.ListBean"/>

         <!-- Content transformation logic -->
         <map:generate type="serverpages" src="wizard/{page}.xsp"/>
         <map:transform type="xmlform"  label="debug, xml"/>
         <map:transform src="stylesheets/wizard2html.xsl" />
         <map:transform 
src="context://samples/stylesheets/xmlform/xmlform2html.xsl"/>
         <map:serialize type="xhtml"/>
       </map:act>
     </map:match>
   </map:pipeline>


-- 
Robert J. (Bobby) Mitchell
Systems Administrator
NASA Institute for Advanced Concepts
555A 14th St Atlanta, Ga. 30318
Phone: (404)347-9633 Fax: (404)347-9638




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>