一: Struts2 入门: 视图: jsp () 控制器: StrutsPrepareAndExecuteFilter ,在 (过滤器)中。模型: action(LoginAction) 那个 FilterDispatche r是 struts 1的, struts 2的是StrutsPrepareAndExecuteFilter 在这里, 我不知道的是如何实例化的, 给实例化的? Index. jsp <%@ page language ="java" import =".*" pageEncoding ="UTF-8" %> <% String path =(); String basePath = ()+ "://" +()+ ":" +req ()+path+ "/" ; %> <! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Transitional//EN" > <html ><head ><base href ="<%= basePath %> "> <title >My JSP '' starting page </ title > </ head ><body ><form action ="" > <input type ="text" name ="username" > <input type ="submit" name ="submit" > </ form ></ body ></ html > W <? xml version ="" encoding ="UTF-8" ?> <web-app version ="" xmlns ="http://java./xml/ns/javaee" xmlns:xsi ="1/XMLSchema-instance" xsi:schemaLocation ="http://java./xml/ns/javaee http://java./xml/ns/javaee/web-" > <filter ><filter-name >struts2 </ filter-name > <filter-class > utsPrepareAndExecuteFilter </ filter-class > </ filter ><filter-mapping ><filter-name >struts2 </ filter-name > <url-pattern >/* </ url-pattern > </ filter-mapping > <e-file-list > <e-file > </ e-file > </ e-file-list > </ web-app >S <? xml version ="" encoding ="UTF-8" ?> <! DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration //EN" "http://struts./dtds/struts-" > <struts ><package name ="struts2" extends ="struts-default" > <action name ="loginaction" class ="" > <result name ="ess" >/ </ result > </ action ></ package ></ struts > LoginAction .; .; public class LoginAction extends ActionSupport { private String username ; public String password ; public String getUsername() { return username ; } pu
struts2 从头到尾(精) 来自淘豆网www.taodocs.com转载请标明出处.