Tuesday 29 October 2013

Spring MVC with Send Grid For Mail

0 comments
Step 1: Create a send grid account for send gid key and password.(With free account you can send 200 email every day.No Expiration.)
Sign Up For Free Send Grid Account

Step 2: Incude following jars
i - sendgrid-0.1.0-jar.jar 
ii- org.json-chargebee-1.0.jar
 iii- http-request-5.4.jar

Step 3: Create a object of SendGrid Class
import com.github.sendgrid.SendGrid;

SendGrid sendgrid = new SendGrid("SendGridKey","SendGridPassword");
sendgrid.addTo("Reciver Email");
sendgrid.addToName("Harit");
sendgrid.setFrom("EmailFrom");
sendgrid.setSubject("Subject");
sendgrid.setText("Body Text");
     
sendgrid.send();
  

Wednesday 16 October 2013

Ajax Spring MVC Integration

0 comments
Request Mapping in your controller
  @RequestMapping(value="/getLog", method = RequestMethod.POST) 
  public @ResponseBody List getLog(@ModelAttribute SchedulerCommonModel modelSch,ModelMap model) 
  {
   System.out.println("Inside Get Logger");
      List listMessage = new ArrayList();
      Message message = new Message();
      message.setBody("Hii");
      listMessage.add(message);
      return listMessage;
 }
Ajax Call
 $(document).ready(function(){
          setInterval(function(){
           var startStopFlag = $('#schOnOff').val();
           var timeDuration = $('#schDuration').val();
              if(startStopFlag=='ON')
              {
               $.ajax({
                      type: "POST",
                      url: "/projectname/getLog",
                      data: "startStopFlag=" + startStopFlag + "&timeDuration=" + timeDuration,
                      success: function(response){
                      populateLogger(response);
                      },
                      error: function(e){
                      alert('Error: ' + e);
                      }
                      });
              }
           
          },4000);
          
         
          
         });
         
         function populateLogger(data)
         {
          for ( var i = 0, len = data.length; i < len; ++i) {
           var message = data[i];
           alert(message.body);
          }
         }
Add this configuration in context
 
     
   

   
    
     
    
  
        

Related Posts Plugin for WordPress, Blogger...