表单Form中的action怎么填(Struts篇)
来源:互联网 发布:无标度网络是什么意思 编辑:程序博客网 时间:2024/04/29 23:59
今天突然发现,form中的action=“/login”居然是错误的。突发奇想,就想对url做个探究。
还有好多人是用${requestScope….},我也想做个实验,加深影响。
继续探究吧,想看最后结论,请下拉…(记得点赞,谢谢!)
Action:
package com.stu;import java.util.Date;import com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport { private User user; public void setUser(User user) { this.user = user; } public User getUser() { return user; } public String Login(){ System.out.println("In login: "); System.out.println("id: "+user.getId()); System.out.println("pw: "+user.getPw()); System.out.println("age: "+user.getPw()); return SUCCESS; }}
Struts.xml:
<package name="convert" extends="struts-default" namespace="/"> <action class="com.stu.UserAction" name="Login" method="Login"> <result name="success">/success.jsp</result> </action> </package>
success.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>My JSP 'success.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> This is my Success page.!!!! <br> </body></html>
login.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>My JSP 'login.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <form action="Login" method="post"> 用户名:<input type="text" name="user.id" /><br/> 密码:<input type="text" name="user.pw" /><br/> 年龄:<input type="text" name="user.age" /><br/> <input type="submit" value="提交"/> </form> <br> </body></html>
好吧,接下来我们在login.jsp中下文章咯:
Action 在默认命名空间下。
(明日更新!!!)
0 0
- 表单Form中的action怎么填(Struts篇)
- form表单中的action参数
- form表单中的action参数
- form表单中的action属性
- struts中form表单中的请求action路径和struts-config.xml中响应路径的注意点
- Form表单中的action提交路径问题
- CodeIgniter form表单中的action如何写
- Form表单中的action路径问题
- Form表单中的action提交路径问题
- Form表单中的action提交路径问题
- struts学习之form表单, 配置文件action对应关系。
- form 表单传值到Struts Action 出现的问题
- struts form表单提交action处理之后没有跳转页面
- form表单的action
- form表单之action
- form表单action提交
- jsp中form表单绑定action中的方法
- jsp中的表单form action指向servlet类
- template vector 的实现
- Lua中模式匹配
- Maven创建一个Java工程
- 离职后的10个月
- xcode下编写c++
- 表单Form中的action怎么填(Struts篇)
- SEO搜索命令大全
- jPlayer实例
- 二叉树系列4:lowest common ancestor
- div内容垂直居中对齐
- linux用户管理(1)----创建用户(adduser和useradd)和删除用户(userdel)
- Webview
- 两个Fragment切换,BFragment中的listview 数据获取回来 为什第一次进入不显示第二次进入数据就显示了呢?ListView网络数据没有及时更新
- POJ 3255 解题报告