I have a table named mytable,it has two cols,col1 and col2,the data are col1 col2 --------------- John 24 Kate 18
hibernate xml file is follows: <hibernate-mapping auto-import="false"> <class name="mytable" table="mytable" > <id name="col1" column="col1" type="java.lang.String"> <generator class="assigned"/> </id> <property name="col2" type="java.lang.String"> <column name="col2" /> </property> </class> </hibernate-mapping> Then I user struts2 to get the data by following statement: List testList=this.getHibernateTemplate().find(" from mytable"); request.setAttribute("testList",testList); return SUCCESS; the action dispatch to following jsp page <table> <c:forEach var="test" items="${testList}"> <tr><td> <c:out value="${test.col1}"></c:out> <c:out value="${test.col2}"></c:out> </td></tr> </c:forEach> </table> Above codes run well,it can show correct result John 24 Kate 18 then I modify struts action,like following: List testList=this.getHibernateTemplate().find(" select col1,col2 from mytable"); request.setAttribute("testList",testList); return SUCCESS; the action dispatch to the same jsp,but this time,the jsp show nothing! Why? I don't understand what's wrong with my code? Anyone could help me to solve above problem? Thank