Professional Documents
Culture Documents
xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hashInclude</groupId>
<artifactId>hashInclude</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>hashInclude</name>
<url>http://maven.apache.org</url>
<properties>
<java-version>1.8</java-version>
<org.springframework-version>4.0.0.RELEASE</org.springframework-version>
<hibernate-version>3.6.0.Final</hibernate-version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework-version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate-version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>${hibernate-version}</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<head>
<title>HashInclude Team</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="resources/css/default-page-design.css" />
<script src='resources/js/gen_validatorv5.js' type='text/javascript'></script>
<script type="text/javascript">
function setFocus() {
document.getElementById('userid').focus();
}
</script>
</head>
<body onload="return setFocus();">
<center>
<div class="curveborder" style="width: 650px; height: 300px;">
<font color="maroon" face="'Comic Sans MS'" size="9px">Please
Login !</font><br /> <br />
<hr />
<br />
<style type="text/css">
.error_strings {
font-family: Comic Sans MS;
font-size: 15px;
color: #660000;
}
.sfm_float_error_box {
position: absolute;
z-index: 999;
cursor: default;
font-family: Comic Sans MS;
font-size: 15px;
color: #660000;
background-color: #ffffff;
border-style: solid;
border-width: 0px;
border-color: #ffffff;
}
.sfm_float_box_td {
padding: 3px;
cursor: default;
font-family: Comic Sans MS;
font-size: 15px;
color: #660000;
background-color: #ffffff;
}
.sfm_close_box {
font-family: Comic Sans MS;
font-size: 15px;
color: #660000;
background-color: #ffffff;
border-width: 0px;
text-align: center;
}
</style>
<div id='login_errorloc' class='error_strings' style=''></div>
<form name="login" action="login.do" method="post">
<table>
<tr>
<td colspan="2"><font size="4px" color="red"
face="verdana">${login_failed_info}</font></td>
</tr>
<tr>
<td><font color="maroon" face="Algerian"
size="5px">User
Id:</font></td>
<td><input type="text" name="userid"
id="userid"
class="inputNormal" /></td>
</tr>
<tr>
<td><font color="maroon" face="Algerian"
size="5px">Password:</font></td>
<td><input type="password" name="password"
class="inputNormal" /></td>
</tr>
<tr>
<td colspan="2"><br /></td>
</tr>
<tr>
<td colspan="2"><input type="image"
value="Login"
src="resources/images/images_055.jpg"
class="buttonstyle" /><br/></td>
</tr>
</table>
</form>
<script type='text/javascript'>
// <![CDATA[
var loginValidator = new Validator("login");
loginValidator.EnableOnPageErrorDisplaySingleBox();
loginValidator.EnableMsgsTogether();
loginValidator.validate_on_killfocus = true;
loginValidator.addValidation("userid","req","Userid is Required");
loginValidator.addValidation("password","req","Password is Required");
// ]]>
</script>
</div>
</center>
</body>
</html>
videoList.jsp
<style type="text/css">
.videoTable td, th {
border: 1px blue solid;
}
.videoTable th {
background-color: blue;
color: white;
}
</style>
<script>
$( function() {
$( "#videoTabs" ).tabs({
collapsible: true
});
} );
</script>
</head>
<body>
<div id="videoTabs">
<ul>
<li><a href="#videoTabs-1">Video Upload</a></li>
<li><a href="#videoTabs-2">Search</a></li>
</ul>
<div id="videoTabs-1">
<div style="background-color: #F3FAB6;width: 700px;">
<form method="POST" action="uploadVideoFile"
enctype="multipart/form-data">
File to upload: <input type="file" name="videoFile">
<input type="submit" value="Upload">
</form>
</div><br><br>
<div style="color:red;">${message}</div>
<table class="videoTable"
style="border: 1px blue solid; border-collapse: collapse;
width: 500px">
<thead>
<tr>
<th>Id</th>
<th>Video File Name</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<c:forEach items="${requestScope.allVideoList}"
var="video">
<tr>
<td>${video.vid}</td>
<td>${video.videoname}</td>
<td>${video.type}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<div id="videoTabs-2">
<p>Search</p>
<form action="searchOcr" method="get">
Input String:<input type="text" name="inputString"/> <input
type="submit" value="Search">
</form>
<div style="color:red;">${fileNames}</div>
</div>
</div>
</body>
</html>
package com.fis.constant;
}
package com.fis.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.fis.constant.Constants;
import com.fis.dao.LoginDao;
import com.fis.dao.VideoListDao;
import com.fis.domain.UserId;
@Controller
public class LoginController {
@Autowired
LoginDao loginDao;
@Autowired
VideoListDao videoListDao;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import net.sourceforge.tess4j.Tesseract;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.fis.constant.Constants;
import com.fis.dao.VideoListDao;
@Controller
public class SearchController {
@Autowired
VideoListDao videoListDao;
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
request.setAttribute("fileNames",keyWordFound.keySet().toString());
return "videoList";
}
}
package com.fis.controller;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.fis.constant.Constants;
import com.fis.dao.VideoListDao;
@Controller
public class VideoPanelController {
@Autowired
VideoListDao videoListDao;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Component;
import com.fis.constant.Constants;
import com.fis.domain.UserId;
@Component
public class LoginDao {
/*@Autowired
HibernateTemplate template;
*/
public UserId findUser(String userid, String password) {
/*List<Object> users = template.find("from UserId where userid=? and password=?" ,
new Object[]{userid,password});
if(users.size()!=0){
return (UserId)users.get(0);
} else {
return null;
}*/
List<UserId> userList = loadUsers();
UserId userExist = null;
for(UserId u : userList) {
if(u.getUserid().equals(userid) && u.getPassword().equals(password)){
userExist = u;
break;
}
}
return userExist;
}
private List<UserId> loadUsers(){
File userDir = new File(Constants.ROOT_VIDEO_PATH + File.separator
+ Constants.VIDEO_DIR);
File userIdFile = new File(userDir.getAbsolutePath() + File.separator +
Constants.USER_ID_FILE);
List<UserId> userList = new ArrayList<UserId>();
try{
if(userIdFile.exists()) {
BufferedReader br = new BufferedReader(new InputStreamReader(new
FileInputStream(userIdFile)));
String string = null;
while((string=br.readLine()) != null) {
String userDatas[] = string.split(",");
UserId u1 = new UserId();
u1.setUid(Integer.parseInt(userDatas[0]));
u1.setUserid(userDatas[1]);
u1.setPassword(userDatas[2]);
userList.add(u1);
}
br.close();
}
}catch(Exception e){
e.printStackTrace();
}
return userList;
}
}
package com.fis.dao;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;
import com.fis.constant.Constants;
import com.fis.domain.VideoList;
@Component
public class VideoListDao {
/*@Autowired
HibernateTemplate template;*/
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="userid")
public class UserId {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int uid;
@Column
private String userid;
@Column
private String password;
@Column
private Date createddt;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class VideoList {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int vid;
@Column
private String videoname;
@Column
private String type;
@Column
private Date createdate;
@Column
private String framingflag;
public int getVid() {
return vid;
}
public void setVid(int vid) {
this.vid = vid;
}
public String getVideoname() {
return videoname;
}
public void setVideoname(String videoname) {
this.videoname = videoname;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Date getCreatedate() {
return createdate;
}
public void setCreatedate(Date createdate) {
this.createdate = createdate;
}
public String getFramingflag() {
return framingflag;
}
public void setFramingflag(String framingflag) {
this.framingflag = framingflag;
}
}
dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<bean id="mysessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryB
ean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop
key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.fis.domain.UserId</value>
<value>com.fis.domain.VideoList</value>
</list>
</property>
</bean>
<bean id="template"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="mysessionFactory"></property>
</bean> -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
</bean>
<bean id="viewResolver”
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</context-param>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-
class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/WEB-INF/jsp/login.jsp</welcome-file>
</welcome-file-list>
</web-app>