You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Anthony Mutiso 2 <an...@utilitynet.net> on 2002/10/22 21:30:47 UTC

making struts and velocity share the same datasource

Hi folks,

I am trying to use velocity templates from a database within a struts
application. I have configured velocity to use the
"org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader"
resouce loader, but my templates are never found. I suspect this is because
I cannot tell velocity the correct name of the datasource.

Anyone have some insight as to how to configure velocity to find the same
datasouce that struts is using. My struts config has the typical 

<data-sources>
  <data-source>
   <set-property property="description" value="App Name"/>
   <!--<set-property property="key" value="Myapp"/>-->
   <set-property property="driverClass" value="my.data.driver"/>
   <set-property property="url" value="jdbc:my.db.url"/>
   <set-property property="user" value="myuser"/>
   <set-property property="password" value="mypassword"/>
  </data-source>
<data-sources>

On a secondary issue: If I se the data-source key property to a string, say
"MyAppDataSource" and use it in my Action classes to get the datasource, it
fails. If it use the default name "Action.DATA_SOURCE_KEY" it works. Why am
I not able to use my own name.

I am using struts 1.1-b2

Thanks for the help.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>