MyException - 我的异常网
当前位置:我的异常网» Eclipse » <html:link用<bean:write name="element

<html:link用<bean:write name="element"/>做参数有关问题(4)

www.MyException.Cn  网友分享于:2013-12-29  浏览:56次


package   com.yourcompany.struts.action;

import   java.io.BufferedReader;
import   java.io.FileNotFoundException;
import   java.io.FileOutputStream;
import   java.io.FileReader;
import   java.io.IOException;

import   javax.servlet.http.HttpServletRequest;
import   javax.servlet.http.HttpServletResponse;

import   org.apache.struts.actions.DispatchAction;
import   org.apache.struts.action.ActionForm;
import   org.apache.struts.action.ActionForward;
import   org.apache.struts.action.ActionMapping;

import   com.yourcompany.struts.form.Http2Form;


/**  
  *   MyEclipse   Struts
  *   Creation   date:   01-02-2007
  *  
  *   XDoclet   definition:
  *   @struts:action   path= "/http2 "   name= "http2Form "   input= "/form/http2.jsp "   scope= "request "   validate= "true "
  */
public   class   Http2Action   extends   DispatchAction   {

//   ---------------------   Instance   Variables

//   ---------------------   Methods

/**  
  *   Method   execute
  *   @param   mapping
  *   @param   form
  *   @param   request
  *   @param   response
  *   @return   ActionForward
  */
public   ActionForward   add(
ActionMapping   mapping,
ActionForm   form,
HttpServletRequest   request,
HttpServletResponse   response)   {
System.out.println( "in   method   add ");
Http2Form   httpForm   =   (Http2Form)   form;
        String   str= " ";
        if(httpForm.getCollege()!=null){
        try{
        BufferedReader   in=new   BufferedReader(new   FileReader( "e:/temp/DataFactory.txt "));
        int   counter=0;
                String   strLine;
                while((strLine=in.readLine())!=null){
                str+=strLine+ "\r\n ";
                counter++;
               
                }
                if(counter==0)
                counter=1;
          String   strFirst=   counter+ "   :   "+httpForm.getName()+ "   --   "+httpForm.getCollege()+ "\r\n ";
       
        FileOutputStream   out=new   FileOutputStream( "e:/temp/DataFactory.txt ");
        String   newStr=strFirst+str;
        out.write(newStr.getBytes());
        out.flush();
        out.close();
        }catch(FileNotFoundException   e){
        e.printStackTrace();

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有