cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <>
Subject Re: Need help with XMLForm and Mod-db (Please disregard my earlier posts)
Date Thu, 19 Sep 2002 12:10:01 GMT
On 12.Sep.2002 -- 10:00 AM, Bobby Mitchell wrote:
> My solution is to change the code in to remove the 
> table_name. from the variable names. I made this change to test it and 
> it works. I suppose I need to change the code in such a way to allow a 
> user to supply a configuration directive such as 
> <append_table_name>false</append_table_name>. Is there any reason I 
> should not do this or is there a better way?
> I'm cross-posting this to the dev list.
> Bobby Mitchell wrote:
> >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?

Bobby, mod-db defaults to using request parameters in order to make a 
transition from the other database actions easy. However, it employs the
<mode/> tags nested into <value/> end <key/> tags to specify the 
InputModule to use. In addition you can give the InputModule instructions
where to look for the data.

Hence, you could obtain some or all data from the session and specify the
name of the session attribute to use as well. You could even interpret
the session attribute as java.util.Map and use a specific entry.

This should be described in the InputModules documentation. Advanced uses
are described in the javadocs for the specific InputModules.

> >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>

Here you could say
          <value name="ID" type="int">
             <mode type="all" name="session" parameter="foo"/>

You could even pass more configuration info to the InputModule by nesting
it into the <mode/> tag.

> >       <value name="EMAIL" type="string"></value>
> >     </values>
> >  </table>
> >  <table-set name="MAILLIST-sel">
> >     <table name="NIAC_MAILLIST" others-mode="session"/>
> >  </table-set>
> ></root>

Besides you patch to turn off name prefixing looks worthwhile and I will
look more into it when I'm back from travelling next week.

C h r i s t i a n       H a u l
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

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

View raw message