SSH 问题 提交按钮后能form能正常填装数据 但就是不能实例化action
SSH框架做的 form能正常工作 应该说明我的web和struts-confing的配置 页面没什么问题
action代码[code="java"]
public class RegeditAction extends Action {
private UserService service;
private boolean check = true;
public void setService(UserService service) {
this.service = service;
}
public UserService getService() {
return this.service;
}
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response)
throws Exception {
System.out.println("action xxx");
RegeditForm reForm = (RegeditForm) form;
UserInfor user = new UserInfor();
String name = reForm.getUserName();
UserInfor checkName = service.checkNewUserName(name);
if(checkName == null){
check = false;
}
[/code]
strust-config:[code="java"]
[/code]
spring管理action
[code="java"]
[/code]
急啊 两三天了 揪心啊
[quote]改正public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response) 看看[/quote]错了,是[quote]public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,HttpServletResponse response)
[quote]但就是不能实例化action[/quote]
什么意思啊?不懂,到底什么错啊?
[quote] System.out.println("action xxx"); [/quote]
这句话没执行是吧?
在下面这句话上面加个断点,看看是找不到方法还是找不到action
[quote]private UserService service;[/quote]
如果只是个简单的集成,那就把 action 交给spring去创建
步骤1. 在struts-config.xml配置插件
[code="xml"]<?xml version="1.0" encoding="GBK"?>
... ...
className="org.springframework.web.struts.ContextLoaderPlugIn">
value="classpath:applicationContext.xml" />
[/code]
步骤2. 修改Action Bean配置
[code="xml"]<?xml version="1.0" encoding="GBK"?>
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy">
[/code]
步骤3. 在Spring配置文件中配置Action Bean,将Biz注入
[code="java"]
[/code]
[quote]加了断电后 启动服务器时debug就入action了 [/quote]
你的那个打印语句没执行,对吗?那就是找不到方法
你spring容器在哪初始化的 ???、查查吧
[quote]public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response) [/quote]
改正public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response) 看看