AnsweredAssumed Answered

not able to read csv file using webscripts

Question asked by malliswar on Jan 22, 2015
HI Everyone,


what i am trying to do here is, read a csv file and find birthdates and match them with current date, then diplay names who are having birthdays

the problem i am facing here is the html content which is in birthday.get.html.ftl file works perfectly out-side the alfresco framework
BUT
when i use them inside alfresco framework i get this error:in my log file

SEVERE: Servlet.service() for servlet [Spring Surf Dispatcher Servlet] in context with path [/share] threw exception [Could not resolve view with name 'site/I-connect/x.html' in servlet with name 'Spring Surf Dispatcher Servlet'] with root cause
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1029)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.alfresco.web.site.servlet.MTAuthenticationFilter.doFilter(MTAuthenticationFilter.java:74)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.alfresco.web.site.servlet.SecurityHeadersFilter.doFilter(SecurityHeadersFilter.java:168)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.alfresco.web.site.servlet.CSRFFilter.doFilter(CSRFFilter.java:315)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.alfresco.web.site.servlet.SSOAuthenticationFilter.doFilter(SSOAuthenticationFilter.java:391)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
   at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:745)

ERROR [alfresco.web.site] [http-bio-4040-exec-7] javax.servlet.ServletException: Could not resolve view with name 'site/I-connect/x.html' in servlet with name 'Spring Surf Dispatcher Servlet'


MYFILES:

this is birthday.get.desc.xml file
<webscript>
  <shortname>birthday Dashlet</shortname>
  <description>To add a dashlet that displays image in site</description>
  <family>site-dashlet</family>
  <url>/components/dashlets/birthday</url>
</webscript>

and this is my birthday.get.html.ftl file

<html lang="en">
<head>
<meta charset="utf-8">
<title>load demo</title>
<style>
body {
font-size: 12px;
font-family: Arial;
}
</style>
<p id="test"></p>
<p id="time"></p>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>

<body>
<h4>wish you happy birthday</h4>
<marquee direction=up><p id="demo"></p></marquee>
<div id="error"></div>
<script>
$( "#demo" ).load( "/home/malliswarreddyb/Desktop/x.csv", function( response, status, xhr)
{


      var inputrad="";1
      var currentTime = new Date();
      var month = currentTime.getMonth()+1;
      var day = currentTime.getDate();
      //var year = currentTime.getFullYear();
      var curdate=month + "/" + day;
             
      var temp=response.split(",");
      for(var i=0;i<temp.length;i++)
      {
                        var birthdatewithyear=temp;
                        var birthdate=birthdatewithyear.substr(1,4)
                       
          if(curdate==birthdate)
          {
                           
             var inputrad=inputrad+"<br><br>"+temp[i-1];
                               alert(inputrad);
           
          }
                        
           }
                    
          document.getElementById("demo").innerHTML = inputrad;

                    
      if ( status == "error" )
      {
         var msg = "Sorry but there was an error: ";
         $( "#error" ).html( msg + xhr.status + " " + xhr.statusText );
                       
      }
               
      
                                               
});
</script>
</body>
</html>

                 please help me
                                               Thanks in advance

Outcomes