<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## 創建路由 structs.xml 我們刪除原來為了學習和測試的路由信息,并正式的加入生產環境下的路由. ``` <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <!-- 開發模式 - ture --> <constant name="struts.devMode" value="true" /> <package name="default" namespace="/" extends="struts-default"> <!-- 指定默認action --> <default-action-ref name="index" /> <!-- 配置indexAction --> <action name="index"> <result>/jsp/index.jsp</result> </action> </package> <package name="teacher" namespace="/teacher" extends="struts-default"> <!-- 指定默認action --> <default-action-ref name="index" /> <!-- 列表 --> <action name="index"> <result name="success"></result> </action> <!-- 增加數據 --> <action name="add"> <!-- 設置V層,相對于WebContent的絕對路徑 --> <result>/jsp/teacher/add.jsp</result> </action> <!-- 保存數據 --> <action name="save" class="teacher.Save"> <!-- 設置V層,相對于WebContent的絕對路徑 --> <result name="success">/jsp/teacher/saveSuccess.jsp</result> <result name="error">/jsp/teacher/saveError.jsp</result> </action> </package> </struts> ``` 按上述配置,增加/jsp/index.jsp文件作為歡迎頁面。 ### 創建V層文件 位置\(相對于WebContent):/jsp/teacher/add.jsp > 所有的V層文件,全部相對于 WebContent 文件夾 ``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>教師管理--新增</title> </head> <body> <form action="save" method="post"> 姓名:<input type="text" name="name" /> <br /> 用戶名:<input type="text" name="username"> <br /> 性別:<select name="sex"> <option value="0">男</option> <option value="1">女</option> </select> <br /> 郵箱:<input type="text" name="email" /><br /> 密碼:<input type="password" name="password" /><br /> <button type="submit">submit</button> </form> </body> </html> ``` /jsp/success.jsp ``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>操作成功</title> </head> <body> <h1>操作成功</h1> </body> </html> ``` /jsp/error.jsp ``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>操作失敗</title> </head> <body> <h1>操作失敗</h1> </body> </html> ``` ### 測試 在測試控制器返回V層信息的時候,我們仍然使用在瀏覽器中輸入URL的方法。 ![](./../assets/5.teacher-add-to-save.gif) 我們發現struts報出了未找到teacher.Save這個類.證明我們設置的路由信息已生效.
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看