修改action
来源:互联网 发布:excel编程入门教程 编辑:程序博客网 时间:2024/05/22 03:28
更改源文件MyAction.java
package strutsdemo;
import org.apache.struts.action.*;
import javax.servlet.http.*;
public class MyAction extends Action {
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
/**@todo: complete the business logic here, this is just a skeleton.*/
MyActionForm myActionForm = (MyActionForm) actionForm;
throw new java.lang.UnsupportedOperationException("Method perform() not yet implemented.");
}
}
更改为:
package strutsdemo;
import org.apache.struts.action.*;
import javax.servlet.http.*;
public class MyAction extends Action {
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
/**@todo: complete the business logic here, this is just a skeleton.*/
MyActionForm myActionForm = (MyActionForm) actionForm;
//获得由login.jsp 传来的用户名
String username=myActionForm.getUserName();
//获得由login.jsp 传来的密码
String pass= myActionForm.getPassWord();
String target;//定义转向
//执行逻辑部分
if (username.equalsIgnoreCase("JYD") && pass.equals("12345")) {
target="ok"; //转到ok.jsp
//可通过 HttpServletRequest 传值
httpServletRequest.setAttribute("status","登陆成功");
}
else
{
target="error"; //转到 error.jsp
//可通过 HttpServletRequest 传值
httpServletRequest.setAttribute("status","登陆失败");
}
return actionMapping.findForward(target);
// throw new java.lang.UnsupportedOperationException("Method perform() not yet implemented.");
}
}
- 修改action
- 修改action的后缀
- 修改.action后缀
- struts2 action 扩展名的修改
- struts2 修改action的后缀
- struts2修改action的后缀名
- 修改struts2的.action后缀名
- 修改struts2的.action后缀名
- 修改Action类不重启tomcat方法 .
- Struts2 Action扩展名的修改
- 修改struts2的.action后缀名
- struts2 修改action的后缀
- 修改android4.x action bar 背景修改
- Struts 2 Action 的扩展名修改方法
- Struts2 action的扩展名修改方法
- javascript修改struts form的action属性
- struts中action的修改方法
- js form action动态修改方法
- 驱动学习笔记–irp
- Python的reduce
- 功能强大的串口工具:GhostyComm 4.0(万能通讯精灵)
- 越是基础越是强大--英语对做软件的影响,是全方位的
- pb 编程好多年
- 修改action
- 如何防止基于ICMP的网络攻击
- MySQL 客户端游标未启用导致BLOB更新失败
- 初试My-SQL
- 数码管程序
- 使用Java实现Comet风格的Web应用
- 键盘调节数码管
- Spring配置文件applicationContext.xml的两种拆分方式
- IList 接口