• 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>

  • 相关阅读:
    Yii2 分页
    Yii2 或者当前登录用户帐号
    css3媒体查询判断移动设备横竖屏
    Javascript操作Tr隐藏显示变形~
    php注释标准
    匹配一段html中所有的src
    数据库遇到错误(随时补充)
    NetCore-缓存文件上传和文件流上传
    SVN跨服务器版本迁移
    发票同步微信卡包
  • 原文地址:https://www.cnblogs.com/CooderIsCool/p/4720849.html
Copyright © 2020-2023  润新知