由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 实实在在受不了了,还是来这里求教!
相关主题
运行servlet时出现的http status 404问题向各位高手求教,多谢先
怎麼得到字符串中的raw bytes?请问公司里用Java主要干啥?
显示email中文的问题jsp和j2ee什么关系?
不明白servlet, applet到底啥区别,还有jsp请教该如何学习才能搞定工作
问个xml的问题servlet到底是啥玩意
[转载] 请推荐关于Servlet和JSP编程的书已经学完jsp and servlet了,下一步是不是该学struts了
J2EE和未来工作问题有没有办法在browser第一次访问的时候知道是不是支持cookie?
interview求助a stupid question
相关话题的讨论汇总
话题: checkbox1话题: string话题: whatever话题: jsp
进入Java版参与讨论
1 (共1页)
T*****e
发帖数: 361
1
jsp/servlet, tomcat 5.5, jdk 1.5.0_02
折腾了半个晚上,也没有搞明白怎么样才能够从ServletRequest里面把
上个页面提交的参数正确地读出来。
把每个参数都显示出来了,看上去也都挺好,怎么就死活匹配不上呢。
比方说,一个checkbox的状态是on,显示出来也是on,长度是2,可是
在servlet/jsp里 request.getParameter( "checkbox1" ) == "on" 怎
么就是false呢。
想来是encoding/character-set的问题,于是反复该这些东东,包括
jsp的,form的,html的,request的,甚至连
new String( oldString.getBytes( "IS08859-1" ), "UTF-8" )这么
复杂的咚咚都试了一遍,还是不行。
唉唉,洗把脸睡了。
等明天中午起来看大家的回复吧。
没人理我就跳楼算了(不过想摔死够呛)。
//bow
u****s
发帖数: 2186
2
change
request.getParameter( "checkbox1" ) == "on"
to
request.getParameter( "checkbox1" ).equalsIgnoreCase("on")

【在 T*****e 的大作中提到】
: jsp/servlet, tomcat 5.5, jdk 1.5.0_02
: 折腾了半个晚上,也没有搞明白怎么样才能够从ServletRequest里面把
: 上个页面提交的参数正确地读出来。
: 把每个参数都显示出来了,看上去也都挺好,怎么就死活匹配不上呢。
: 比方说,一个checkbox的状态是on,显示出来也是on,长度是2,可是
: 在servlet/jsp里 request.getParameter( "checkbox1" ) == "on" 怎
: 么就是false呢。
: 想来是encoding/character-set的问题,于是反复该这些东东,包括
: jsp的,form的,html的,request的,甚至连
: new String( oldString.getBytes( "IS08859-1" ), "UTF-8" )这么

w*r
发帖数: 2421
3
String.equals() are different than == ,
check out the java basic concepts

【在 T*****e 的大作中提到】
: jsp/servlet, tomcat 5.5, jdk 1.5.0_02
: 折腾了半个晚上,也没有搞明白怎么样才能够从ServletRequest里面把
: 上个页面提交的参数正确地读出来。
: 把每个参数都显示出来了,看上去也都挺好,怎么就死活匹配不上呢。
: 比方说,一个checkbox的状态是on,显示出来也是on,长度是2,可是
: 在servlet/jsp里 request.getParameter( "checkbox1" ) == "on" 怎
: 么就是false呢。
: 想来是encoding/character-set的问题,于是反复该这些东东,包括
: jsp的,form的,html的,request的,甚至连
: new String( oldString.getBytes( "IS08859-1" ), "UTF-8" )这么

A*****y
发帖数: 300
4
He might want to jump as well...

【在 w*r 的大作中提到】
: String.equals() are different than == ,
: check out the java basic concepts

T*****e
发帖数: 361
5
呵呵,跳了跳了,大家来参观啊……(免费)
是比较土,半道出家的,而且没来得及(也没耐心)仔细读一本
(通常都是巨厚的)java教程,自然在basic java concepts方面
就有些欠缺了。
其实也想到过可能是 ==/引用 的问题。试过如下代码:
01: String a = "whatever";
02: String b = a;
03: System.out.println( " a == b: " + ( a == b ) );
04: System.out.println( " a == \"whatever\": " + ( a == "whatever" ) );
现在想来,还欠缺几个比较,那就是
05: String c = "whatever";
06: System.out.println( " a == c: " + ( a == c ) );
07: System.out.println( " a == ( new String( \"whatever\" ) ): "
+ ( a == (

【在 A*****y 的大作中提到】
: He might want to jump as well...
m******t
发帖数: 2416
6

Unless you are determined to learn how these things work
in raw, or your project requires it, why don't you just go get
one of the frameworks, and let it do the plumbing for you?

【在 T*****e 的大作中提到】
: jsp/servlet, tomcat 5.5, jdk 1.5.0_02
: 折腾了半个晚上,也没有搞明白怎么样才能够从ServletRequest里面把
: 上个页面提交的参数正确地读出来。
: 把每个参数都显示出来了,看上去也都挺好,怎么就死活匹配不上呢。
: 比方说,一个checkbox的状态是on,显示出来也是on,长度是2,可是
: 在servlet/jsp里 request.getParameter( "checkbox1" ) == "on" 怎
: 么就是false呢。
: 想来是encoding/character-set的问题,于是反复该这些东东,包括
: jsp的,form的,html的,request的,甚至连
: new String( oldString.getBytes( "IS08859-1" ), "UTF-8" )这么

T*****e
发帖数: 361
7

~~~~~~~~~~~~~~Could you please give me some examples?

【在 m******t 的大作中提到】
:
: Unless you are determined to learn how these things work
: in raw, or your project requires it, why don't you just go get
: one of the frameworks, and let it do the plumbing for you?

m******t
发帖数: 2416
8

Well Struts is the most widely used framework at this point, so it's
probably the best starting point for you. I haven't actually used
Tapestry in a practical project, but from what I read it's actually
the best Web framework out there.
And then if your decision is very much standard-driven, you might
want to check out JavaServer Faces, which is gaining momentum, but
in a lot of people's (inc. me) opinion hasn't quite got there yet.

【在 T*****e 的大作中提到】
:
: ~~~~~~~~~~~~~~Could you please give me some examples?

1 (共1页)
进入Java版参与讨论
相关主题
a stupid question问个xml的问题
请教汉字的utf-8 mapping (转载)[转载] 请推荐关于Servlet和JSP编程的书
请问用eclipse开发中文的软件J2EE和未来工作问题
Eclipse不能保存UTF-8文件?interview求助
运行servlet时出现的http status 404问题向各位高手求教,多谢先
怎麼得到字符串中的raw bytes?请问公司里用Java主要干啥?
显示email中文的问题jsp和j2ee什么关系?
不明白servlet, applet到底啥区别,还有jsp请教该如何学习才能搞定工作
相关话题的讨论汇总
话题: checkbox1话题: string话题: whatever话题: jsp