我是 Struts2 和 Hibernate 的新手。I want to create a drop-down list like the following [ using hibernate and struts] which pops up a menu dynamically and when an id will be selected, it shows all the information of that id:
我做了很多努力来做到这一点。但失败了。有人可以帮我吗:
我有一个像这样的“学生”表:
id name age
1...a.....20
2...b.....24
3...c.....22
使用 Hibernate,我创建了模型和 dao,例如... StudentModel 和 StudentDAO
在 DAO 中,我实现了一个返回 id 列表的方法,如下所示:
// StudentDAO.java
public List<String> findId(String id) {
.....
return ...
}
现在,我将 action 定义到 struts.xml 文件中,如下所示:
// Struts.xml
<action name="idSelection" class="..." method="findId">
<result> studentpage.jsp </result>
</action>
那么,现在我该如何实现studentpage.jsp。请你告诉我必要的代码或参考来做到这一点
谢谢你。