Not logged in? Join one of the bigest Law Forums on the Internet! Join Now!   Latest blog post: Research Law Professors Before Choosing Law Schools

Advertisments:




Sponsor Links:

Discount Legal Forms
Discounted Legal Texts


Struts2 List Display in Jsp page ( Able to get the data to the list from database but not able to display on t?

Struts2 List Display in Jsp page ( Able to get the data to the list from database but not able to display on t?

Postby felabeorbt » Fri Mar 30, 2012 3:17 am

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`
felabeorbt
 
Posts: 6
Joined: Fri Apr 01, 2011 12:23 pm
Top

Return to Class Action

 


  • Related topics
    Replies
    Views
    Last post