JSP程序设计 第11章习题答案

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

11 MVC

11 MVC

1 Web

Web Model1 Model2

Model1

1 JSP

2 Java Bean JSP Java Bean

3 Java Bean

4 JSP

Model2

1 Servlet

2 Servlet Java Bean

3 Java Bean

4 Servlet Java Bean JSP

5 JSP

Model1

Model1 Model2 Model2 Model2

2 MVC M V C

M Model I/O

View

Controller

11 MVC

3 MVC

MVC MVC

MVC

URL

4 Spring MVC

Spring MVC

1 Http

2 Spring DispatcherServlet

3 DispatcherServlet

4 ModelAndView DispatcherServlet ModelAndView

5 DispatcherServlet ViewResolver

6 DispatcherServlet View

7 View Http

5 Struts2

“sunyang “1234

1 Web login commons-logging-1.0.4.jar freemarker-2.3.8.jar ognl-2.6.11.jar struts2-core-2.0.11.jar xwork-2.0.4.jar 5

11 MVC

2 web.xml Struts2 FilterDispatcher

xmlns="/xml/ns/javaee"

xmlns:xsi="/2001/XMLSchema-instance"

xsi:schemaLocation="/xml/ns/javaee

/xml/ns/javaee/web-app_2_5.xsd">

login.jsp

struts2

org.apache.struts2.dispatcher.FilterDispatcher

struts2

/*

3 com LoginAction.java

public class LoginAction {

private String username; //

private String password; //

public String getUsername() {

return username;

}

public void setUsername(String username) {

ername = username;

}

public String getPassword() {

return password;

}

public void setPassword(String password) {

11 MVC

this.password = password;

}

public String execute() {

// sunyang 1234

if(username.equals("sunyang")&&password.equals("1234"))

return "loginSuccess";

else

return "loginError";

}

}

4 src Struts2 struts.xml loginAction struts.xml

"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

"/dtds/struts-2.0.dtd">

/success.jsp

/error.jsp

5 WebRoot login.jsp success.jsp error.jsp

login.jsp

<%@ page language="java" contentType="text/html; charset=GBK"%>

<%@ taglib prefix="s" uri="/struts-tags"%>

相关文档
最新文档