public interface Da {
public List searchReleaseNamesList() throws Exception;
}
My class
public class Impl implements Da {
public List searchReleaseNamesList() throws Exception {
SessionFactory sessionFactory = (SessionFactory)ServletActionContext.get…
System.out.println("I am here in namelist method");
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
String sqlQuery = "SELECT DragName FROM Tasss";
//Query query = session.createSQLQuery(sqlQuery);
List<String> nameListsfor = new ArrayList();
PreparedStatement pstmt=null;
String releasenameValue="";
Connection con = null;
ResultSet rs = null;
con = session.connection();
pstmt = con.prepareStatement(sqlQuery);
try{
rs = pstmt.executeQuery();
}
catch(Exception e){System.out.println("*****************… is while executing SQL");}
if(!rs.next()) {
log.info("There is no records");
} else {
do {
nameListsfor.add(rs.getString(1));
} while(rs.next());
}
log.info("Got the Release Names List Size :"+ nameListsfor.size());
return nameListsfor;
}
}
Jsp page
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<s:form action="addErmoAction">
<table border="0" width="690" id="table1" cellspacing="0" cellpadding="0" align="center" bordercolor="green" RULES=NONE>
<tr>
<td valign="top" style="height: 140px;">
<table border="0" id="table2" cellspacing="0" cellpadding="0" align="center">
<tr><td> ERMO Release Details</td></tr>
<tr><td> </td></tr>
</table>
</td>
</tr>
<% ScmRtDAOImpl Lists = new ScmRtDAOImpl();
List nameListsfor = Lists.searchReleaseNamesList();
Iterator it= nameListsfor.iterator();
String RelNameStr="";
while(it.hasNext()){
RelNameStr=RelNameStr+"'"+it.next()+"'"+…
}
%>
<tr><td><table align="center">
<s:iterator>
<tr>
<td><s:property value="its"/></td>
</tr>
</s:iterator>
<tr><td colspan="4"><s:submit value="Add" /></td><td>
</td></tr></table></td></tr>
</table>
</s:form>
</body>
</html>
**************************************… code here`enter code here`

