I have been poking around trying to find out whether
DatabaseSelectAction can help me.
There is very little written about this action and I wonder whether it
has ever been used (or even tested).
My problem is as follows:
I have a column in a table in a database that I am able to access from
XSP and Java with no problems. In the interest of elegance I would like
to make the item available to an XSLT Transformation as a parameter.
All I want to do is supply the key column 'name', get the corresponding
row and then use the value of the field 'company' later in my pipeline
as: {company}.
Sitemap.xmap contains:
<map:actions>
<map:action name="select-user" logger="databaseselectaction"
src="org.apache.cocoon.acting.DatabaseSelectAction"/>
</map:actions>
And the matching pipeline entry is:
<map:match pattern="process">
<!-- first validate whether user has logged in -->
<map:act type="session-validator">
<map:parameter name="descriptor"
value="context://alpha/descriptors/params.xml"/>
<map:parameter name="validate" value="username"/>
<!-- generate protected content -->
<map:act type="form-validator">
<map:parameter name="descriptor"
value="context://alpha/descriptors/getfiles_form.xml"/>
<map:parameter name="validate" value="filename"/>
<!-- form-validation success -->
<map:act type="select-user">
<map:parameter name="descriptor"
value="context://alpha/descriptors/getuser.xml"/>
<map:generate type="serverpages" src="docs/process.xsp"/>
<map:transform src="stylesheets/dynamic-page2html.xsl">
</map:transform>
<map:serialize/>
</map:act>
</map:act>
<!-- form-validation failure -->
<map:redirect-to uri="pickdoc"/>
</map:act>
<!-- session-validation failed ==> redirect to login-page -->
<map:redirect-to session="true" uri="login"/>
</map:match>
The value "username" is captured by a form earlier in the session and
exists as a session attribute.
<root>
<parameter name="username" type="string" nullable="no"/>
<!--parameter name="company" type="string"/-->
<connection>phoenix</connection>
<table name="users">
<keys>
<key param="username" dbcol="name" type="string" mode="form"/>
</keys>
<values>
<value param="company" dbcol="company" type="string"/>
</values>
</table>
</root>
I include the username in the URL as I don't know how else to supply it
to the Action.
I have read the databaseSelectAction code and understand how the SELECT
statement is generated.
I have recompiled cocoon.jar with additional getLogger().debug(
"yadayadayada." ) statements but these never generate output. Anyone
care to tell me why ?
I have had some success with cocoon but I am finding it difficult to
get through to some advanced features because of the sparse
documentation.
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>