File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes date display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "date display" Watch "date display" New topic
Author

date display

arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: date display