Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts

 
jahurul Islam
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

in my struts2+hibernate project i execute this

try
{
tx = session.beginTransaction();

String sqlQuery = "select distinct(n.diagonasis_desc) from com.csms.model.DiagonasisInfo as n where n.diagonasisId="+id;
Query query = session.createQuery(sqlQuery);
baseInfoList=query.list();
System.out.println(baseInfoList.size());


tx.commit();
}
catch (RuntimeException e)
{
e.printStackTrace();
if(tx != null) tx.rollback();
}catch(Exception e){
e.printStackTrace();
}
finally
{
session.close();
}

return baseInfoList;
}

all execution completely ck but it do not show any value in jsp
<s:iterator value="baseInfoList" status="status">
<option value="<s:property value=""/>"><s:property value="diagonasis_desc"/></option>
</s:iterator>
please help me . N.B it my first post.
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can pass the list to select tag directly refer the link http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/components/Select.html
 
jahurul Islam
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohana Rao wrote:you can pass the list to select tag directly refer the link http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/components/Select.html


Thanks guy for your response, Actually I solved that problem by using script let like this

<select name="resTypeId" id="resTypeId" style="width:160px; height: 20px; float: left;" onchange="change_Category(this, 'resCatId')">
<option value="select" selected="selected">Select</option>
<%
for(int i=0; i<resType.size(); i+=2){
%>
<option value="<%out.print(resType.get(i)); %>"><%out.print(resType.get(i+1)); %></option>
<%} %>
</select>

But I want to know is it not possible to print distinct query value by using <s:property value="diagonasis_desc"/>, please conceptually help me. by showing s:property architecture.
 
jahurul Islam
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.

Also, plea try to use better subjects than just "Struts".


Thanks boss , From next time I try to use better subject .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic