我用了struts1.3,但是在配置struts-config-xml的时候,一填上标签就会出错,提示:
The content of element type "struts-config" must match "(display-
name?,description?,form-beans?,global-exceptions?,global-
forwards?,action-mappings?,controller?,message-resources*,plug-in*)".
但是不填这个的话就不会有这个问题,这是为什么啊?
property="driverClassName"
value="com.mysql.jdbc.Driver" />
property="url"
value="jdbc:mysql://192.168.0.1/test" />
property="username"
value="username" />
property="password"
value="password" />
property="maxActive"
value="100" />
property="maxWait"
value="5000" />
property="defaultAutoCommit"
value="false" />
这是一个我在做项目中连接mysql的例子。。
你根据你的数据库做适当的调整。。
做的时候别忘记引入你要用的sql驱动包。
在你的Action子类中的execute方法中,,得到数据源
DataSource ds = getDataSource(request);
把数据源传给数据库处理类,这里的Jua08DAO是我自定义的一个关于数据库操作的一个类
Jua08DAO outD = new Jua08DAO(ds);
conn = this.ds.getConnection();
你按照提示 把配置的顺序换一换。。。具体的你自己代码看看。
我没用过
帮不了你,数据在struts xml里需要这个配置,struts 主要是 做控制层嘛。