login.jsp<%@ page language="java" import="java.util.List" pageEncoding="gbk"%><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>管理平台</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
overflow:hidden;
}
.STYLE3 {color: #528311; font-size: 12px; }
.STYLE4 {
color: #42870a;
font-size: 12px;
}
-->
</style></head><body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#e5f6cf"> </td>
</tr>
<tr>
<td height="608" background="images/login_03.gif"><table width="862" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="266" background="images/login_04.gif"> </td>
</tr>
<tr>
<td height="95"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="424" height="95" background="images/login_06.gif"> </td>
<td width="183" background="images/login_07.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="21%" height="30"><div align="center"><span class="STYLE3">用户</span></div></td>
<td width="79%" height="30">
<input type="text" name="username" id="username" style="height:18px; width:130px; border:solid 1px #cadcb2; font-size:12px; color:#81b432;">
</td>
</tr>
<tr>
<td height="30"><div align="center"><span class="STYLE3">密码</span></div></td>
<td height="30">
<input type="password" name="password" id="password" style="height:18px; width:130px; border:solid 1px #cadcb2; font-size:12px; color:#81b432;">
</td>
</tr>
<tr>
<td height="30"> </td>
<td height="30"><img src="images/dl.gif" width="81" height="22" border="0" usemap="Map"></td>
</tr>
</table></td>
<td width="255" background="images/login_08.gif"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="247" valign="top" background="images/login_09.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="22%" height="30"> </td>
<td width="56%"> </td>
<td width="22%"> </td>
</tr>
<tr>
<td> </td>
<td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="44%" height="20"> </td>
<td width="56%" class="STYLE4">版本 2010V1.0 </td>
</tr>
</table></td>
<td> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#a2d962"> </td>
</tr>
</table><map name="Map"><area shape="rect1" coords="3,3,36,19" href="login_System.action"><area shape="rect" coords="40,3,78,18" href="#"></map></body>
</html>Action:
HttpServletRequest request = ServletActionContext.getRequest();
String username = request.getParameter("username");
String password = request.getParameter("password");都执行了login_System.action,就是获取不到用户和密码的值?郁闷
<head>
<title>管理平台</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
overflow:hidden;
}
.STYLE3 {color: #528311; font-size: 12px; }
.STYLE4 {
color: #42870a;
font-size: 12px;
}
-->
</style></head><body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#e5f6cf"> </td>
</tr>
<tr>
<td height="608" background="images/login_03.gif"><table width="862" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="266" background="images/login_04.gif"> </td>
</tr>
<tr>
<td height="95"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="424" height="95" background="images/login_06.gif"> </td>
<td width="183" background="images/login_07.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="21%" height="30"><div align="center"><span class="STYLE3">用户</span></div></td>
<td width="79%" height="30">
<input type="text" name="username" id="username" style="height:18px; width:130px; border:solid 1px #cadcb2; font-size:12px; color:#81b432;">
</td>
</tr>
<tr>
<td height="30"><div align="center"><span class="STYLE3">密码</span></div></td>
<td height="30">
<input type="password" name="password" id="password" style="height:18px; width:130px; border:solid 1px #cadcb2; font-size:12px; color:#81b432;">
</td>
</tr>
<tr>
<td height="30"> </td>
<td height="30"><img src="images/dl.gif" width="81" height="22" border="0" usemap="Map"></td>
</tr>
</table></td>
<td width="255" background="images/login_08.gif"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="247" valign="top" background="images/login_09.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="22%" height="30"> </td>
<td width="56%"> </td>
<td width="22%"> </td>
</tr>
<tr>
<td> </td>
<td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="44%" height="20"> </td>
<td width="56%" class="STYLE4">版本 2010V1.0 </td>
</tr>
</table></td>
<td> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#a2d962"> </td>
</tr>
</table><map name="Map"><area shape="rect1" coords="3,3,36,19" href="login_System.action"><area shape="rect" coords="40,3,78,18" href="#"></map></body>
</html>Action:
HttpServletRequest request = ServletActionContext.getRequest();
String username = request.getParameter("username");
String password = request.getParameter("password");都执行了login_System.action,就是获取不到用户和密码的值?郁闷
解决方案 »
- 有一关于读取word文档设计思路,大家帮忙分析下
- 请帮忙,JAVA中自定义事件
- 用html:textarea能够把一个文本文件吗???
- 各位高手,帮我解释一下这个跳动的菜单,我控制不了他出现的位置,谢谢
- 请教?
- 急求TOMCAT连接池连接SYBASE数据库的代码!网上基本上是把USER和PASS写死在代码中的!!
- 如何区分同一个form中不同Input在提交时的操作?
- 请问csdn是如何实现保存日文的????
- 提交以后数据保存后立即返回提交叶面并传回参数用JSP如何实现?
- tapestry的最基本搭建
- 关于hibernate级联查询问题,网上找了许多都没找到
- myeclipse下的servlet的web.xml怎么配置
用的是struts ?
既然是struts 你为何还要用
String username = request.getParameter("username");
String password = request.getParameter("password");
??
用getter setter方法好一点吧?
我也没看到你的form 不知道你是怎么提交到那个action的。
struts2
HttpServletRequest request = ServletActionContext.getRequest();获取到request
在jsp页面有问题 总是获取不到。
<area shape="rect1" coords="3,3,36,19" onclick="subMit()">
function subMit(){
var username = document.getElementById('username');
var password = document.getElementById('password');
var url = "xx.action&username="+username + "&password=" + password;
document.forms[0].action=url;
document.forms[0].submit();
}
还有这个ServletActionContext.getRequest()获取到的request是不是空的呢?
<td height="30"> </td>
<td height="30"><img src="images/dl.gif" width="81" height="22" border="0" usemap="Map"></td>
</tr><map name="Map"><area shape="rect1" coords="3,3,36,19" href="login_System.action"><area shape="rect" coords="40,3,78,18" href="#">
</map>代码关键在这里,因此我不知道该怎么提前用户和密码值
public class myAction extend ActionSupport implemts ServletRequestAware{ private HttpServletRequest request; public void setServletRequest(HttpServletRequest request) {
this.request = request;
}
}用这个方法换掉你的request试试
<body><form> .......其他代码</form></body>
试试。
在struts2里可以这样得到request :HttpServletRequest request = ServletActionContext.getRequest();
我重新做了一个login.jsp 都可以获取到值。
所以我觉得这事html map标签的事情 导致我不能获取到值
map标准这里 我要是修改为onclick的话 点击不了
function mysubmit(){}
</script><map name="Map"><area shape="rect1" coords="3,3,36,19" href="login_System.action"><area shape="rect" coords="40,3,78,18" href="#"></map></
function mysubmit(){
var username=Document.getElementById("username").value;
var password=Document.getElementById("password").value;
window.location="login_System.action?username="+username+"&password"+password;
}
</script> <map name= "Map "> <area shape= "rect1 " coords= "3,3,36,19 " href= "#"
onclick="mysubmit();"> <area shape= "rect " coords= "40,3,78,18 " href= "# "> </map>
我想只能用js来解决了。