From 582d1fe87b44376567d071e773dec35ab30bb48d Mon Sep 17 00:00:00 2001
From: shapeshifter <315752375@qq.com>
Date: Sun, 5 Mar 2017 18:39:55 +0800
Subject: [PATCH] homework20170226

---
 group21/315752375/homework20170226/.classpath |   8 +
 group21/315752375/homework20170226/.gitignore |   2 +
 group21/315752375/homework20170226/.project   |  17 ++
 .../src/com/coderising/array/ArrayUtil.java   | 242 ++++++++++++++++++
 .../com/coderising/array/ArrayUtilTest.java   | 104 ++++++++
 .../coderising/litestruts/LoginAction.java    |  39 +++
 .../src/com/coderising/litestruts/Struts.java | 106 ++++++++
 .../com/coderising/litestruts/StrutsTest.java |  45 ++++
 .../src/com/coderising/litestruts/View.java   |  23 ++
 .../src/com/coderising/litestruts/struts.xml  |  11 +
 .../homework20170226/src/dom4j-1.6.1.jar      | Bin 0 -> 313898 bytes
 11 files changed, 597 insertions(+)
 create mode 100644 group21/315752375/homework20170226/.classpath
 create mode 100644 group21/315752375/homework20170226/.gitignore
 create mode 100644 group21/315752375/homework20170226/.project
 create mode 100644 group21/315752375/homework20170226/src/com/coderising/array/ArrayUtil.java
 create mode 100644 group21/315752375/homework20170226/src/com/coderising/array/ArrayUtilTest.java
 create mode 100644 group21/315752375/homework20170226/src/com/coderising/litestruts/LoginAction.java
 create mode 100644 group21/315752375/homework20170226/src/com/coderising/litestruts/Struts.java
 create mode 100644 group21/315752375/homework20170226/src/com/coderising/litestruts/StrutsTest.java
 create mode 100644 group21/315752375/homework20170226/src/com/coderising/litestruts/View.java
 create mode 100644 group21/315752375/homework20170226/src/com/coderising/litestruts/struts.xml
 create mode 100644 group21/315752375/homework20170226/src/dom4j-1.6.1.jar

