站内搜索: 请输入搜索关键词

当前页面: 开发资料首页JSP 专题字符串比较报错!

字符串比较报错!

摘要: 字符串比较报错!


String Action=request.getParameter("action");
if(Action.equals("add"))

{
out.print("add");
}
else
{
out.print("aaa");
}
就这样都报错我真的不知道怎么办了晕了!


是不是空指针了


java中有指针吗?


报什么错误?NullPointException?


description The server encountered an internal error () that prevented it from fulfilling this request.


String Action=request.getParameter("action");
去掉里面的双引号试试。String Action=request.getParameter(action);


语法都错何来试试道理


给偶们看看 错误信息啊。 :(


发出来了啊
description The server encountered an internal error () that prevented it from fulfilling this request.



if(Action.equals("add") )改成{

{
out.print("add");
}
else
{
out.print("aaa");
}


你的这个页面代码没有问题!
看看你的提交页面或者Tomcat 有没有问题,
有可能是别的错误!!


反过来用equals
String Action=request.getParameter("action");
if("add".equals(Action))

{
out.print("add");
}
else
{
out.print("aaa");
}



晕,不会就这么点错误提示吧,把所有的提示给贴出来....
页面上没有,到logs目录下找到给贴出来,信息太少了....


我想你可以能是前一个提交页面没有名字为"action"的文本字段

顺便说一下最好不要用 action 作为你的字段名称


俺晕了。是俺弄错了。*_*


↑返回目录
前一篇: 请问大家如何从jsp页面跳转到asp页面?
后一篇: 绝对有难度,有挑战的问题!!!--连接池