You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Joe D. Williams" <jo...@mindspring.com> on 2003/12/22 23:37:11 UTC

DatabaseSelectAction help

I am still unable to get the info I want to the session using the
DatabaseSelectAction. I could accomplish the same thing, I know, with an
XSP. But, I would prefer to use the action to keep the number of files and
code to a minimum for the users who will eventually have to maintain the
application.

Visitors are to log in using a typical form with username and password.
Username is saved to the session as "user", and authenticated against the
"support" db column "username".

That part works fine. However, I would like to deliver content based, not on
the username, but on the company the user works for, identified in the db as
"customer_name". Therefore, I would like to store the attribute "customer"
in the session.

I am using the following matcher:

<map:match pattern="dologin">
 <map:act type="authenticator">
  <map:parameter name="descriptor"
value="context://support/content/defs/authenticate.xml"/>

  <map:act type="select">
   <map:parameter name="descriptor"
value="context://support/content/select.xml"/>
  </map:act>

  <map:redirect-to uri="support/index"/>

 </map:act>
 <map:redirect-to uri="login"/>
</map:match>

And I get the following error:

org.apache.cocoon.ProcessingException: Could not prepare statement :position
= 0: org.apache.avalon.framework.configuration.ConfigurationException: Error
trying to load configurations for resource: null

Through several iterations, I have arrived at the following descriptors for
the actions above. Any help would be appreciated.

<auth-descriptor>
 <connection>support</connection>
 <table name="users">
  <select dbcol="username" request-param="user" to-session="user"/>
  <select dbcol="password" request-param="pass"/>
 </table>
</auth-descriptor>

<components>
 <connection>support</connection>
 <table name="users">
  <keys>
   <key param="user" dbcol="username" type="string"/>
  </keys>
  <values>
   <value param="customer" dbcol="customer_name" type="string"/>
  </values>
 </table>
</components>