页面URL :http://localhost:8080/MessageBoard/message.do?param=doSave 症状: 提交后地址(提交后地址上面)变了 页面空白 控制台无异常抛出struts XML如下
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"><struts-config>
<form-beans >
<form-bean name="messageForm" type="web.form.MessageForm" /> </form-beans> <global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="messageForm"
input="/form/message.jsp"
name="messageForm"
parameter="param"
path="/message"
scope="request"
type="web.action.system.MessageAction"
>
<forward name="list" path="/form/messageList.jsp" />
</action> </action-mappings>
<controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor" /> <message-resources parameter="web.ApplicationResources" />
</struts-config>spring XML如下<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<description>Spring 数据源、session工厂、事务、日志公共配置</description>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost:3306/test"></property>
<property name="username" value="root"></property>
<property name="password" value="123"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQL5InnoDBDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.default_batch_fetch_size">32</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>entity/Message.hbm.xml</value>
</list>
</property>
</bean> <!--定义了hibernate的事务管理器 -->
<bean id="hibernateTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <!-- 定义事务通知-->
<tx:advice transaction-manager="hibernateTransactionManager"
id="txAdvice">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED"></tx:method>
</tx:attributes>
</tx:advice>
<!-- DAO -->
<bean id="messageDaoImp" class="dao.system.MessageDaoImp">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Service -->
<bean id="messageServiceImp" class="service.system.MessageServiceImp">
<property name="baseDao" ref="messageDaoImp"></property>
</bean>
<!-- Action -->
<bean name="/message" class="web.action.system.MessageAction">
<property name="messageService" ref="messageServiceImp"></property>
</bean>
</beans>
JSP 如下<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<html>
<body>
<html:form action="/message?param=doSave">
姓名: <html:text property="message.name"/><br/>
IP: <html:text property="message.ip"/><br/>
内容 : <html:text property="message.content"/><br/>
<html:submit/><html:cancel/>
</html:form>
</body>
</html>望朋友指点 告诉下错在那里
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"><struts-config>
<form-beans >
<form-bean name="messageForm" type="web.form.MessageForm" /> </form-beans> <global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="messageForm"
input="/form/message.jsp"
name="messageForm"
parameter="param"
path="/message"
scope="request"
type="web.action.system.MessageAction"
>
<forward name="list" path="/form/messageList.jsp" />
</action> </action-mappings>
<controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor" /> <message-resources parameter="web.ApplicationResources" />
</struts-config>spring XML如下<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<description>Spring 数据源、session工厂、事务、日志公共配置</description>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost:3306/test"></property>
<property name="username" value="root"></property>
<property name="password" value="123"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQL5InnoDBDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.default_batch_fetch_size">32</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>entity/Message.hbm.xml</value>
</list>
</property>
</bean> <!--定义了hibernate的事务管理器 -->
<bean id="hibernateTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <!-- 定义事务通知-->
<tx:advice transaction-manager="hibernateTransactionManager"
id="txAdvice">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED"></tx:method>
</tx:attributes>
</tx:advice>
<!-- DAO -->
<bean id="messageDaoImp" class="dao.system.MessageDaoImp">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Service -->
<bean id="messageServiceImp" class="service.system.MessageServiceImp">
<property name="baseDao" ref="messageDaoImp"></property>
</bean>
<!-- Action -->
<bean name="/message" class="web.action.system.MessageAction">
<property name="messageService" ref="messageServiceImp"></property>
</bean>
</beans>
JSP 如下<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<html>
<body>
<html:form action="/message?param=doSave">
姓名: <html:text property="message.name"/><br/>
IP: <html:text property="message.ip"/><br/>
内容 : <html:text property="message.content"/><br/>
<html:submit/><html:cancel/>
</html:form>
</body>
</html>望朋友指点 告诉下错在那里
解决方案 »
- Tomcat安装执行startup.bat一闪而过,Tomcat连接myeclipse问题
- 网站注册代码怎么隐藏PHP链接?
- 上传图片一般用什么?
- 在JSP页面中怎么格式化从数据库中取出的日期类型数据?
- SSH2框架问题,不用框架的就是垃圾?
- 国外访问不了我们网站的一个查询功能????
- 大虾们指点啊!在tomcat下用servlet读文件问题?
- [REQ]JSP向数据库添加记录后在数据库里显示的都是乱码?
- 简单的request问题~~谢谢!
- rs.last()语句之后,为什么连out.print("try!")都不能执行?
- 求 当前日期 的周一 和周日 日期(以周一为一周的开始)
- JSP页面静态化
二是DispatchAction里重写了execute方法