Dynamic struts-config.xml datasource
Is there a way to setup my application so it can detect what server(testing or production) it is running on, and decide which database to point to without me having to change the config file when I deploy the app in a test or production environment? Basically, I would like to only have to build the .war file and place it either on my test server or production server and it point to the correct database without me having to fiddle with the config files every time. All ideas are welcome.
Thanks.
-PV
Nevermind, I thought of another way of doing it. I'll add it to my build script. So I specify which struts-config.xml file should be used when I build the .war file.
Thanks
Similar Messages
-
How to access Datasource tag info (struts-config.xml) in POJO
Hello friends,
I am doing a project in struts.I have stored the database connection information in data-source tag of struts-config.xml file.This is the code.
<data-sources>
<data-source>
<set-property property="autoCommit" value="false"/>
<set-property property="description" value="oracle Data Source"/>
<set-property property="driverClass" value="oracle.jdbc.driver.OracleDriver"/>
<set-property property="maxCount" value="10"/>
<set-property property="minCount" value="2"/>
<set-property property="user" value="system"/>
<set-property property="password" value="manager"/>
<set-property property="url"
value="jdbc:oracle:thin:@localhost:1521:gd"/>
</data-source>
</data-sources>
Now I want to access this data in POJO.I know how to use it in action class but unable to use it in POJO.To access it in action class , the code goes like this....
ServletContext context=servlet.getServletContext();
DataSource datasource=(DataSource)context.getAttribute(Action.DATA_SOURCE_KEY);
Connection con=datasource.getConnection();
Can anyone tell me what to do?.Any help will be highly appreciated.Thank you in advance.You will need to use the JSR 88 API to access deployment descriptor configuration.
See the Programming Deployment for Oracle WebLogic Server documentation for more information. -
Error regarding to the configuration of "Data Source" in Struts-config.xml
Hi,
Any 1 just help me out. I am using NetBeans 4.1 bundeled with Sun App server 8.1. Now I wanted to make the database connectivity with the front -end using"Data-source" tag in the struts-config.xml file . I am using the Oracle 9i as database.But I am not able to do it , it's showing me again and again error.I got realy fed up with this. I have checked the code as well as the the struts-config.xml file syntaxes with many other books and online resources, I couldn't find any sort of anomaly over here.So some 1 plzz help me regarding this as early as possible.I am attaching the Struts-config .xml file code as well as the error messaage over here.
Struts-config.xml file code is...
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<!-- ============================================ Data Source Configuration -->
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource" key="RoseKey">
<set-property
property="driverClassName"
value="oracle.jdbc.driver.OracleDriver" />
<set-property
property="url"
value="jdbc:oracle:thin://10.31.8.49:1521:USGFS" />
<set-property
property="username"
value="EPTP2DEV" />
<set-property
property="password"
value="EPTP2DEV" />
<set-property
property="maxActive"
value="10" />
<set-property
property="maxWait"
value="5000" />
<set-property
property="defaultAutoCommit"
value="false" />
<set-property
property="defaultReadOnly"
value="false" />
<!--set-property
property="validationQuery"
value="SELECT COUNT(*) FROM address" /-->
</data-source>
</data-sources>
<!-- ======================================== Form Bean Definitions -->
<form-beans>
<form-bean
name="AddressForm"
type="app.AddressForm"/>
<form-bean
name="DVDForm"
type="app.DVD"/>
</form-beans>
<!-- =================================== Global Forward Definitions -->
<!--global-forwards>
<forward
name="logoff"
path="/Logoff.do"/>
<forward
name="logon"
path="/Logon.do"/>
<forward
name="welcome"
path="/Welcome.do"/>
</global-forwards-->
<!--global-forward>
<forward
name="Address1"
path="/pages/Address.jsp"/>
</global-forward-->
<!-- =================================== Action Mapping Definitions -->
<action-mappings>
<!--action
path="/Welcome"
type="org.apache.struts.actions.ForwardAction"
parameter="/pages/Welcome.jsp"/>
<action
path="/Logon"
type="org.apache.struts.actions.ForwardAction"
parameter="/pages/Logon.jsp"/-->
<action
path="/Address"
type="app.AddressAction"
name="AddressForm"
scope="request"
validate="true"
input="/pages/Address.jsp">
<forward
name="success"
path="/pages/success.jsp"/>
</action>
<action
path="/TestAction"
type="app.TestAction">
<forward
name="testAction"
path="/pages/TestAction.jsp"/>
</action>
<action
path="/TestDVD"
type="app.DVDAction"
name="DVDForm">
<forward
name="testDVD"
path="/pages/Movie.jsp"/>
</action>
<action
path="/DataSource"
type="app.TestDataSource">
<forward
name="joy"
path="/pages/joy.jsp"/>
</action>
</action-mappings>
<message-resources parameter="resources.ApplicationResources"/>
</struts-config>
And the error I am getting in the Server console is ..
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io exception: The Network Adapter could not establish the connection)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)
at org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.java:598)
at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:808)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:335)
at javax.servlet.GenericServlet.init(GenericServlet.java:261)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:118)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1093)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:931)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4183)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4536)
at com.sun.enterprise.web.WebModule.start(WebModule.java:241)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:827)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:125)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:147)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:809)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1279)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1006)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:160)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:238)
at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:918)
at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:905)
at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:427)
at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:139)
at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:288)
at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:155)
at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:258)
at com.sun.enterprise.deployment.phasing.StartPhase.runPhase(StartPhase.java:87)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:71)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:633)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:361)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:396)
at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:702)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:302)
at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:357)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:272)
at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:38)
at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:92)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:69)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:767)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
Caused by: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
... 92 more
AND..
javax.servlet.UnavailableException: Initializing application data source RoseKey
at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:812)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:335)
at javax.servlet.GenericServlet.init(GenericServlet.java:261)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:118)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1093)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:931)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4183)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4536)
at com.sun.enterprise.web.WebModule.start(WebModule.java:241)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:827)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:125)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:147)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:809)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1279)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1006)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:160)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:238)
at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:918)
at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:905)
at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:427)
at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:139)
at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:288)
at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:155)
at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:258)
at com.sun.enterprise.deployment.phasing.StartPhase.runPhase(StartPhase.java:87)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:71)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:633)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:361)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:396)
at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:702)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:302)
at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:357)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:272)
at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:38)
at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:92)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:69)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:767)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
Plz some1 help me as soon as possible with some ideas so that I can resolve the issue.Hi Amit Garg,
<data-sources>
<data-source type = "org.apache.commons.dbcp.BasicDataSource" key = "DBA">
</data-source>
<data-sources>
<data-source type = "org.apache.commons.dbcp.BasicDataSource" key = "AISDEV">
</data-source>
</data-sources>
u just configure ur struts-config.xml file in the above manner and use the following steps in ur action servlet to retrive the DataSource object
getDatasource(request,"DBA") for accessing first datasource
getDatasource(request,"AISDEV") for accessing second datasource.
byeeeeee -
Multiple Data source in Struts-Config.xml
Hi ,
I am Amit Garg and i am new to this forum....
Can any one help me out with the problem that i need to have 3 data source in my struts-config file and how will my getDatasource(request) method recoganise which data source to pick and access.Hi Amit Garg,
<data-sources>
<data-source type = "org.apache.commons.dbcp.BasicDataSource" key = "DBA">
</data-source>
<data-sources>
<data-source type = "org.apache.commons.dbcp.BasicDataSource" key = "AISDEV">
</data-source>
</data-sources>
u just configure ur struts-config.xml file in the above manner and use the following steps in ur action servlet to retrive the DataSource object
getDatasource(request,"DBA") for accessing first datasource
getDatasource(request,"AISDEV") for accessing second datasource.
byeeeeee -
Voluntary change of struts-config.xml
Why does JDev 10g change struts-config.xml file without programmer being aware of it?? It's the dumbest thing I have ever seen
I have this very same issue and agree that it is some of the oddest ide behavior possible. For instance, we use a struts forward, <forward name="success" path="/binaryFile"/>, of binaryFile to a servlet to display a dynamically created pdf in a browser. Sometimes, and I am not sure why, JDeveloper will modify struts-config.xml such that it will remove the binaryFile forwards, which results in complete application mis-configuration. Or, and this one is my least favorite, JDeveloper will edit the binaryFile forward by attaching .jsp to binaryFile such that it looks like this, <forward name="success" path="/binaryFile.jsp"/>, again causing application mis-configuration. My only guess is that JDeveloper does not see an extension like .do or .jsp and thinks it is doing the right thing by updating it for you. Has this been resolved in the latest version of JDeveloper?
Here is my JDev version,
Oracle IDE 10.1.2.17.84
Business Components Version 10.1.2.17.96
UML Modelers Version 10.1.2.16.71
Versioning Support 10.1.2.16.71
WebDAV Support Version 10.1.2.16.71
Struts Modeler Version 10.1.2.6.15
Designer Generators Framework 10.1.2.7.56
ADF UIX 2.2.16
CVS Client Version (CVS) 1.11.20 (client)
java.version 1.4.2_04
java.home C:\jdev1012\jdk\jre
java.vm.name Java HotSpot(TM) Client VM
java.vm.vendor Sun Microsystems Inc.
java.vm.version 1.4.2_04-b05
user.language en
user.region <no value assigned>
user.name eflynn
user.home C:\Documents and Settings\blah
user.dir C:\jdev1012\jdev\bin
os.name Windows XP
os.version 5.1
os.arch x86
http.proxyHost <no value assigned>
http.proxyPort <no value assigned>
http.nonProxyHosts <no value assigned>
ide.patches
ide.user.dir -
How to configure for struts-config.xml
Hi
I am having a JSp which is Mapped to anothr action through the registration.The registartion is mapped to action
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.struts.validator.ValidatorPlugIn" session="true" %>
<%@ page import="org.apache.struts.Globals" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<html:html locale="true">
<head>
<title><bean:message key="index.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
<logic:notPresent name="<%= Globals.MESSAGES_KEY %>" >
<font color="red">
ERROR: Application resources not loaded -- check servlet container
logs for error messages.
</font>
</logic:notPresent>
<%-- :TODO: Need code to do this with moudles
<logic:notPresent name="<%= ValidatorPlugIn.VALIDATOR_KEY %>" >
<font color="red">
ERROR: Validator resources not loaded -- check Commons Logging
logs for error messages.
</font>
</logic:notPresent>
--%>
<h3><bean:message key="registrationForm.title"/>1222AAAAAAAAAAAAA</h3>
<ul>
<li><html:link action="Test.jsp">Test212121.jsp</html:link >
<li><html:link action="/registration"><bean:message key="registrationForm.title"/></html:link></li>
<%System.out.println("hellooooooooooooo");%>
<!-- :TODO: Should have a non-JaveScript message-by-field example -->
<li>
<html:link action="/jsRegistration"><bean:message key="jsRegistrationForm.title"/></html:link> -
<bean:message key="jsRegistrationForm.description"/>
</li>
<li>
<html:link action="/multiRegistration"><bean:message key="multiRegistrationForm.title"/></html:link> -
<bean:message key="multiRegistrationForm.description"/>
</li>
</ul>
<a href="registration.jsp">Registration Test</a>
<p> </p>
<h3><bean:message key="typeForm.title"/></h3>
<ul>
<li>
<html:link action="/type"><bean:message key="typeForm.title"/></html:link> -
<bean:message key="typeForm.description"/>
</li>
<li>
<html:link action="/editJsType"><bean:message key="jsTypeForm.title"/></html:link> -
<bean:message key="jsTypeForm.description"/>
</li>
</ul>
<p> </p>
<h3>Change Language | Changez Le Langage</h3>
<ul>
<li><html:link action="/locale?language=en">English | Anglais</html:link></li>
<li>
<html:link action="/locale?language=fr">French | Francais</html:link> -
<bean:message key="localeForm.fr"/>
</li>
<li>
<html:link action="/locale?language=fr&country=CA">French Canadian | Francais Canadien</html:link> -
<bean:message key="localeForm.frCA"/>
</li>
<li>
<html:link action="/locale?language=ja" useLocalEncoding="true">Japanese | Japonais</html:link> -
<bean:message key="localeForm.ja"/>
</li>
</ul>
<p> </p>
==============struts-config.xml=================\<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<!--============================================== Form Bean Definitions -->
<form-beans>
<!-- Registration form bean -->
<form-bean name="registrationForm" type="validator.RegistrationForm" />
<!-- Multi-Part Registration form bean -->
<form-bean name="multiRegistrationForm" type="validator.RegistrationForm" />
<!-- Type form bean -->
<form-bean name="typeForm" type="validator.TypeForm" />
<!-- JavaScript Type form bean -->
<form-bean name="jsTypeForm" type="validator.TypeForm" />
</form-beans>
<!-- ======================================== Global Forward Definitions -->
<global-forwards>
<forward name="home" path="/index.jsp" />
</global-forwards>
<!-- ========================================= Action Mapping Definitions -->
<action-mappings>
<action path="/welcome" forward="/index.jsp" />
<!-- Registration Action
-->
<forward name="registration" path="/registration.do" /> //// ==========>here it is mapped
<action path="/registration" forward="/registration.jsp" />
<action path="/registration-submit" type="validator.RegistrationAction" name="registrationForm" scope="request" validate="true" input="input">
<forward name="input" path="/registration.do" />
<forward name="success" path="/index.jsp" />
</action>
<action path="/jsRegistration" forward="/jsRegistration.jsp" />
<!-- Multi-Part Registration Action -->
<action path="/multiRegistration" forward="/multiRegistration1.jsp" />
<action path="/multiRegistration-submit" type="validator.MultiRegistrationAction" name="multiRegistrationForm" scope="request" validate="false">
<forward name="success" path="/welcome.do" />
<forward name="input1" path="/multiRegistration1.jsp" />
<forward name="input2" path="/multiRegistration2.jsp" />
</action>
<!-- Type Action -->
<action path="/type" forward="/type.jsp" />
<action path="/type-submit" type="validator.TypeAction" name="typeForm" scope="request" validate="true" input="input">
<forward name="input" path="/type.do" />
<forward name="success" path="/welcome.do" />
</action>
<!-- JavaScript Type Action -->
<action path="/editJsType" type="validator.EditTypeAction" scope="request" validate="false">
<forward name="success" path="/jsType.do" />
</action>
<action path="/jsType" forward="/jsType.jsp" />
<action path="/jsType-submit" type="validator.TypeAction" name="jsTypeForm" scope="request" validate="true" input="input">
<forward name="input" path="/editJsType-submit.do?typeForm.reset=false" />
<forward name="success" path="/welcome.do" />
</action>
<!-- Locale Action -->
<action path="/locale" type="validator.LocaleAction" name="localeForm" scope="request">
<forward name="success" path="/welcome.do" />
</action>
</action-mappings>
<!-- ============================================= Controller Definition -->
<controller inputForward="true" />
<!-- ===================================== Message Resources Definitions -->
<message-resources parameter="validator.MessageResources" />
<!-- ============================================ Plug Ins Configuration -->
<!--
Add multiple validator resource files by setting the pathnames property
with a comma delimitted list of resource files to load.
-->
<plug-in className="validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validator/validation.xml" />
<set-property property="stopOnFirstError" value="true" />
</plug-in>
</struts-config>
<html:img page="/struts-power.gif" altKey="index.powered"/>
</body>
</html:html>Hey,
U can do it the way u want. Use DispatchAction Class instead of Action Class. Just go through the documentation for this. If u still have problem let me know.
Thanks
KM
Hi,
I am new to struts and when i am doing my application i find some >>difficulty i.e,
I have two buttons on a jsp page Save,Delete.when I click on >>save ,saveAction must be called.if we click delete deleteAction to be >>called.
for this how can I configure in struts-config.xml file. and how it >>knows which button has been clicked.
Can any one please guid me.
Thanks -
Passing a QueryString in Struts-Config.xml
Hi,
How to pass a queryString in Struts-Config.xml??
For eg,
<forward name="Success" path="/TestAction.do?method=nextPage&Id=100">
</forward>
Not working in struts 1.1. Where it is taking only one parameter where it is not taking the "&" part?? What is the problem here. Please do provide
a solution for this.
Thanks,
JavaCrazyLoverHi
If you want to pass two or more parameters in struts-config.xml do it like this
eg : <forward name="Success" path="/TestAction.do?method=nextPage&Id=100">
</forward>
It worked for me. instead of & use & -
Using chinese characters in struts-config.xml
Hi
i am developing an application in Chinese language where i need to create all the urls in the Chinese language. i am using struts 1.3.5.can anyone tell me is it possible to use Chinese characters in struts-config.xml action mappings? i tried but it is not working. is there ant way really?
Regards,
A.Don't know about struts specifically, but for Chinese URLs to work you would need to convert to punycode at some point, to comply with IDNA: http://en.wikipedia.org/wiki/Punycode
Are you doing that? -
Jdev 11g - Error while opening struts-config.xml
Hi,
could you help me please, I have this error when I try to open my struts-config.xml file:
Message
BME-99003: An error occurred, so processing could not continue.
Cause
The application has tried to de-reference an invalid pointer. This exception should have been dealt with programmatically. The current activity may fail and the system may have been left in an unstable state. The following is a stack trace.
java.lang.NullPointerException
at oracle.bm.diagrammer.shape.helper.Polyline.getExtent(Polyline.java:314)
at oracle.bm.diagrammer.shape.BaseDiagramEdge.getExtent(BaseDiagramEdge.java:1482)
at oracle.bm.diagrammer.util.BaseShapeSet.getExtent(BaseShapeSet.java:569)
at oracle.bm.diagrammer.BaseDiagram.getDiagramResizeSize(BaseDiagram.java:3933)
at oracle.bm.diagrammer.BaseDiagram$DiagramRemovePagesLockMonitor.doReleaseAction(BaseDiagram.java:2548)
at oracle.bm.diagrammer.DistributableLockMonitor.releaseDistributableLock(DistributableLockMonitor.java:99)
at oracle.bm.diagrammer.DistributableLockMonitor.performLockedAction(DistributableLockMonitor.java:79)
at oracle.bm.diagrammer.BaseDiagram.performDiagramRemovePagesLockedAction(BaseDiagram.java:2581)
at oracle.bm.addinUtil.IDEAppContext.buildDiagramImpl(IDEAppContext.java:2509)
at oracle.bm.addinUtil.IDEAppContext.buildDiagram(IDEAppContext.java:2327)
at oracle.bm.addinUtil.DiagAppPanel.buildDiagram(DiagAppPanel.java:50)
at oracle.bm.addinUtil.IDEAppContext.openLoad(IDEAppContext.java:3857)
at oracle.bm.addinUtil.IDEAppContext.open(IDEAppContext.java:3517)
at oracle.adfdt.controller.diagram.PageFlowEditor.open(PageFlowEditor.java:82)
at oracle.ideimpl.editor.EditorState.openEditor(EditorState.java:276)
at oracle.ideimpl.editor.EditorState.createEditor(EditorState.java:181)
at oracle.ideimpl.editor.EditorState.getOrCreateEditor(EditorState.java:94)
at oracle.ideimpl.editor.SplitPaneState.canSetEditorStatePos(SplitPaneState.java:231)
at oracle.ideimpl.editor.SplitPaneState.setCurrentEditorStatePos(SplitPaneState.java:194)
at oracle.ideimpl.editor.TabGroupState.createSplitPaneState(TabGroupState.java:103)
at oracle.ideimpl.editor.TabGroup.addTabGroupState(TabGroup.java:379)
at oracle.ideimpl.editor.EditorManagerImpl.createEditor(EditorManagerImpl.java:1400)
at oracle.ideimpl.editor.EditorManagerImpl.createEditor(EditorManagerImpl.java:1334)
at oracle.ideimpl.editor.EditorManagerImpl.openEditor(EditorManagerImpl.java:1260)
at oracle.ideimpl.navigator.OpenEditorController.whenOpenEditor(OpenEditorController.java:41)
at oracle.ideimpl.navigator.OpenEditorContextMenuListener.handleDefaultAction(OpenEditorContextMenuListener.java:51)
at oracle.ide.controller.ContextMenuListenersHook$LazyContextMenuListener.handleDefaultAction(ContextMenuListenersHook.java:199)
at oracle.ide.controller.ContextMenu.fireDefaultAction(ContextMenu.java:412)
at oracle.ideimpl.explorer.BaseTreeExplorer.fireDefaultAction(BaseTreeExplorer.java:1792)
at oracle.ideimpl.explorer.BaseTreeExplorer.dblClicked(BaseTreeExplorer.java:2127)
at oracle.ideimpl.explorer.BaseTreeExplorer.mouseReleased(BaseTreeExplorer.java:2148)
at oracle.ideimpl.explorer.CustomTree.processMouseEvent(CustomTree.java:198)
at java.awt.Component.processEvent(Component.java:5806)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4413)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2440)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Action
If further errors occur, you should restart the application.
Also, report the problem on the JDeveloper forum on otn.oracle.com, or contact Oracle support, giving the information from this message.
________________________________________________________________________________Hi,
I have recreate my file from scratch and it is working now... JDev replace its old oxd file and it is working, maybe it was during the migration process from 10.1.3.4 to 11.1.1.0.2. -
No route to host:connect -- error in the struts-config.xml file
hi all,
acutally am doing a struts application in that i have written everything properly
but getting this kinda no route to host:connect error
my struts-config.xml file is like this...
<struts-config>
<form-beans>
<form-bean name="myForm" type="MyForm">
</form-beans>
<action-mappings>
<action path="/action"
name="myForm"
type="MyAction"
scope="request"
validate="true" >
<forward name="success" path="/success.jsp" />
<forward name="failure" path="/failure.jsp" />
</action>
</action-mappings>
</struts-config>
sikandarHi Lee,
I am working on Oracle ADF 10.1.2 and getting the same problem. The lines in my struts-config.xml are as below:
<action path="/unitsView" className="oracle.adf.controller.struts.actions.DataActionMapping" type="view.UnitsViewAction" name="DataForm" parameter="/unitsView.uix" unknown="false">
<set-property property="modelReference" value="unitsViewUIModel"/>
<forward name="unitsEditLink" path="/unitsEdit.do"/>
</action>
<action path="/unitsView" className="oracle.adf.controller.struts.actions.DataActionMapping" type="view.UnitsViewAction" name="DataForm" parameter="/unitsView.uix" unknown="false">
<set-property property="modelReference" value="unitsViewUIModel"/>
<forward name="unitsCreateLink" path="/unitsCreate.do"/>
</action>
I have two lines with [action path="/unitsView"]. The reason why is that I want the user to go to the form create screen for the create button and form edit screen for the edit button. If this does not work, it seems to mean that only a single screen can be used for create/edit functions. However, the ADF editor diagram looks perfectly to point to create.uix and edit.uix respectively.
Please shed some light.
Thanks,
Regards,
Michael -
Exception in global forwards in strut-config.xml
Hi friends,
i am doing a global forward and i am getting the following exception. without global forward in strut-config.xml it works fine.exception
javax.servlet.ServletException: Cannot find global ActionForward for name welcome
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:76)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
javax.servlet.jsp.JspException: Cannot find global ActionForward for name welcome
org.apache.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:142)
org.apache.jsp.test_jsp._jspx_meth_logic_forward_0(org.apache.jsp.test_jsp:93)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:64)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)my struts-config.xml is
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<!-- ========== Global Forward Definitions ============================== -->
<global-forwards>
<forward name="welcome" path="/LPCIndex/doit.do" redirect="true"/>
</global-forwards>
<!-- ========== Action Mapping Definitions ============================== -->
<action-mappings>
<action
path="/doit"
type="com.hsbc.lpcintex.LPCIntexAction">
<forward name="success" path="/index.jsp"/>
</action>
</action-mappings>
</struts-config>my web.xml
is
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<!-- JSPC servlet mappings start -->
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>test.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>0</session-timeout>
</session-config>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- JSPC servlet mappings end -->
</web-app>and my jsp code is
<%@ page language="java" import="com.hsbc.lpcintex.*" import="java.io.*"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<html>
<body>
<logic:forward name="welcome"/>
</body>
</html>any help please
thanks
Rits done by adding
<load-on-startup>2</load-on-startup>to web.xml -
More than one struts-config.xml files in one project
Hi all
Can we have more than one struts-config.xml files in one project developed using struts.
If so what is purpose and how to do this.
Anybody please explain on this topic.
Thanks
ParvathyHi all
Can we have more than one struts-config.xml files in
one project developed using struts.
yes it is possible
If so what is purpose and how to do this.
it is use for odular application so developer won't share a single configureation file.. as you know struts-config.xml is defined on the web.xml
like this:
<servlet>
<servlet-name>mybank</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/module1</param-name>
<param-value>
/WEB-INF/struts-module1-config.xml
</param-value>
</init-param>
</servlet> -
A function in my struts-config.xml file
Struts: Calling a function from a JSP
Author: boltonian
Hi, I have defined a function listConfig.do in my struts-config.xml, I was wondering how I can get a .jsp >>page to automatically call this fucntion whenenver it is loaded. What did the author of this post mean when they said "I have defined a function in my xml file"
Trying to get my head round this whole struts thing...Check out this page mate
http://www.reumann.net/struts/lesson1.do -
How to use data-sources tag in struts-config.xml
hi all,
I am doing programs in sturts. My program purpose is to retrieve data from the database.My database is MySql. I know that we can write connection code in Action Class, it is ok for some less prog's if i want to use the sane connection code in more Action Classes it is vasting time and so.
So i want to use <data-sources> tag that is available in struts-config.xml. I know that thre is tag with this name, but the problem is i don't know how to use this tag. If any budy know how to use this please tell me the syntax or any example.
plese... reply soon..hi all,
I am doing programs in sturts. My program
My program purpose is to retrieve data from the
database.My database is MySql. I know that we can
write connection code in Action Class, it is ok for
some less prog's if i want to use the sane connection
code in more Action Classes it is vasting time and
so.I don't think it's a good idea to put database code in Action classes. (That's one of the biggest drawbacks of Struts - it's completely tied to Actions, HTTP, and the Web.) Better to move that code into plain old Java objects and let the Actions call them.
You'll be able to test them without the container or Struts, and you'll be able to reuse those objects in other, non-Web contexts.
So i want to use <data-sources> tag that is available
in struts-config.xml. I know that thre is tag withThis is the wrong place to configure a connection pool, too. Struts should have nothing to do with it. What if you change Web frameworks to WebWork or Spring? The connection pool should be configured in the container that hosts your app, not Struts.
this name, but the problem is i don't know how to use
this tag. If any budy know how to use this please
tell me the syntax or any example.
plese... reply soon..Don't do it. Think about doing it in your container, not Struts.
% -
ERROR PARSING MY STRUTS-CONFIG.XML...
Hi everyOne!
I need to get this connection:
("jdbc:mysql://localhost:3306/netinfoa_amt?characterEncoding=UTF-8&useUnicode=true", "root", "****");
using <data-sources> declared on my STRUTS-CONFIG.XML
no problem with:
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="autoCommit" value="false"/>
<set-property property="driverClassName" value="org.gjt.mm.mysql.Driver"/>
<set-property property="url" value="jdbc:mysql://localhost:3306/netinfoa_amt" />
<set-property property="username" value="root"/>
<set-property property="password" value="****"/>
</data-source>
</data-sources>But i have this problem: org.xml.sax.SAXParseException: The reference to entity "useUnicode" must end with the ';' delimiter.
trying:
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="autoCommit" value="false"/>
<set-property property="driverClassName" value="org.gjt.mm.mysql.Driver"/>
<set-property property="url" value="jdbc:mysql://localhost:3306/netinfoa_amt?characterEncoding=UTF-8&useUnicode=true" />
<set-property property="username" value="root"/>
<set-property property="password" value="****"/>
</data-source>
</data-sources>I also tried
<set-property property="useUnicode" value="true" />
<set-property property="characterEncoding" value="UTF-8" />
but it doesn't work... any idea?
thank!Usually, a 503 means that WebLogic can't find the compiler it needs to compile your JSPs. Check your weblogic.xml for the compiler param (forgot the exact name) in the jsp section (<jsp:descriptor>).
If the above doesn't apply to your case, I'm afraid I can't be of much further help...
Maybe you are looking for
-
when i type in a search, firefox says it's not responding. Although firefox still showing not responding I am taken to websites that I did not request. I tried to reset firefox but it said there is a problem because one or more windows tabs are open
-
Calling web service method.Stuck in while loop
I am implementing a board game using asp.net web service. Players connect to this web service and play. Once player click on a cell in board it should be written to web service and other players board repaint according to that click.Writtting to web
-
I'm moving and cancelling my cell phone. Can I use my present cell number for my Skype online #
-
Authorization Control for Transfer Posting's Storage Location
Dear Gurus, Hi ! May I know is that SAP has any Authorization Object to control Transfer Posting (SAP R3 4.0B) ? Let say in MB1B I only allow certain user to do transfer posting with P230 storage location, how should I control it ? With Authorization
-
Strategies to keep the Zen Xtra cover from popping o
OK - I had heard that the Zen Xtra cover pops off easy before I bought it and thought it couldn't be all that bad But it seems like all I have to do is touch my player sometimes and the cover pops off I put a piece of tape on the latch on the bottom