password

lzgu 2003-07-01 05:07:30
jsp:

<input type="password" name="password">

在java里我怎么才能取得password呢?
...全文
29 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzgu 2003-07-01
  • 打赏
  • 举报
回复
package javaCompile;

import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import topsoft.mis.OurCompany;

import ent.mis.Company;
import ent.mis.util.StoreException;
import ent.mis.http.model.Model;

/**
* @author Administrator
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/

/**
* 本model类是处理密码的更改
* 对密码的更改不需要旧的密码
*/
public class PasswordManager implements Model
{
String oldpassword;
String newpassword; //定义变量newpassword
String loginID;

/**
* 通过execute()方法进入密码修改模块
* 对密码进行修改
*/
public void execute(HttpServletRequest req,HttpServletResponse resp)
{
boolean loginAttempt=false;
boolean loginOk=false;

/**
* 对输入的newpassword进行判断
* 是否为空
*/
if(req.getParameterValues("submit")!=null
&& req.getParameterValues("submit")[0].trim().equals("submit")
&& req.getParameterValues("newpassword")!=null)
{
loginAttempt=true;
loginOk=true;
}

/**
* 如果loginAttempt为true
* 通过getEmployeeFromLogin()方法处理
* 抛出StoreException异常
*/
if(loginAttempt)
{
oldpassword=req.getParameter("oldpassword");
newpassword=req.getParameter("newpassword");
System.out.println("SSS"+newpassword);
loginID=req.getRemoteUser();
System.out.println("SSS"+loginID);
try
{
Company password=OurCompany.initInstance();
password.getEmployeeFromLogin(loginID).changePassword(newpassword);
}
catch(StoreException e)
{
System.out.println("ssss"+e.message);
e.printStackTrace();
}
// catch(Exception e)
// {
// System.out.println("@###@##@"+e.getMessage());
// e.printStackTrace();
// }
}//if(loginAttempt)

/**
* 如果loginOk为true
* 返回default.jsp页面
* loginOk为false
* 返回errormessage.jsp
*/
if(loginOk)
{
try
{
resp.sendRedirect("http://localhost:9080/Erpweb/default.jsp");
}
catch (Exception e)
{
e.printStackTrace();
}
}//(loginOk)
else
{
try
{
resp.sendRedirect("http://localhost:9080/Erpweb/errormessage.jsp");
}
catch(IOException e)
{
e.printStackTrace();
}
}//else
}

}
hhuzhj 2003-07-01
  • 打赏
  • 举报
回复
贴出你的程序看看。
lzgu 2003-07-01
  • 打赏
  • 举报
回复
但是request.getParameter("password");取道的是null呀
jwywxx 2003-07-01
  • 打赏
  • 举报
回复
up
moumouren 2003-07-01
  • 打赏
  • 举报
回复
request.getParameter("password");
www203 2003-07-01
  • 打赏
  • 举报
回复
当然你要action到你取得的jsp或者servlet
unsalted 2003-07-01
  • 打赏
  • 举报
回复
servlet里String password = request.getParameter("password");
jianghua008 2003-07-01
  • 打赏
  • 举报
回复
在JSP中:
strPassword = request.getParameter("password");
unsalted 2003-07-01
  • 打赏
  • 举报
回复
servlet里String password = request.getParameter("password");

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