diff --git a/group21/315752375/homework20170226/.classpath b/group21/315752375/homework20170226/.classpath
new file mode 100644
index 000000000..05cf0dba9
--- /dev/null
+++ b/group21/315752375/homework20170226/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="lib" path="src/dom4j-1.6.1.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/group21/315752375/homework20170226/.gitignore b/group21/315752375/homework20170226/.gitignore
new file mode 100644
index 000000000..dbc5ccaae
--- /dev/null
+++ b/group21/315752375/homework20170226/.gitignore
@@ -0,0 +1,2 @@
+/bin/
+/.settings
diff --git a/group21/315752375/homework20170226/.project b/group21/315752375/homework20170226/.project
new file mode 100644
index 000000000..b571c262e
--- /dev/null
+++ b/group21/315752375/homework20170226/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>homework20170226</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/group21/315752375/homework20170226/src/com/coderising/array/ArrayUtil.java b/group21/315752375/homework20170226/src/com/coderising/array/ArrayUtil.java
new file mode 100644
index 000000000..535582111
--- /dev/null
+++ b/group21/315752375/homework20170226/src/com/coderising/array/ArrayUtil.java
@@ -0,0 +1,242 @@
+package com.coderising.array;
+
+public class ArrayUtil {
+
+	/**
+	 * 给定一个整形数组a , 对该数组的值进行置换 例如： a = [7, 9 , 30, 3] , 置换后为 [3, 30, 9,7] 如果 a =
+	 * [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+	 * 
+	 * @param origin
+	 * @return
+	 */
+	public static void reverseArray(int[] origin) {
+		int length = origin.length;
+		int tmp = 0;
+		for (int i = 0; i < length / 2; i++) {
+			tmp = origin[i];
+			origin[i] = origin[length - i - 1];
+			origin[length - i - 1] = tmp;
+		}
+	}
+
+	/**
+	 * 现在有如下的一个数组： int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}
+	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为： {1,3,4,5,6,6,5,4,7,6,7,5}
+	 * 
+	 * @param oldArray
+	 * @return
+	 */
+
+	public static int[] removeZero(int[] oldArray) {
+		int last = 0;// 记录最后一个元素的位置
+		int length = oldArray.length;
+		int zero = 0;// 记录数组中第一个0的位置
+		int nonzero = 1;// 记录zero后面第一个非零的位置
+		while (zero < length - 1) {
+			if (oldArray[zero] == 0) {
+				// System.out.println("zero:" + zero);
+				// nonzero = zero + 1;
+				while (nonzero < length) {
+					if (oldArray[nonzero] != 0)
+						break;
+					nonzero++;
+				}
+				// System.out.println("nonzero:" + nonzero);
+				if (nonzero >= length)
+					break;
+				oldArray[zero] = oldArray[nonzero];
+				oldArray[nonzero] = 0;
+				last = zero;
+				// System.out.println(last);
+			} else
+				zero++;
+		}
+		int[] target = new int[last + 1];
+		// System.out.println(target.length);
+		System.arraycopy(oldArray, 0, target, 0, last + 1);
+		return target;
+	}
+
+	/**
+	 * 给定两个已经排序好的整形数组， a1和a2 , 创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的 例如 a1 =
+	 * [3, 5, 7,8] a2 = [4, 5, 6,7] 则 a3 为[3,4,5,6,7,8] , 注意： 已经消除了重复
+	 * 
+	 * @param array1
+	 * @param array2
+	 * @return
+	 */
+
+	public static int[] merge(int[] array1, int[] array2) {
+		int index1 = 0;// 指向下一个元素
+		int index2 = 0;// 指向下一个元素
+		int len1 = array1.length;
+		int len2 = array2.length;
+		int[] target = new int[len1 + len2];
+		int index = 0;// 指向下一个空位置
+		int min = 0;
+		while (index1 < len1 && index2 < len2) {
+			if (array1[index1] < array2[index2]) {
+				target[index++] = array1[index1++];
+			} else {
+				target[index++] = array2[index2++];
+			}
+		}
+		if (index1 >= len1)
+			System.arraycopy(array2, index2, target, index, len2 - index2);
+		else
+			System.arraycopy(array1, index1, target, index, len1 - index1);
+		return target;
+	}
+
+	/**
+	 * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
+	 * 注意，老数组的元素在新数组中需要保持 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
+	 * [2,3,6,0,0,0]
+	 * 
+	 * @param oldArray
+	 * @param size
+	 * @return
+	 */
+	public static int[] grow(int[] oldArray, int size) {
+		if (size < 0)
+			throw new IllegalArgumentException();
+		System.out.println("asdfwefaw");
+		int len = oldArray.length;
+		int[] target = new int[len + size];
+		System.arraycopy(oldArray, 0, target, 0, len);
+		return target;
+	}
+
+	/**
+	 * 斐波那契数列为：1，1，2，3，5，8，13，21...... ，给定一个最大值， 返回小于该值的数列 例如， max = 15 ,
+	 * 则返回的数组应该为 [1，1，2，3，5，8，13] max = 1, 则返回空数组 []
+	 * 
+	 * @param max
+	 * @return
+	 */
+	public static int[] fibonacci(int max) {
+		int first = 0;// 记录第一个数
+		int[] target = new int[max];
+		int count = 0;
+		int i = 1;// 记录后一个数
+		while (i < max) {
+			int tmp = i;
+			target[count++] = i;
+			i = i + first;
+			first = tmp;
+		}
+		int[] answer = new int[count];
+		System.arraycopy(target, 0, answer, 0, count);
+		return answer;
+	}
+
+	/**
+	 * 返回小于给定最大值max的所有素数数组 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
+	 * 
+	 * @param max
+	 * @return
+	 */
+	public static int[] getPrimes(int max) {// 素数筛选法
+		boolean[] primes = new boolean[max];
+		int[] target = new int[max / 2];
+		int count = 0;
+		for (int i = 1; i < max; i += 2) {// 全部偶数默认false，奇数设为true
+			primes[i] = true;
+		}
+		primes[2] = true;// 2为偶数但是是素数
+		for (int i = 3; i < (int) Math.sqrt(max); i += 2) {// 0，1非素数非合数，还有2是素数，所以从3开始
+			if (primes[i])
+				for (int j = i + i; j < max; j += i) {// 将i的整倍数不是素数，设为false
+					primes[j] = false;
+				}
+		}
+		for (int i = 2; i < max; i++) {// 最后所有下标从2开始的true为素数
+			if (primes[i])
+				target[count++] = i;
+		}
+		int[] answer = new int[count];
+		System.arraycopy(target, 0, answer, 0, count);
+		return answer;
+	}
+
+	/**
+	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+	 * 
+	 * @param max
+	 * @return
+	 */
+	public static int[] getPerfectNumbers(int max) {
+		long start = System.currentTimeMillis();
+		int sum = 0;
+		int[] array = new int[50];
+		int count = 0;
+		int count1 = 5;
+		for (int i = 1; i < max;) {
+			try {
+//				System.out.println("i:" + i + " sum:" + sum);
+				if (i % 10 != 6 && i % 10 != 8) {
+					continue;
+				} else if (i != 6) {
+//					System.out.println(i + " " + i % 3 + " " + i % 9);
+					if (i % 3 != 1 || i % 9 != 1) {
+						continue;
+					}
+				}
+				sum = 1;// 1已一定为因子
+				// System.out.print("数"+i+"的因子：");
+				// System.out.print(1+" ");
+				for (int j = 2; j < Math.sqrt(i); j++) {
+					if (i % j == 0) {
+						sum += j;
+						sum += i / j;
+						// System.out.print(j+" "+i/j+" ");
+					}
+
+				}
+				if (Math.abs(Math.sqrt(i) - (int) (Math.sqrt(i))) == 0) {
+					sum += (int) Math.sqrt(i);
+				}
+				// System.out.println();
+//				System.out.println("i:" + i + " sum:" + sum);
+				if (sum == i)
+					array[count++] = i;
+			} finally {
+				if (i < 28)
+					i++;
+				else {
+					i = i + (int) Math.pow(count1, 3);
+					count1 += 2;
+//					System.out.println(i);
+				}
+			}
+		}
+
+		int[] answer = new int[count];
+		System.arraycopy(array, 0, answer, 0, count);
+		long cost = System.currentTimeMillis()-start;
+		System.out.println("cost time: "+cost+"ms");
+
+		return answer;
+	}
+
+	/**
+	 * 用seperator 把数组 array给连接起来 例如array= [3,8,9], seperator = "-" 则返回值为"3-8-9"
+	 * 
+	 * @param array
+	 * @param s
+	 * @return
+	 */
+	public static String join(int[] array, String seperator) {
+
+		int len = array.length;
+		String answer = "";
+		for (int i = 0; i < len - 1; i++) {
+			answer += array[i];
+			answer += seperator;
+		}
+		answer += array[len - 1];
+
+		return answer;
+	}
+
+}
diff --git a/group21/315752375/homework20170226/src/com/coderising/array/ArrayUtilTest.java b/group21/315752375/homework20170226/src/com/coderising/array/ArrayUtilTest.java
new file mode 100644
index 000000000..9943556a3
--- /dev/null
+++ b/group21/315752375/homework20170226/src/com/coderising/array/ArrayUtilTest.java
@@ -0,0 +1,104 @@
+package com.coderising.array;
+
+
+import java.util.Arrays;
+
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ArrayUtilTest {
+	
+	@Test
+	public void testReverseArray() {
+		System.out
+				.println("-----------------------这是华丽的分割线------------------------");
+		System.out.println("test reverseArray(int[] array)");
+		int[] src = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+		System.out.println("values of arrays:" + Arrays.toString(src));
+		ArrayUtil.reverseArray(src);
+		System.out.println("after reversing" + Arrays.toString(src));
+	}
+
+	@Test
+	public void testRemoveZero() {
+		System.out
+				.println("-----------------------这是华丽的分割线------------------------");
+		System.out.println("test removeZero(int[] array)");
+		int[] src = { 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0 };
+		System.out.println("values of arrays:" + Arrays.toString(src));
+		int[] target = ArrayUtil.removeZero(src);
+		System.out.println("after removings:" + Arrays.toString(target));
+	}
+
+	@Test
+	public void testMerge() {
+		System.out
+				.println("-----------------------这是华丽的分割线------------------------");
+		System.out.println("test merge(int[] array1,int[] array2)");
+		int[] merge1 = { 1, 3, 4, 6, 8, };
+		int[] merge2 = { 0, 2, 3, 4, 5, 7, 9 };
+		System.out.println("sorted array1:" + Arrays.toString(merge1));
+		System.out.println("sorted array2:" + Arrays.toString(merge2));
+		int[] target = new int[merge1.length + merge2.length];
+		target = ArrayUtil.merge(merge1, merge2);
+		System.out.println("after merging and sorting:" + Arrays.toString(target));
+	}
+
+	@Test
+	public void testGrow() {
+		System.out
+				.println("-----------------------这是华丽的分割线------------------------");
+		System.out.println("test grow(int[] array,int size)");
+		int[] oldArrays = { 1, 3, 4, 6, 8, };
+		int size = 10;
+		System.out.println("size of oldArray:" + oldArrays.length);
+		System.out.println("size grows " + size);
+		oldArrays = ArrayUtil.grow(oldArrays, size);
+		System.out.println("after growing:" + oldArrays.length);
+	}
+
+	@Test
+	public void testFibonacci() {
+		System.out
+				.println("-----------------------这是华丽的分割线------------------------");
+		System.out.println("test fibonacci(int max)");
+		int num=19;
+		System.out.print("小于 "+num+" 的斐波那契数列:");
+		System.out.println(Arrays.toString(ArrayUtil.fibonacci(15)));
+	}
+
+	@Test
+	public void testGetPrimes() {
+		System.out
+				.println("-----------------------这是华丽的分割线------------------------");
+		System.out.println("test getPrimes(int max)");
+		int num = 10000;
+		System.out.println("小于 " + num + " 的素数有："
+				+ Arrays.toString(ArrayUtil.getPrimes(num)));
+	}
+
+	@Test
+	public void testGetPerfectNumbers() {
+		System.out
+				.println("-----------------------这是华丽的分割线------------------------");
+		System.out.println("test getPrimes(int max)");
+		int num=33550337;
+		System.out.println("小于 "+num+" 的完数有："+Arrays.toString(ArrayUtil.getPerfectNumbers(num)));
+	}
+
+	@Test
+	public void testJoin() {
+		System.out
+				.println("-----------------------这是华丽的分割线------------------------");
+		System.out.println("test join(int[] array, String seperator)");
+		int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+		String seperator="+";
+		System.out.println("use "+"\""+seperator+"\""+" to join array");
+		System.out.println("old array:"+Arrays.toString(array));
+		System.out.println("after joining:"+ArrayUtil.join(array, "-"));	
+	}
+
+}
diff --git a/group21/315752375/homework20170226/src/com/coderising/litestruts/LoginAction.java b/group21/315752375/homework20170226/src/com/coderising/litestruts/LoginAction.java
new file mode 100644
index 000000000..dcdbe226e
--- /dev/null
+++ b/group21/315752375/homework20170226/src/com/coderising/litestruts/LoginAction.java
@@ -0,0 +1,39 @@
+package com.coderising.litestruts;
+
+/**
+ * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
+ * @author liuxin
+ *
+ */
+public class LoginAction{
+    private String name ;
+    private String password;
+    private String message;
+
+    public String getName() {
+        return name;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String execute(){
+            if("test".equals(name) && "1234".equals(password)){
+                this.message = "login successful";
+                return "success";
+            }
+            this.message = "login failed,please check your user/pwd";
+            return "fail";
+    }
+
+    public void setName(String name){
+        this.name = name;
+    }
+    public void setPassword(String password){
+        this.password = password;
+    }
+    public String getMessage(){
+        return this.message;
+    }
+}
diff --git a/group21/315752375/homework20170226/src/com/coderising/litestruts/Struts.java b/group21/315752375/homework20170226/src/com/coderising/litestruts/Struts.java
new file mode 100644
index 000000000..7f0c0dc22
--- /dev/null
+++ b/group21/315752375/homework20170226/src/com/coderising/litestruts/Struts.java
@@ -0,0 +1,106 @@
+package com.coderising.litestruts;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+public class Struts {
+	public static View runAction(String actionName,
+			Map<String, String> parameters) {
+		View view = new View();
+		try {
+			InputStream inputStream = null;
+			inputStream = new FileInputStream(new File(
+					"./src/com/coderising/litestruts/struts.xml"));
+			SAXReader saxReader = new SAXReader();
+			Document document = null;
+			document = saxReader.read(inputStream);
+			Element root = document.getRootElement();//根节点struts
+			Iterator<Element> actions = root.elements("action").iterator();//变量用于存储所有action的节点
+			Element element = null;
+			while (actions.hasNext()) {//获得name为参数actionName的action节点
+				element = actions.next();
+				if (actionName.equals(element.attributeValue("name"))) {
+					break;
+				}
+
+			}
+			Map<String, String> result = new HashMap<>();//变量用于存储action下result的name和value；
+			Iterator<Element> results = element.elements("result").iterator();//获得name为参数actionName的action节点的所有result节点的迭代器
+			while (results.hasNext()) {//读取所有的action下result的name和value；
+				Element tmp = results.next();
+				String resultname = tmp.attributeValue("name");
+				String resultvalue = tmp.getText();
+				result.put(resultname, resultvalue);
+			}
+			inputStream.close();
+			String clazz = element.attributeValue("class");//获得actionName对应action的class属性对应的值
+//			System.out.println(clazz);
+			Object object = null;
+			object = Class.forName(clazz).newInstance();//
+			int len = parameters.size();
+			Method method =null;
+			Iterator<Map.Entry<String, String>> map = parameters.entrySet()
+					.iterator();
+			while (map.hasNext()) {//取得所有parameters中的map，调用上面类实例中map中key值的setter，设为value；
+				Map.Entry<String, String> tmp = map.next();
+				String namemethod = "set"
+						+ tmp.getKey().substring(0, 1).toUpperCase()
+						+ tmp.getKey().substring(1);
+				method = object.getClass().getMethod(namemethod,
+						String.class);
+				String namevalue = tmp.getValue();
+				method.invoke(object, namevalue);
+			}
+			Method execute = null;
+			String loginresult = null;//登陆结果"success",or"fail"
+			execute = object.getClass().getMethod("execute");
+			
+			loginresult = (String) execute.invoke(object);
+			view.setJsp(result.get(loginresult));
+			int count=object.getClass().getDeclaredMethods().length;
+			Map<String, String> viewParameters=new HashMap<>();
+			while(count--!=0){//获取所有的getter
+				method=object.getClass().getDeclaredMethods()[count];
+				String mName=method.getName();
+				if(mName.startsWith("get")){
+					String value=(String)method.invoke(object);
+					String key=(String)mName.substring(3,4).toLowerCase()+mName.substring(4);
+					viewParameters.put(key, value);
+				}
+			}
+			view.setParameters(viewParameters);
+//			System.out.println(view.getJsp());
+//			System.out.println(view.getParameters().get("message"));
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		/*
+		 * 
+		 * 0. 读取配置文件struts.xml
+		 * 
+		 * 1. 根据actionName找到相对应的class ， 例如LoginAction, 通过反射实例化（创建对象）
+		 * 据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 ("name"="test" ,
+		 * "password"="1234") , 那就应该调用 setName和setPassword方法
+		 * 
+		 * 2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+		 * 
+		 * 3. 通过反射找到对象的所有getter方法（例如 getMessage）, 通过反射来调用， 把值和属性形成一个HashMap , 例如
+		 * {"message": "登录成功"} , 放到View对象的parameters
+		 * 
+		 * 4. 根据struts.xml中的 <result> 配置,以及execute的返回值， 确定哪一个jsp，
+		 * 放到View对象的jsp字段中。
+		 */
+
+		return view;
+	}
+}
diff --git a/group21/315752375/homework20170226/src/com/coderising/litestruts/StrutsTest.java b/group21/315752375/homework20170226/src/com/coderising/litestruts/StrutsTest.java
new file mode 100644
index 000000000..df7c0f105
--- /dev/null
+++ b/group21/315752375/homework20170226/src/com/coderising/litestruts/StrutsTest.java
@@ -0,0 +1,45 @@
+package com.coderising.litestruts;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class StrutsTest {
+
+	@Test
+	public void testLoginActionSuccess() {
+		System.out.println("---------------这是一条华丽的分割线-------------");
+		System.out.println("test Login Action Success");
+		String actionName = "login";
+        
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","1234");
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/homepage.jsp", view.getJsp());
+        Assert.assertEquals("login successful", view.getParameters().get("message"));
+	}
+
+	@Test
+	public void testLoginActionFailed() {
+		System.out.println("---------------这是一条华丽的分割线-------------");
+		System.out.println("test Login Action Failed");
+
+		String actionName = "login";
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","123456"); //密码和预设的不一致
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/showLogin.jsp", view.getJsp());
+        Assert.assertEquals("login failed,please check your user/pwd", view.getParameters().get("message"));
+	}
+}
diff --git a/group21/315752375/homework20170226/src/com/coderising/litestruts/View.java b/group21/315752375/homework20170226/src/com/coderising/litestruts/View.java
new file mode 100644
index 000000000..07df2a5da
--- /dev/null
+++ b/group21/315752375/homework20170226/src/com/coderising/litestruts/View.java
@@ -0,0 +1,23 @@
+package com.coderising.litestruts;
+
+import java.util.Map;
+
+public class View {
+	private String jsp;
+	private Map parameters;
+	
+	public String getJsp() {
+		return jsp;
+	}
+	public View setJsp(String jsp) {
+		this.jsp = jsp;
+		return this;
+	}
+	public Map getParameters() {
+		return parameters;
+	}
+	public View setParameters(Map parameters) {
+		this.parameters = parameters;
+		return this;
+	}
+}
diff --git a/group21/315752375/homework20170226/src/com/coderising/litestruts/struts.xml b/group21/315752375/homework20170226/src/com/coderising/litestruts/struts.xml
new file mode 100644
index 000000000..e5d9aebba
--- /dev/null
+++ b/group21/315752375/homework20170226/src/com/coderising/litestruts/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="com.coderising.litestruts.LoginAction">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="com.coderising.litestruts.LogoutAction">
+    	<result name="success">/jsp/welcome.jsp</result>
+    	<result name="error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file
diff --git a/group21/315752375/homework20170226/src/dom4j-1.6.1.jar b/group21/315752375/homework20170226/src/dom4j-1.6.1.jar
new file mode 100644
index 0000000000000000000000000000000000000000..c8c4dbb92d6c23a7fbb2813eb721eb4cce91750c
GIT binary patch
