在页面中显示不正确啊。

mbh0210 2004-08-12 10:01:43
程序如下:
在Action中:
combinsql combin=new combinsql();
Vector table_field=new Vector();
verygood very=new verygood();
Vector ver=new Vector();
ver.add(combin.filed_name());
very.setMbh(ver);
table_field.add(very);
httpServletRequest.setAttribute("table_field",table_field);
ver里面保存的是数据库中一个表的字段名。比如是申请单编号, 计划编号, 申请日期,我想在网页中把他显示出来,但显示的是[[申请单编号, 计划编号, 申请日期,]],并不是申请单编号 计划编号 申请日期 这中格式啊,急啊,请大侠解决一下啊。其他的都没有错,就是Vector这里有问题。
...全文
51 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dropship 2004-08-12
  • 打赏
  • 举报
回复
一般,vector是用addElement来添加元素的,并且元素一定是对象
你这个是啥清楚吗?
ver.add(combin.filed_name());
给你java doc的英文说明
-----------------------------
add
public boolean add(Object o)Appends the specified element to the end of this Vector.
Specified by:
add in interface List
Overrides:
add in class AbstractList
Parameters:
o - element to be appended to this Vector.
Returns:
true (as per the general contract of Collection.add).
Since:
1.2
----------------------------------------------------
addElement
public void addElement(Object obj)Adds the specified component to the end of this vector, increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity.
This method is identical in functionality to the add(Object) method (which is part of the List interface).

Parameters:
obj - the component to be added.
See Also:
add(Object), List


黑马 2004-08-12
  • 打赏
  • 举报
回复
贴出完整代码

vector是遗弃的类,为何不用arraylist?
mbh0210 2004-08-12
  • 打赏
  • 举报
回复
ding

81,091

社区成员

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

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