日期:2014-05-19  浏览次数:20682 次

跪求 SSH框架 action接不到JSP页面的值
以下是 action的 代码

package com.tc.test.action;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.struts2.ServletActionContext;

import com.bj.framework.action.BaseAction;
import com.tc.test.bo.UploadFile;
import com.tc.test.service.IUploadService;

public class TestUploadAction extends BaseAction{
//service 模型
private IUploadService uploadServiceImpl;
//上传文件存放路径
private String path="f:/file";
//uploadFile实体类
private UploadFile uploadFile;
//上传文件集合
private List<File> upload=new ArrayList<File>();
//上传文件名集合
private List<String> uploadFileName;
//上传文件类型集合
private List<String> uploadContentType;

public String add() {
try {

uploadServiceImpl.saveUploadFile(uploadFile,getPath(),upload,uploadContentType,uploadFileName);
} catch (Exception e) {
e.printStackTrace();
}
return "requery";
}

public String query(){
list=this.uploadServiceImpl.findAll();
return "query";
}

public String addPage(){
return "addPage";
}

public IUploadService getUploadServiceImpl() {
return uploadServiceImpl;
}
public void setUploadServiceImpl(IUploadService uploadServiceImpl) {
this.uploadServiceImpl = uploadServiceImpl;
}

public String getPath() {
return path;
}

public void setPath(String path) {
this.path = path;
}

public UploadFile getUploadFile() {
return uploadFile;
}

public void setUploadFile(UploadFile uploadFile) {
this.uploadFile = uploadFile;
}

public List<File> getUpload() {
return upload;
}

public void setUpload(List<File> upload) {
this.upload = upload;
}

public List<String> getUploadFileName() {
return uploadFileName;
}

public void setUploadFileName(List<String> uploadFileName) {
this.uploadFileName = uploadFileName;
}

public List<String> getUploadContentType() {
return uploadContentType;
}

public void setUploadContentType(List<String> uploadContentType) {
this.uploadContentType = uploadContentType;
}

}


以下是JSP页面的代码

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
   
  <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">
-->
<link href="images/public3