顶一下吧,
不过buildEmployeeForm应该是你自己的封装吧?
要么
request.setAttribute(mapping.getAttribute(), form);
要么
session.setAttribute(mapping.getAttribute(), form);
都是setAttribute
要么session,要么request呗。

解决方案 »

  1.   

    我来解释下request.setAttribute(mapping.getAttribute(), form);
    setAttibute()应该不用解释,主要是mapping.getAttribute() 它得到的是这个Action 在struts-config中 如:<action    path="/html-link"
                   type="org.apache.struts.webapp.exercise.HtmlSettersAction"
                   name="testbean" 
                  scope="session"
               validate="false">
          <forward name="input"                path="/html-link.jsp"/>
        </action>中 BEAN的名字 name="testbean" 的"testbean"
      

  2.   

    其实就是两种方式而已,没什么太多的东西。
    在structs-config.xml中你可以设置对action的访问方式,一共是两种请求,一个是scope="session",还有一个就是scope="request",如果你不写的话,默认的就是前者session。
    这里就是根据两种请求分别处理不同的情况了,因为用session和request的时候,取的的方式不同,所以要根据情况做两种处理。attribute实际上也是structs的一种处理方式,用于指定form类型。实际上getScope和getAttribute就是取<action>中的两个属性而已。
    <action attribute="" type="" name="" scope="">而已。