Excel File Data Reading Using Spring MVC

 Uploading EXCEL - 2003, 2007 file's using file uploading UI, and insert all file data into database.

                            <form:form modelAttribute="bulkfileupload" role="form" enctype="multipart/form-data" >
                                            <div class="form-group">
                                                <label>Upload Excel File !</label>
                                                <form:input type="file" path="uploadFile" id="uploadFile"  />
                                                <div class="has-error">
                                                    <form:errors path="uploadFile" class="help-inline" />
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <input type="submit" value="upload">
                                            </div>
                                        </form:form>

For handling request of multipart/form-data, required MultipartResolver interface to handle file request. for that configure bean tage in xml file or

Path Variables In Spring Framework

Spring Framework offers to handle URI method parameters by using @PathVariable annotation

@Controller
@RequestMapping("admin")
public class PathVarController {

@RequestMapping("/welcome/{springPathVariable}/{page}")
public ModelAndView pathVariableTest(@PathVariable("page") String name, @PathVariable("springPathVariable") String pathVariable ) {

ModelAndView mav = new ModelAndView("pathVariable");
mav.addObject("message", " "+ name+" Your PathVariable is : "+pathVariable);
return mav;
}
}

Shell Script Tips

Shell Script, delete last 30 day's records from system.

#!/bin/bash
# Delete log files older than 30 days in this script.

find /var/log/tomcat7/localServer/logs/ -mtime +30 -type f -delete
echo "-----------------------------------------------------"
echo "$(date)"
echo "Deleted files older than 30 days in this location :: /var/log/tomcat7/ "