zoukankan      html  css  js  c++  java
  • Struct配置

    这里只是写到配置方法:

    第一步:LoginAction:

      

    package com.inspur.actions;

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

    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.actions.DispatchAction;
    import org.springframework.web.context.WebApplicationContext;
    import org.springframework.web.context.support.WebApplicationContextUtils;

    import com.inspur.forms.*;


    public class LoginAction extends DispatchAction {
     //响应登录
      public ActionForward login(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
       System.out.println("******通过新的方式响应请求***********");
       /*
       
       EmployeeForm employeeForm=(EmployeeForm)form;
       //构建一个Employee对象
       Employee e=new Employee();
       e.setId(employeeForm.getId());
       e.setName(employeeForm.getName());
       e.setLeader(employeeForm.getLeader());
       e.setMid("111111");
       eif.addEmployee(e);
       request.getSession().setAttribute("adder", e);
       */
       return mapping.findForward("ok");
      }
      
    }

    第二步:

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//
    DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">
    <struts-config>
     <form-beans>
     <form-bean name="userForm" type="com.inspur.forms.UserForm" />
     </form-beans>
     <action-mappings>
     <action path="/login" parameter="flag" name="userForm" type="com.inspur.actions.LoginAction">
     <forward name="ok" path="/WEB-INF/welcome.jsp"/>
     <forward name="err" path="/WEB-INF/login.jsp"/> 
     </action>
     </action-mappings>
     <!-- 配置代理请求处理 DelegatingRequestProcessor ,它的用户是
     <controller>
       <set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
     </controller>
      -->
    </struts-config>

  • 相关阅读:
    20131226
    20131225
    20131221
    20131216
    如何在电脑上监控安卓手机应用程序运行的CPU、内存等资源情况,并做成曲线图
    jmeter实现protobuf格式参数传输
    jmeter 如何发送上传文件接口请求
    windows 上搭建 sftp 服务器 --freesshd
    python3安装后,为什么一定要输入python.exe才可以进入
    nginx安装
  • 原文地址:https://www.cnblogs.com/CooderIsCool/p/4720849.html
Copyright © 2011-2022 走看看