out.print ("<br>"+"username is "+"name");
out.print ("<br>"+"password is"+"password");
是不是要这样阿
我也是新手
out.print ("<br>"+"password is"+"password");
是不是要这样阿
我也是新手
解决方案 »
- (新手求助)action提交servlet错在哪?
- 求ideas,哪个大神可以给支招,标题要长。。。
- 郁闷很久的问题,关于struts,求救
- 关于Quartz动态设置时间
- Collections.sort 排序问题
- 我急啊,没人回答我,只好再提问一次,关于用fileupload上传文件的,请进!
- 请教高手!在javaScript中如何对jsp中的全局变量进行负值?(在线等候......)
- 【求教】非开发人员如何做前端页面
- 急!急!急!急!急!急!请问Tomcat(由二进制包安装)大概需要多少硬盘和内存?在线!
- 这个递归程序怎么是这个结果啊?
- 如何在提交按钮中写代码先执行别一个程序。
- 送分,顶者有分,但还是希望兄弟姐妹们帮帮我解决以下,很急!
在前面加上
java.io.PrintWriter out = null;
用PrintWriter out=request.getWriter();
这样就可以了~~~
PrintWriter out
在SERVLET的任何地方都可以用了
rs=sql.executeQuery(condition);
这句后面加if(rs.next()){}还有你的out.print ("<br>"+"username is "+name);你写成
out.print ("<br>username is "+name);就行了
out不用定义的,只要引用类就可以了
建议你把back()方法改成有返回值的方法,然后根据这个返回值再在jsp的scriptlet里面判断并相应的out.print()
否则不能取得字段值
out.print ("<br>"+"password is"+password);
应该是servlet中的out,因此不需要定义
PrintWriter out = request.getWriter();
如果实在jsp中,就可以直接用out了
while(rs.next()){
String name=rs.getString("username");
String password=rs.getString("password");
out.print ("<br>"+"username is "+name);
out.print ("<br>"+"password is"+password);
}
con.close();