Action和Jsp获取迭代器并显示它
这是我的操作类
public Iterator<CgConsultant> getSearchresult() {
List<CgConsultant> list =userSearch.getConsultantMatches(searchstring);
System.out.println("The size of the resutl list:"+list.size());
Iterator<CgConsultant> iterator = list.iterator();
CgConsultant obj;
while(iterator.hasNext()){
obj = (CgConsultant)iterator.next();
System.out.println(obj.getUsername());
System.out.println(obj.getFirstName());
System.out.println(obj.getLastName());
}
return iterator;
}
,我必须在 jsp 中填充数据并将其显示在 jsp 中,
我得到返回状态,但如何填充数据并显示它..
这是我的 jsp
<head>
<title><fmt:message key="signup.title"/></title>
<meta name="heading" content="<fmt:message key='signup.heading'/>"/>
</head>
<body>
<h1> Search Complete</h1>
<h2> Details are..</h2><br>
<s:property value="Searchresult"/>
</body>
</html>
请指定任何建议..
This is my action class
public Iterator<CgConsultant> getSearchresult() {
List<CgConsultant> list =userSearch.getConsultantMatches(searchstring);
System.out.println("The size of the resutl list:"+list.size());
Iterator<CgConsultant> iterator = list.iterator();
CgConsultant obj;
while(iterator.hasNext()){
obj = (CgConsultant)iterator.next();
System.out.println(obj.getUsername());
System.out.println(obj.getFirstName());
System.out.println(obj.getLastName());
}
return iterator;
}
And i have to populate the data in jsp and display it in the jsp
I m gettin the return status but how to populate the data n display it..
this is my jsp
<head>
<title><fmt:message key="signup.title"/></title>
<meta name="heading" content="<fmt:message key='signup.heading'/>"/>
</head>
<body>
<h1> Search Complete</h1>
<h2> Details are..</h2><br>
<s:property value="Searchresult"/>
</body>
</html>
Please specify any suggestion..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Taglib c 是 http://java.sun.com/jsp/jstl/core
添加一些漂亮的 html
Taglib c is http://java.sun.com/jsp/jstl/core
Add some nice html