aspose file tools*
The moose likes Struts and the fly likes Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts" Watch "Struts" New topic
Author

Struts

jahurul Islam
Greenhorn

Joined: Aug 18, 2011
Posts: 4
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

Joined: Aug 01, 2007
Posts: 485

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


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
jahurul Islam
Greenhorn

Joined: Aug 18, 2011
Posts: 4
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

Joined: Aug 18, 2011
Posts: 4
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 .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts
 
Similar Threads
Retrieving List from DB and setting to JSP in struts 2
spaces while populating using s:iterator
Showing Distinct Value(In Struts2+Hibernate3+Spring3+jsp project)
For Getting Distinct value (In Struts2)
iterate doubt