分析下面的代码:
public ActionForward execute(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
throws Exception 
    {
// Extract attributes and parameters we will need
Locale locale = getLocale(request);
MessageResources messages = getResources(request);
HttpSession session = request.getSession();
UserEditForm m_UserEditForm = (UserEditForm) form;actionform通过execute(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
转过来。
而Action的execute()又是在ActionServlet中处理的,也就是说通过ActionServlet转过来了。
ActionServlet里又通过用户提交的表单取得数据的。

解决方案 »

  1.   

    对不起,我还是没有明白,请看如下代码:
    public class LoginAction extends Action {
      public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
        /**@todo: complete the business logic here, this is just a skeleton.*/
        LoginActionForm loginActionForm = (LoginActionForm) actionForm;
       //这里直接调用了name属性的get方法,获得了name属性的值,可是他是在什么时候
         执行的setName方法将值赋予name属性的呢??
        String name=loginActionForm.getName();
        if(name.equals("user")){
          return actionMapping.findForward("y");
        }
        else{
          return actionMapping.findForward("n");
        } 
      }
    }
    这里直接调用了name属性的get方法,获得了name属性的值,可是他是在什么时候
         执行的setName方法将值赋予name属性的呢??
      

  2.   

    struts 在相应你的请求时帮你做了这件事,收集表单数据压入actionform 
    是框架自动完成的,可以看看源代码
      

  3.   

    set()方法是往jsp中写的,你要取得jsp中的值只要get()方法就可以了