Posts

Showing posts from June, 2015

File Monitoring Using Java API

Image
======================WatchDog.java====================================== package net.codejava.io; import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.WatchEvent; import java.nio.file.WatchKey; import java.nio.file.WatchService; /**  *   * @author anand  *  */ public class WatchDog {     public static void main(String[] args) {         try {             WatchService watcher = FileSystems.getDefault().newWatchService();             Path dir = Paths.get("F:\\video s\\south indian");             dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);                           System.out.println("Registered  dir:===>" + dir.getFileName());          

How To Upload File Using Struts

Image
===============================index.jsp================================= <%--      Document   : index     Created on : Jun 17, 2015, 8:32:59 PM     Author     : Anand --%> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>File Upload</title> </head> <body>       <center>    <form action="upload" method="post" enctype="multipart/form-data">       <label for="myFile">Upload your file</label>       <input type="file" name="myFile" />       <input type="submit" value="Upload" onclick="run()"/>    </f