Arthur Allen wrote:
Thanks Chris for the clarifications.
You wrote--

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>

This would be the place to disable prepending table name or appending
row number to the parameter name. Again, see javadocs for DatabaseAction

Your syntax is correct according to the javadocs. I tried it (indeed already had
among many other things) and noted no change. I did use other directives
in that area to drop indices, which worked fine.

Arthur, this is what I did to reproduce the problem: a) fresh checkout from CVS (on 2003-06-20, nothing changed in this particular area so this is not absolutely necessary, anyway, it feels better to be able to refer to a version) b) build.sh clean webapp c) cocoon.sh servlet d) edit build/webapp/samples/databases/mod-db/sitemap.xmap: add <output>session-attr</output> to mod-db-add action:

    <map:action name="mod-db-add"
         src="org.apache.cocoon.acting.modular.DatabaseAddAction">
       <descriptor>database.xml</descriptor>
       <throw-exception>false</throw-exception>
       <output>session-attr</output>
    </map:action>

e) edit build/webapp/samples/databases/mod-db/user-list.xsp, add

<p><h3>Session Attributes</h3></p>
<p>
<table border="0">
<tbody>
<xsp:logic>{
Enumeration e=request.getSession().getAttributeNames();
while ( e.hasMoreElements() ) {
String attribute = (String) e.nextElement();
Object value = request.getSession().getAttribute(attribute);
<tr>
<td align="right"><xsp:expr>attribute</xsp:expr></td>
<td>="<xsp:expr>value</xsp:expr>"</td>
</tr>
}
}</xsp:logic>
</tbody>
</table>
</p>


near the end of the file, right after request parameters

f) fire up mozilla
    http://localhost:8888/samples/databases/mod-db/user-list
    and add a new group "guest"

    result:
Session Attributes

org.apache.cocoon.components.modules.output.OutputModule:groups.gid[0]="1"
org.apache.cocoon.components.modules.output.OutputModule:groups.gname[0]="guest"

g) remove <output/> in sitemap.xmap and add select action:

<map:action name="mod-db-sel" src="org.apache.cocoon.acting.modular.DatabaseSelectAction">
<descriptor>database.xml</descriptor>
<throw-exception>false</throw-exception>
<output>session-attr</output>
</map:action>


plus

      <map:act type="req-params">
         <map:parameter name="parameters" value="sel-user user.uid"/>
         <map:act type="mod-db-sel">
        <map:parameter name="table-set" value="user"/>
         </map:act>
      </map:act>

right after the <map:match pattern="*">

h) add another group "staff"
i) add a new user "doe", "john", "jd", "staff"+"guest"
j) point browser to
http://localhost:8888/samples/databases/mod-db/user-list?sel-user=1&user.uid=0

   result:
Session Attributes

org.apache.cocoon.components.modules.output.OutputModule:groups.gid[0]="1"
org.apache.cocoon.components.modules.output.OutputModule:user.uname[0]="jd"
org.apache.cocoon.components.modules.output.OutputModule:user.name[0]="doe"
org.apache.cocoon.components.modules.output.OutputModule:user.uid[0]="0"
org.apache.cocoon.components.modules.output.OutputModule:groups.gname[0]="guest"
org.apache.cocoon.components.modules.output.OutputModule:user.firstname[0]="john"

which looks perfectly OK to me.

Now, you might not like the prefix "org.......", to get rid of that, you need to configure "session-attr" in cocoon.xconf:

<output-modules>
<component-instance
class="org.apache.cocoon.components.modules.output.SessionAttributeOutputModule" logger="core.modules.output" name="session-attr">
<key-prefix/>
</component-instance>
</output-modules>


Mmmh, I'm afraid that this is not documented anywhere :-(

If you don't like the "[0]" etc., that *is* documented: add
   <append-row>false</append-row>
to the action's declaration like you did with <output/>.

I noted the output to the logger if that helps:

the modules log to Core


ComponentFactory creating new instance of org.apache.cocoon.acting.modular.DatabaseSelectAction.
Using cached configuration for content/xdocs/xbrl/dbDescriptor.xml

DatabaseAction: query: SELECT namespace, taxonomyid FROM loadedtaxonomies WHERE label= ?
Trying to set column loadedtaxonomies.label from session-attr using getAttribute method
Setting column loadedtaxonomies.label [0] usfr-gaap-ci
====> row no. 0
Setting column loadedtaxonomies.label to usfr-gaap-ci
Setting column loadedtaxonomies.namespace to http://www.xbrl.org/taxonomy/us/fr/gaap/ci/2002-10-15
Setting column loadedtaxonomies.taxonomyid to 31

HTH


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


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to