• 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

Showing Distinct Value(In Struts2+Hibernate3+Spring3+jsp project)  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made a software by Struts2+Hibernate3+Spring3

I want get distinct value in a comboo from a table of a specific column.For that I write a method "findByValue(long id)" in Dao


"public List<BaseInfo> findByValue(long id)
{
String queryName;
List<BaseInfo> baseInfoList = null;


queryName = "from com.rajuk.efms.model.LocationViewInfo where locationTypeId = ?";
try
{
baseInfoList = this.getHibernateTemplate().find(queryName, id);

System.out.println("############### find by value");
}
catch(Exception e)
{
e.printStackTrace();
}
return baseInfoList;
}"


I write a method in Action class


"public String showWebAdm()
{
pageInfo = new PageInfo();
pageInfo.setCurrentPage(currentPage);
pageInfo.setPageSize(20);
pageInfo.setOrder(true);
pageInfo.setTotal(0);

dapImagesViewInfo = new DAPImagesViewInfo();
dapImagesViewInfo.setPageInfo(pageInfo);
dapImagesViewInfo.setThanaId(thanaId);
dapImagesViewInfo.setUnionWordId(unionWordId);
dapImagesViewInfo.setMouzaId(mouzaId);
dapImagesViewInfo.setPlotId(plotId);

dapImagesViewInfo.setDeletedFlag(0);


this.locationViewThanaInfoList=(List)locationViewService.findByValue(1);// Comboo List ....
this.locationViewUWInfoList=(List)locationViewService.findByValue(2);// Comboo List ....
this.locationViewMouzaInfoList=(List)locationViewService.findByValue(3);// Comboo List ....
this.locationViewPlotInfoList=(List)locationViewService.findByValue(4);// Comboo List ....

this.dapImagesViewInfoList = (List)dapImagesViewService.show(dapImagesViewInfo);// show table list...
return "showWebAdm";
}"

I write following code for getting data in comboo in jsp page

<%@taglib prefix="s" uri="/struts-tags" %>


" <select name="unionWordId" id="unionWordId" >
<option value="" >Select Union Or Word</option>
<s:iterator value="locationViewUWInfoList" status="status">
<s:if test='%{unionOrWordViewInfo.locationId == locationId}'>
<option value="<s:property value="locationId"/>" selected><s:property value="locationName"/>
</option>
</s:if>
<s:else>
<option value="<s:property value="locationId"/>"><s:property value="locationName"/></option>
</s:else>
</s:iterator>
</select>"

But When I write In dao class method

queryName = "select distinct(locationName) from com.rajuk.efms.model.LocationViewInfo where locationTypeId = ?";

for getting LocationName column data distinctly I get no data in comboo

When I write In dao class method

queryName = "from com.rajuk.efms.model.LocationViewInfo where locationTypeId = ?";

I get data in Comboo but not Distinctly .

I can not understand the problem.Please help me to get distinct value ......
 
Ranch Hand
Posts: 41
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kazi Mohammad Marufur Rashid wrote:
I can not understand the problem.Please help me to get distinct value ......



Neither can we. Please UseCodeTags.
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!