`
Jacksoft_Edgen
  • 浏览: 3411 次
  • 性别: Icon_minigender_1
  • 来自: fjqz
最近访客 更多访客>>
社区版块
存档分类
最新评论
阅读更多
(1) index.htm n内容如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; CHARSET=utf8"/>
<title>Edgen test MVC: First page</title>
</head>
<body>
<form method="POST" action="login.do">
<p align="center">登录</p>
<br>用户名:
<input type="text" name="userName">
<br>密码:&&
<input type="password" name="password">
<p>
<input type="submit" value="提交" name="B1">
<input type="reset" value="重置" name="B2">
</p>
</form>
</body>
</html>


(2) Web.xml 内容如下:

<?xml version="1.0" encoding="GBK"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sum.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/Dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Dispatcher</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>



(3) Dispatcher-servlet.xml 内容如下:

<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">

<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>

<property name="prefix">
<value>/WEB-INF/view/</value>
</property>

<property name="suffix">
<value>.jsp</value>
</property>
</bean>

<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">

<property name="mappings">
<props>
<prop key="/login.do">LoginAction</prop>
</props>
</property>
</bean>

<bean id="LoginAction"
class="net.zhanglong.edgen.action.LoginAction">

<property name="commandClass">
<value>net.zhanglong.edgen.action.LoginInfo</value>
</property>

<property name="fail_view">
<value>loginfail</value>
</property>

<property name="success_view">
<value>main</value>
</property>
</bean>
</beans>


(4) Tomcat 工程(也就是以Variable形式Import 了servlet-api.jar, jsper-runtime.jar, jsp-api.jar  )

(5)其它jar: Import spring.jar, taglib.jar, log4j.jar, cglib.jar, commonds-xxxx.jar, 以Variable 形式Import进jstl-1.1.jar,否则报错:jstl相关类找不到

(6)有点怪! Spring.jar 必须:放在工程lib 或Tomcat/commom/lib 下, 或者以Variable 的形式import, 否则会报错:找不到 DispatcherServlet
分享到:
评论
1 楼 jerry.li 2006-09-21  
如果您下次想显示代码,建议用
括起来。这样可以正常显示代码了。

相关推荐

Global site tag (gtag.js) - Google Analytics