这是接收JSP请求的Action类:
public ActionForward doValidate(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

SignInForm myForm = (SignInForm)form;
FormFile writeXls=myForm.getWriteXls();
FormFile writeTxt=myForm.getWriteTxt();

String writeNameXls=writeXls.getFileName();//获取上传文件名称
String writeNameTxt=writeTxt.getFileName();//获取上传文件名称
String subNameXls=writeNameXls.substring(writeNameXls.lastIndexOf("."),writeNameXls.length());//
String subNameTxt=writeNameTxt.substring(writeNameTxt.lastIndexOf("."),writeNameTxt.length());
//判断上传文件的类型
if(!".xls".equalsIgnoreCase(subNameXls))
{
request.setAttribute("msg", "请选择后缀为.xls结尾的文件!");
}
if(!".txt".equalsIgnoreCase(subNameTxt))
{
request.setAttribute("msg", "请选择后缀为.txt结尾的文件!");
}

myForm.setShowMsg("您的结果将显示在这里,请注意查看!");
String getPathXls=request.getParameter("pathXls");

String getPathTxt=request.getParameter("pathTxt");

try {
this.ReadAndVerify(getPathXls, getPathTxt, form, request);
} catch (Exception e) {
System.out.println(e.getMessage());
}
return mapping.findForward("toIndex");
}
这是ActionForm类:
public class SignInForm extends ActionForm {
private String showMsg;

private FormFile writeXls;

private FormFile writeTxt;

private String pathXls;

private String pathTxt;
public String getPathXls() {
return pathXls;
} public void setPathXls(String pathXls) {
this.pathXls = pathXls;
} public String getPathTxt() {
return pathTxt;
} public void setPathTxt(String pathTxt) {
this.pathTxt = pathTxt;
} public String getShowMsg() {
return showMsg;
} public void setShowMsg(String showMsg) {
this.showMsg = showMsg;
} public FormFile getWriteXls() {
return writeXls;
} public void setWriteXls(FormFile writeXls) {
this.writeXls = writeXls;
} public FormFile getWriteTxt() {
return writeTxt;
} public void setWriteTxt(FormFile writeTxt) {
this.writeTxt = writeTxt;
}

}
处理中文乱码的类:
public class EncodingProcess extends RequestProcessor {
//Get方式提交时要进行的转换
private String toUTF8(String str)
{
String rt = null;

try
{
if(str!=null)
{
rt = new String(str.getBytes("gbk"),"UTF-8");
}
} catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}

return rt;
}
@SuppressWarnings("unchecked")
protected boolean processPreprocess(HttpServletRequest request,
HttpServletResponse response) {
response.setCharacterEncoding("text/html;charset=UTF-8");
//通用的转换方法
if(request.getMethod().toLowerCase().equals("post"))
{
//如果是post方式提交只要设置请求字符集
try
{
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
}
else
{
//获取所有参数的名称枚举
Enumeration names = request.getParameterNames();

while(names.hasMoreElements())
{
String name = (String)names.nextElement();
String values[] = request.getParameterValues(name);

for(int i=0;i<values.length;i++)
{
//调用转换方法
values[i] = toUTF8(values[i]);
}
}
}
return true;
}
}
JSP页面:
<%@ page language="java" pageEncoding="gbk"%>
<%@taglib prefix="html" uri="/WEB-INF/struts-html.tld" %>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>会议签到系统</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">
function validateXls()
{
var getPathXls = window.document.getElementById("writeXls").value;
var getPathTxt = window.document.getElementById("writeTxt").value;
//window.location.href="sigin.do?method=";
//&pathXls="+getPathXls+"&pathTxt="+getPathTxt+"
if(""==getPathXls||null==getPathXls)
{
alert("请选中");
}
window.document.forms[0].action="sigin.do?method=doValidate&pathXls="+getPathXls+"&pathTxt="+getPathTxt+"";
window.document.forms[0].method="post";
window.document.forms[0].submit();

}

</script>
  </head>
  <c:if test="${not empty msg}">
   <script type="text/javascript">
   alert("${msg}");
   </script>
  </c:if>
  <body>
    <html:form action="sigin.do?method=doValidate" method="post" enctype="multipart/form-data" >
     <table align="center">
     <tr>
     <td colspan="2">
     <html:textarea property="showMsg" rows="10" cols="70"></html:textarea>
     </td> 
     </tr>
     <tr><td>请选择Excel文件:</td>
     <td><html:file property="writeXls" size="44"></html:file></td>
     </tr>
     <tr>
     <td>请选择txt文件:</td>
     <td><html:file property="writeTxt" size="44"></html:file></td>
     </tr>
     <tr>
     <td >&nbsp;<html:button property="Auditing" value="Auditing" onclick="validateXls()"></html:button></td>------为了方便测试,我通过validateXls()这个事件来提交(主要因为是为了方便把取得的路径转到服务器那边,这边的路径是没有问题的)
     <td><html:submit value="审核" style="width=75"></html:submit>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     <html:button property="getOut" value="退出" style="width=75"></html:button></td>
     </tr>
     </table>
    </html:form>
  </body>
</html>测试功能:
根据txt文件中ID字段(有ID和name这两种属性)来确认是否存在Excel文件中的ID(拥有同样的字段),如果没有就现在没有的相关人员,现在主要问题是客户端这边的路径传到服务器那边如果有中文就会出现乱码情况,我上面的那个处理中文的那个类在Struts-config.xml文件中已经配置,但是路径乱码就是处理不了,还请大侠们帮帮忙,不好意思了 各位!(在下先谢谢各位!)