Error getDataSource() structs
Publicado por Ator (50 intervenciones) el 02/11/2006 20:54:53
Hola tengo un problema con datasources en struts, el error que me da en el action es :
The method getDataSource(HttpServletRequest, String) is undefined for the type LoginAction
y creo que todo lo tengo bien.
He añaido las librerias a web-inf/lib:
commons-pool-1.1.jar
commons-dbcp-1.1.jar
struts-legacy.jar
He definido el datasource en el struts-config.xml
<data-sources>
<data-source key="musiccollection" type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="descripcion" value="Colección de musia"/>
<set-property property="driverClassName" value="com.mysql.jdbc.Driver"/>
<set-property property="username" value=""/>
<set-property property="password" value=""/>
<set-property property="url" value="jdbc:mysql://localhost/musiccollection"/>
<set-property property="maxCount" value="8"/>
<set-property property="minCount" value="2"/>
</data-source>
</data-sources>
pero en el action cuando voy a recuperar el datasource pasandoselo al construcutor de una clase asi:
LoginBean login = new LoginBean(getDataSource(request,"musicalCollection"));
Me da el error que os indique antes.
De antemano gracias.
The method getDataSource(HttpServletRequest, String) is undefined for the type LoginAction
y creo que todo lo tengo bien.
He añaido las librerias a web-inf/lib:
commons-pool-1.1.jar
commons-dbcp-1.1.jar
struts-legacy.jar
He definido el datasource en el struts-config.xml
<data-sources>
<data-source key="musiccollection" type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="descripcion" value="Colección de musia"/>
<set-property property="driverClassName" value="com.mysql.jdbc.Driver"/>
<set-property property="username" value=""/>
<set-property property="password" value=""/>
<set-property property="url" value="jdbc:mysql://localhost/musiccollection"/>
<set-property property="maxCount" value="8"/>
<set-property property="minCount" value="2"/>
</data-source>
</data-sources>
pero en el action cuando voy a recuperar el datasource pasandoselo al construcutor de una clase asi:
LoginBean login = new LoginBean(getDataSource(request,"musicalCollection"));
Me da el error que os indique antes.
De antemano gracias.
Valora esta pregunta


0