• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Struts  RSS feed

 
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.
 
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 .
 
I love a woman who dresses in stainless steel ... and carries tiny ads:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!