jsp页面 struts2标签 <s:form >提交问题 50
下面这段代码,为什么我在<div>里面把forminputpasswordsubmit改成struts标签后username/password值不能传到model里,而我...
下面这段代码,为什么我在<div>里面把form input password submit 改成struts标签后username/password 值不能传到model里,而我在<div>外面写了个新的 <s:form>就可以提交到后台 model, 我用的是 ModelDriven
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>集群监控管理系统-登陆</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/bootstrap.css">
<style>
/*登陆*/
body,html {
height: 100%;
background: #fafafa;
}
.forharfheight {
height: 30%;
}
.loginbox {
padding: 15px 25px 25px;
border: 1px solid rgba(177, 177, 177, 1);
border-radius: 5px;
box-shadow: 0 1px 5px #ccc
}
button {
width: 100%
}
</style>
</head>
<body>
<!-- <div class="forharfheight"></div>
<div class="container">
<div class="row">
<div class="col-sm-4 col-sm-offset-4 loginbox">
<form role="form">
<div class="form-group">
<label for="exampleInputEmail1">用户名</label> <input type="text"
class="form-control" id="exampleInputEmail1" placeholder="请输入用户名">
</div>
<div class="form-group">
<label for="exampleInputPassword1">密码</label> <input
type="password" class="form-control" id="exampleInputPassword1"
placeholder="请输入密码">
</div>
<button type="submit" class="btn btn-primary ">提交</button>
</form>
</div>
</div>
</div> -->
<s:form action="user_login" namespace="/" method="post">
<s:textfield placeholder="请输入用户名" name="username" ></s:textfield>
<s:textfield placeholder="请输入密码" name="password" ></s:textfield>
<s:submit value="提交"></s:submit>
</s:form>
</body>
</html> 展开
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>集群监控管理系统-登陆</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/bootstrap.css">
<style>
/*登陆*/
body,html {
height: 100%;
background: #fafafa;
}
.forharfheight {
height: 30%;
}
.loginbox {
padding: 15px 25px 25px;
border: 1px solid rgba(177, 177, 177, 1);
border-radius: 5px;
box-shadow: 0 1px 5px #ccc
}
button {
width: 100%
}
</style>
</head>
<body>
<!-- <div class="forharfheight"></div>
<div class="container">
<div class="row">
<div class="col-sm-4 col-sm-offset-4 loginbox">
<form role="form">
<div class="form-group">
<label for="exampleInputEmail1">用户名</label> <input type="text"
class="form-control" id="exampleInputEmail1" placeholder="请输入用户名">
</div>
<div class="form-group">
<label for="exampleInputPassword1">密码</label> <input
type="password" class="form-control" id="exampleInputPassword1"
placeholder="请输入密码">
</div>
<button type="submit" class="btn btn-primary ">提交</button>
</form>
</div>
</div>
</div> -->
<s:form action="user_login" namespace="/" method="post">
<s:textfield placeholder="请输入用户名" name="username" ></s:textfield>
<s:textfield placeholder="请输入密码" name="password" ></s:textfield>
<s:submit value="提交"></s:submit>
</s:form>
</body>
</html> 展开
展开全部
路径是不是要写成user_login.action ?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<form role="form"> 你div里面的没写提交路径,要往哪儿跳?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
div中form的提交路径呢?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询