请问如果我做了这样的一个类,怎么做一个环境进行验证呢? 希望解答详细一点:) 谢谢/**
* Login error class
*
* @autor zgh
* @version 1.0 2005/07/14
* @since JDK1.4.2
*/
public class LoginException{
/**
* @param string
* @return
*/
private static Object Redirect(String string) {
return null;
}
/**
* <pre>验证登陆名字密码,完成验证后,跳转到display.jsp页面</pre>
*
* @param args.
* @return the desired character.
*/public static void main(String[] args) {
/**登陆名字*/
String strName = new String();
/**登陆密码*/
String strThing = new String();
/**接收输入登陆名字密码*/
try {
strName = Request.getParameter("name");
strThing = Request.getParameter("thing");
/**当遇到输入名字为空或者超出原定长度时抛出异常*/
if ((strName == null) || (strName.length() == 0) || (strName.length() >= 10 )) {
throw new Exception("null strName");
}
/**当遇到输入密码为空或者超出原定长度时抛出异常*/
if ((strThing == null) || (strThing.length()==0) || (strThing.length() >= 10 ))
throw new Exception("null strThing");
/**抛出异常后跳转到display.jsp页面*/
response.sendRedirect ("display.jsp");
} catch (Exception e) {
}
}
}
* Login error class
*
* @autor zgh
* @version 1.0 2005/07/14
* @since JDK1.4.2
*/
public class LoginException{
/**
* @param string
* @return
*/
private static Object Redirect(String string) {
return null;
}
/**
* <pre>验证登陆名字密码,完成验证后,跳转到display.jsp页面</pre>
*
* @param args.
* @return the desired character.
*/public static void main(String[] args) {
/**登陆名字*/
String strName = new String();
/**登陆密码*/
String strThing = new String();
/**接收输入登陆名字密码*/
try {
strName = Request.getParameter("name");
strThing = Request.getParameter("thing");
/**当遇到输入名字为空或者超出原定长度时抛出异常*/
if ((strName == null) || (strName.length() == 0) || (strName.length() >= 10 )) {
throw new Exception("null strName");
}
/**当遇到输入密码为空或者超出原定长度时抛出异常*/
if ((strThing == null) || (strThing.length()==0) || (strThing.length() >= 10 ))
throw new Exception("null strThing");
/**抛出异常后跳转到display.jsp页面*/
response.sendRedirect ("display.jsp");
} catch (Exception e) {
}
}
}
环境能够支持jsp就成
是期望获得一组相关的测试用例?
是希望知道使用什么测试工具(诸如JUNIT)?
or ...?@.@||~
或者写一个servlet怎么写呢? 写好了又怎么用呢?是这意思
本人初次学习java 实在是蔡鸟一个 希望大家说的详细,详细!
很多概念也不是很清楚 请指教。
我希望是看到这个class可以用到一个程序中取得效果
比如在一个login叶面上 登陆时的报错