// 读取一个.html 文件内容
public ActionForward editProductProgramaLabel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws ParseException, UnsupportedEncodingException {
HttpSession session = request.getSession();
if(session.getAttribute("managerid")==null){
return new ActionForward("/manager/sys_manager_login.jsp");
}
Properties proper = System.getProperties();
String sep = proper.getProperty("file.separator");
proper = null;
// 得到2个部分的路径
String s_1Path = request.getRealPath("/") + "home" + sep+ "preview" + sep +"programa_label_1.htm";
String s_2Path = request.getRealPath("/") + "home" + sep+ "preview" + sep +"programa_label_2.htm";
BufferedReader br1 = null;
BufferedReader br2 = null;
File s_1_file = new File(s_1Path);
File s_2_file = new File(s_2Path);
String s_1_content = "";
String s_2_content = "";
String test = "";
try{
// 读取第一部分
InputStreamReader fileReader1 = new InputStreamReader(new FileInputStream(s_1_file) ,"utf-8");
br1 = new BufferedReader(fileReader1);
while(( test = br1.readLine()) != null)
{
s_1_content = s_1_content + test ;
}
//读取第二部分
InputStreamReader fileReader2 = new InputStreamReader(new FileInputStream(s_2_file) ,"utf-8");
br2 = new BufferedReader(fileReader2);
while(( test = br2.readLine()) != null)
{
s_2_content = s_2_content + test;
}
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if (br1!=null){
br1.close();
}
if (br2!=null){
br2.close();
}
}catch(Exception e){}
}
request.setAttribute("content1", s_1_content);
request.setAttribute("content2", s_2_content);
request.setAttribute("contextpath", request.getContextPath());
return new ActionForward("/manager/productProgramaLabel.jsp");
}