Hi Folks,
I am having problems using modular database select action.
Specifically, I cannot seem to direct its output to session attributes
let alone control the naming of those attributes. Instead, it posts the results of
my single row select to map parameters, named as it sees fit (table.col)
which is the default. you only change the input mapping below.
I do not know
of any samples for select (more difficult cases are handled) and the docs are
... shall I say... hard to follow even on a tenth read.
Please add to the wiki at wiki.cocoondev.org any suggestions to improve the docs.
I am dealing with a simple table with three colums,
<root> <connection>taxos</connection> <table name="loadedtaxonomies" alias="loadedtaxonomies"> <keys> <key name="label" type="string"> <mode name="session-attr" type="all"> <parameter>taxonomy.label</parameter>
=> _read_ value from request.getSession().getAttribute("taxonomy.label")
</mode> </key> </keys> <values> <value name="namespace" type="string"> <mode name="session-attr" type="all"> </mode> </value> <value name="taxonomyid" type="int"> <mode name="session-attr" type="all"> </mode> </value> </values> </table>
<table-set name="loadedtaxonomies"> <table name="loadedtaxonomies"/> </table-set> </root>
My sitemap code is
In <map:components><map:actions/></map:components> you need to configure the output for the actions, for each one of the database actions seperately. Add
<output>session-attr</output>
(please see javadocs for exact parameter name) to <map:action/>
This would be the place to disable prepending table name or appending row number to the parameter name. Again, see javadocs for DatabaseAction for details.
<map:act type="mod-db-sel">
<map:parameter name="table-set" value="loadedtaxonomies"/>
<!-- we have a valid taxonomy label -->
<map:act type="session-propagator">
<map:parameter name="taxonomy.id" value="{loadedtaxonomies.taxonomyid} "/>
</map:act>
</map:act>
I use the session propagator as a work-around, to copy the output from the returned map parameters
to the session. The select does pick up the key value correctly from the session attribute
taxonomy.label. presumably using the input module session-attr, but neglects to do
the same with the output module bearing the same name?
You didn't tell it to use session-attr for output.
Could the problem be in my use of "all" type. My understanding is that this should
cause all cases (insert, delete, updat, select) to be handles by the same I/O modules.
Is that correct?
Yes -- but only regarding the input.
I'm using cocoon 2.1m2, jdk 1.4 Tomcat 4.1.24
Chris.
-- C h r i s t i a n H a u l [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]