日期:2014-05-18 浏览次数:20686 次
<form method="post" action="exam.action" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
<div class="pageFormContent" layoutH="56">
<s:iterator value="multiples" status="index" >
<table>
<tr>
<td><s:property value="#index.index+1"/>.<s:property value="topic"/></td>
</tr>
<tr>
<td><label for="<s:property value='mid'/>1"><input id="<s:property value='mid'/>1" name="<s:property value='mid'/>" type="radio" value="<s:property value='optiona'/>"/><s:property value="optiona"/></label></td>
</tr>
<tr>
<td><label for="<s:property value='mid'/>2"><input id="<s:property value='mid'/>2" name="<s:property value='mid'/>" type="radio" value="<s:property value='optionb'/>" /><s:property value="optionb"/></label></td>
</tr>
<tr>
<td><label for="<s:property value='mid'/>3"><input id="<s:property value='mid'/>3" name="<s:property value='mid'/>" type="radio" value="<s:property value='optionc'/>" /><s:property value="optionc"/></label></td>
</tr>
<tr>
<td><label for="<s:property value='mid'/>4"><input id="<s:property value='mid'/>4" name="<s:property value='mid'/>" type="radio" value="<s:property value='optiond'/>" /><s:property value="optiond"/></label></td>
</tr>
</table>
</s:iterator>
</div>
public List show(int sum) {
String sql = "select * From multiple Order By rand() Limit " + sum;
Session mysession = HibernateUtil.getSession();
Transaction tx = mysession.beginTransaction();
Query q = mysession.createSQLQuery(sql).addEntity(Multiple.class);
List multipleList = q.list();
tx.commit();
mysession.close();
return multipleList;
}
public String show(){
ExampapaermakeDaoImpl exampapaermakeDaoImpl = new ExampapaermakeDaoImpl();
multiples = exampapaermakeDaoImpl.show(10);
return SUCCESS;
}