Hi,
This is VaniRathna i am very new to java. l have a Actionclass which displays the values from my data Base. i have a table with the name b_announcements and with the columns [ u_id,name,start_date,end_date,information,status ] for start_date,end_date i took data type as time stamp with time zone but when i am trying to display them in grid they are displaying like NaN/NaN/0NaN how can i resolve this my code is like this
/** * Displays announce in grid */ package com.codon; import java.io.Reader; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Iterator; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import com.ibatis.common.resources.Resources; import com.ibatis.sqlmap.client.SqlMapClient; import com.ibatis.sqlmap.client.SqlMapClientBuilder; public class ShowAnnounce extends Action{ private final String SUCCESS="success.jsp"; public ActionForward execute(ActionMapping mapping,ActionForm form, HttpServletRequest request,HttpServletResponse response) throws Exception { try{ ServletOutputStream sos=response.getOutputStream(); response.setHeader("Cache-Control","no-store"); response.setHeader("Pragma","no-cache"); response.setContentType("text/xml"); Reader reader=Resources.getResourceAsReader("Xml/SqlMapConfig.xml"); SqlMapClient sqlMap=SqlMapClientBuilder.buildSqlMapClient(reader); ArrayList list=(ArrayList)sqlMap.queryForList("announcedetails",null); Iterator itr=list.iterator(); DateFormat formatter; formatter = new SimpleDateFormat("yyyy/MM/DD"); sos.println("<dataset>"); while(itr.hasNext()) { B_Announce element=(B_Announce)itr.next(); sos.println("<item>"); sos.println("<announce_id>"+element.getAnnounce_id()+"</announce_id>"); sos.println("<name>"+element.getName()+"</name>"); sos.println("<start_date>"+element.getStart_date()+"</start_date>"); sos.println("<end_date>"+element.getEnd_date()+"</end_date>"); sos.println("<information>"+element.getInformation()+"</information>"); sos.println("<active>"+element.getActive()+"</active>"); //sos.println("<checked_out>"+element.getChecked_out()+"</checked_out>"); sos.println("</item>"); }//while sos.println("</dataset>"); }catch(Exception e) { e.printStackTrace(); } return null; }//execute }
thank you for any help