为什么数据不能显示?

xjxy 2006-07-19 08:38:15
在UserList.java中有如下代码:
public static String getUserListHTML() {
……………………
while (rs.next())
{
String UID=rs.getString("user_id");
String UName=rs.getString("user_name");
//System.out.println("uid: "+UID+" Uname :"+UName);
sBuf.append("<option value='" + UID + "'>" +UName + "</option>\n");
}
System.out.println(sBuf.toString());
return sBuf.toString();
………………………………
}
另一页面中:
<%@page contentType="text/html; charset=GBK" %>
<%@page import="bookstore.UserList" %>
<html>
<head>
<title>login</title>
</head>
<body bgcolor="#ffffff">
<form name="form1" action="switch.jsp" method="POST">
用户名:<select name="userId">
<option value="" selected>--loggin user--</option>
<%=UserList.getUserListHTML() %> //-->该句不会在页面上显示
</select>
………………
请教如何解决?谢谢

...全文
157 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xjxy 2006-07-20
  • 打赏
  • 举报
回复
果然是这个问题,谢谢
fosjos 2006-07-19
  • 打赏
  • 举报
回复
sBuf.append("<option value='" + UID + "'>" +UName + "</option>\n");
请确认其中的"<",">"是不是半角符号
或者看看打开网页的“查看源文件”和语气的是否一致

81,091

社区成员

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

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