• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

date display

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1)
//Map dateMap = new HashMap();
Map dateMap = new TreeMap();
//List dateList = new ArrayList();
Calendar cal = Calendar.getInstance();

if(cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
{
cal.add(Calendar.DATE, -5);
for(int i = 1; i<=5; i++)
{
cal.add(Calendar.DATE, 1);
Date d = cal.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
dateMap.put(sdf.format(d), null);
}
}
else
{
cal.add(Calendar.DATE, -6);
for(int i=1; i<=6; i++)
{
if(cal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY)
{
Date d = cal.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
dateMap.put(sdf.format(d), null);
}
cal.add(Calendar.DATE, 1);
}
}

System.err.println(dateMap.keySet());

if(iataData.size()> 0)
{
for(Iterator iterator = iataData.iterator(); iterator.hasNext()
{
IataAuditData iataAuditData = (IataAuditData)iterator.next();
Date d = iataAuditData.getAuditDate();
System.err.println(d.toString());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String key = sdf.format(d);
if(dateMap.containsKey(key))
{
System.out.println("Hurray");
dateMap.put(key, iataAuditData);
}
}

2)<td><logic resent name="element" property="value">
<bean efine id="iata" name="element" property="value"/>

<html:link action="/detailauditreport" paramName="iata" paramProperty="auditDate" paramId="adate">
<logic:equal name="iata" property="sunday" value="false" >
<bean:write name="iata" property="auditDate" formatKey="org.apache.struts.taglib.bean.format.date" />
</logic:equal></html:link></logic resent>

<logic:notPresent name="element" property="value">
0
</logic:notPresent>


Now expected functionality -action code will take the dates from daatabse and show it to jsp page in date coulmn for last five days and corrosponding data.
Now suppose in last five day if it does not have date for two days then it should show those dates(those missing dates are not in dataabse) and other data as 0

present functionality-but due to logic not present code it is showing 0.

Any idea?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic