关于struts数据源的问题,十万火急!大家帮忙啊!
我在myeclipse下写了个简单的用户登录struts,用户名是预先固定的。现在想通过访问数据库来验证用户。我首先在struts-config.xml中配置数据源如下:
<data-sources >
<data-source key= "t " type= "org.apache.struts.util.GenericDataSource ">
<set-property property= "password " value= " " />
<set-property property= "minCount " value= " " />
<set-property property= "maxCount " value= " " />
<set-property property= "username " value= "sa " />
<set-property property= "driverClassName " value= "com.microsoft.jdbc.sqlserver.SQLServerDriver " />
<set-property property= "description " value= " " />
<set-property property= "url " value= "jdbc:microsoft:sqlserver://localhost:1433;databaseName=t " />
<set-property property= "readOnly " value= "false " />
<set-property property= "autoCommit " value= "false " />
</data-source>
</data-sources>
然后运行原有的struts,却错误:
HTTP Status 404 - Servlet action is not available
我的目的是看看数据源是否能正常使用
还有我看到网上很多例子是使用org.apache.commons.dbcp.BasicDataSource连接池,而不用struts自带的org.apache.struts.util.GenericDataSource ,为什么啊!谢谢!
[解决办法]
<data-source>
<set-property property= "key " value= "sqlDS " />
<set-property property= "type " value= "javax.sql.DataSource " />
<set-property property= "driverClass " value= "com.microsoft.jdbc.sqlserver.SQLServerDriver " />
<set-property property= "url " value= "jdbc:microsoft:sqlserver://localhost:1433;databaseName " />
<set-property property= "maxCount " value= "20 " />
<set-property property= "minCount " value= "2 " />
<set-property property= "user " value= "userName " />
<set-property property= "password " value= "userPassword " />
</data-source>
[解决办法]
得看struts版本,myeclipse生成的配置文件有错误
[解决办法]
HTTP Status 404 - Servlet action is not available
是servlet配置有问题
------解决方案--------------------
你程序启动时没有找到你的action...
建议你检查一下你的配置文件...
[解决办法]
一看、你的配置文件就有问题,1楼的还不错,用来试试看