为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

眼尖的来看看吧小弟我快崩溃了。struts2简单配置

2017-12-28 4页 doc 17KB 14阅读

用户头像

is_686908

暂无简介

举报
眼尖的来看看吧小弟我快崩溃了。struts2简单配置眼尖的来看看吧小弟我快崩溃了。struts2简单配置 眼尖的来看看吧。我快崩溃了。struts2简单配置 本帖最后由 AA5279AA 于 2013-01-25 13:59:55 编辑 做一个小项目,本来没问题。 后来换了个一个开发编辑工具,就开始出问题了。。 大家帮忙看看问题出在哪了吧, 今天遇到的问题太多,头痛,实在解决不了了。 下面是简化的,登陆页面: html head meta charset= UTF-8 title Insert title here /title /head body ...
眼尖的来看看吧小弟我快崩溃了。struts2简单配置
眼尖的来看看吧小弟我快崩溃了。struts2简单配置 眼尖的来看看吧。我快崩溃了。struts2简单配置 本帖最后由 AA5279AA 于 2013-01-25 13:59:55 编辑 做一个小项目,本来没问。 后来换了个一个开发编辑工具,就开始出问题了。。 大家帮忙看看问题出在哪了吧, 今天遇到的问题太多,头痛,实在解决不了了。 下面是简化的,登陆页面: html head meta charset= UTF-8 title Insert title here /title /head body form action= login method= get 姓名: input name= name type= text /input br 密码: input name= password type= password /input br input type= submit value= 注册 /input /form /body /html 下面是struts配置: package name= myPackage namespace= /resources extends= base !-- default-class-ref class= / -- global-results result name= success /resources/loginsuccess.jsp /result result name= error /resources/error.html /result /global-results action name= login method= logins class= cn.test.springTest.LoginAction /action action name= register method= execute class= cn.test.springTest.RegisterAction /action /package 下面就是action层了。 public class LoginAction extends ActionSupport{ String name; String password; public String logins(){ //ActionContext ac = ActionContext.getContext(); HttpServletRequest request=ServletActionContext.getRequest(); try { request.setCharacterEncoding( UTF-8 ); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } request.setAttribute( name , name); request.setAttribute( password , password); System.out.println( in login ); if((name!=null) (password!=null)){ System.out.println( 用户信息已经接受 ); System.out.println( 用户名为 +name+ ,密码为: +password); return SUCCESS; }else{ System.out.println( 用户名或者密码为空 ); return ERROR; } } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } 出现问题:logins()这个方法不运行。。。 页面也不报错,页面的过滤问题好像被我的过滤器给过滤了。 求帮忙。 报错信息:WARN : org.apache.struts2.dispatcher.Dispatcher - Could not find action or result There is no Action mapped for action name login. - [unknown location] ------解决-------------------------------------------------------- form的action地址不是login form action= login .action method= get ------解决方案-------------------------------------------------------- form action= login!logins method= get 这样试试 ------解决方案-------------------------------------------------------- 在struts配置文件配置了namespace= /resources , form action= login method= get 应 该要指定namespace才对,不然默认是到namespace=“/”里面找吧,是不是这样,
/
本文档为【眼尖的来看看吧小弟我快崩溃了。struts2简单配置】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索