wood burning stoves 2.0*
The moose likes JSP and the fly likes when clicks  back generates error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "when clicks  back generates error" Watch "when clicks  back generates error" New topic
Author

when clicks back generates error

prasad naga
Greenhorn

Joined: Jan 05, 2006
Posts: 10
hi
I am having a 3 jsp pages. First jsp contains two dates and two times i.e
to get the count of employees in between two dates and between time-in and time-out.
In the second jsp page it displays a report of the count of employees and
date. which depicts like
12-jan-2006 34
13-jan-2006 65
14-jan-2006 11

and when I click the count(34,65,11) it will display the employee names of a particular count.
The thing here for me is when i am clicking a <back> in third jsp
it is giving an error.
The path I have mentioned for <back> is
<a href="/access/jsp/second.jsp" class="links">back</a>
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

If you could post the error you get, I think this would help.


[My Blog]
All roads lead to JavaRanch
prasad naga
Greenhorn

Joined: Jan 05, 2006
Posts: 10
the depicts in jboss server is


Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at java.util.Calendar.setTime(Calendar.java:902)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:782)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:775)
at java.text.DateFormat.format(DateFormat.java:314)
at org.apache.jsp.jsp.viewTimeReport_jsp._jspService(org.apache.jsp.jsp.viewTimeReport_jsp:61)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Check viewTimeReport.jsp. Especially the part where you are using DateFormat.format. You are probably passing it a null object.

If you still can't get it, please post some relevant part of viewTimeReport.jsp
[ January 18, 2006: Message edited by: Satou kurinosuke ]
prasad naga
Greenhorn

Joined: Jan 05, 2006
Posts: 10
// in viewTimeReport.jsp here I am getting the InitialDate and FinalDate, and times, and event( employees who are In or Out for that particular period)

java.sql.Date idate = (java.sql.Date) request.getAttribute("IDATE");
java.sql.Date fdate = (java.sql.Date) request.getAttribute("FDATE");
String displayidate = new SimpleDateFormat("dd-MMM-yy").format(idate);
String displayfdate = new SimpleDateFormat("dd-MMM-yy").format(fdate);
java.sql.Time itime =(java.sql.Time) request.getAttribute("itime");
java.sql.Time ftime =(java.sql.Time) request.getAttribute("ftime");
String event = (String)request.getAttribute("event");


//and here I am getting the date by arraylist from TransferObject
<%if (request.getAttribute(AccessControlConstants.RESULT) != null) {
ArrayList result = (ArrayList) request.
getAttribute(AccessControlConstants.RESULT);
for (int i = 0; i < result.size(); i++) {
QueryResultTO queryResultTO = result.get(i) == null ? null: (QueryResultTO) result.get(i);

String displayDate = new SimpleDateFormat("dd-MMM-yyyy").format(queryResultTO.getDate());
%>


//for displaying date
<%=queryResultTO.getDate().toString() == null ? " ": displayDate%></td>


//for count

<%int x = queryResultTO.getCount(); %>
<td width="7%" class="cellValues" align="left">

//this is for when I clicks count then it will display Names

<a href = "/access/servlet/AccessControl?formaction=40&fdate=<%=displayDate%>&itime=<%=itime%>&ftime=<%=ftime%>&event=<%=event%>"><%=x %>
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

When going back to the page with the "back" link, the necessary information (IDATE, FDATE and the others)are probably not in the request anymore.

You should find a way to manage the necessary information,. You may consider using sessions.
prasad naga
Greenhorn

Joined: Jan 05, 2006
Posts: 10
Tnx fr ur suggestion
 
GeeCON Prague 2014
 
subject: when clicks back generates error