#spring jar#
commons-logging-1.1.1.jar
commons-logging-api-1.1.jar
org.springframework.asm-3.1.3.RELEASE.jar
org.springframework.beans-3.1.3.RELEASE.jar
org.springframework.context-3.1.3.RELEASE.jar
org.springframework.context.support-3.1.3.RELEASE.jar
org.springframework.core-3.1.3.RELEASE.jar
org.springframework.expression-3.1.3.RELEASE.jar
org.springframework.web-3.1.3.RELEASE.jar
org.springframework.web.servlet-3.1.3.RELEASE.jar
#eclipse 版本#
Eclipse Java EE IDE for Web Developers.
Version: Kepler Service Release 1
Build id: 20130919-0819
#项目步骤#
1 新建dynamic web project
2 修改web.xml(添加servlet javaServlet负责根据 URL的路径结构进行分析,而调用相应的JavaBean进行业务逻辑处理。)
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>abspring</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <servlet> <description>这是我的第一个Servlet</description> <display-name>mvc</display-name> <servlet-name>mvc</servlet-name> <!-- dispatcher --> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:mvc-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <!-- <servlet> <description></description> <display-name>helloworld</display-name> <servlet-name>helloworld</servlet-name> <servlet-class>com.spring.mvc.learning.helloworld</servlet-class> </servlet> <servlet-mapping> <servlet-name>helloworld</servlet-name> <url-pattern>/helloworld</url-pattern> </servlet-mapping> --> </web-app>
3 在src中 spring的 配置xml(构建beans)
<?xml version="1.0" encoding="UTF-8"?> <!-- org.springframework.web.servlet.view.InternalResourceView --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" xmlns:cache="http://www.springframework.org/schema/cache" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.spring.mvc.control"></context:component-scan> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/"></property> <property name="suffix" value=".jsp"></property> </bean> </beans>
内部资源视图解析器的
前缀:就是http://localhost:8080/项目名称/ jsp
后缀:.jsp
4 新建 RequestMapping
@Controller
@RequestMapping("/xxxx")
package com.spring.mvc.control; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("/goods") public class GoodControl { @RequestMapping("/add") public String addgoods() { return "add"; } @RequestMapping("/list") public ModelAndView listgoods(String uname,String idcard) { ModelAndView mav=new ModelAndView(); mav.addObject("uname",uname); mav.addObject("idcard",idcard); mav.setViewName("list"); return mav; } }
请求 :http://localhost:8080/项目名称/goods/add.do
5 新建内部资源
图 5 内部资源位置
add.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>Insert title here</title> </head> <body> <form action="${pageContext.request.contextPath }/goods/list.do" method="post"> <table> <tr> <td>户名:</td> <td><input type="text" name="uname"/></td> </tr> <tr> <td>身份证:</td> <td><input type="text" name="idcard"/></td> </tr> <tr> <td></td> <td><input type="submit" value="提交"/></td> </tr> </table> </form> </body> </html>
list.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>Insert title here</title> </head> <body> Hi,How are you? ${uname} <br/> your idcard : ${idcard }<br/> real? </body> </html>
list.jsp 中 用到了 el表达式。
至此你可以调试你的web project了
相关推荐
主要介绍了在Eclipse中部署Spring Boot/Spring Cloud应用到阿里云,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
Eclipse+tomcat+maven 配置Spring mvc图文教程 通过本人亲身学习配置的经历所写,简单易懂。而且每一步有图文教程
在myEclipse的jdk中设置后修改java文件不用再重新启动服务就可以自动部署。 -Xms256m -Xmx512m -XX:PermSize=64M -XX:MaxPermSize=128m -Drebel.spring_plugin=true -Drebel.aspectj_plugin=true -Drebel.struts2_...
花了点时间构建好了spring源码,可直接导入IDE。想要学习spring源码的朋友拿走吧。spring源码版本 4.2.0.BUILD-SNAPSHOT,构建时所用jdk版本 1.8 ,构建gradle版本2.2.1。将.git版本控制信息删掉了 ,要不然文件太大...
spring+struts2+myMatis实现的基于角色访问控制的完整eclipse工程 导入eclipse后可以直接运行,包括表,初始化数据的脚本(mysql)
WIN/MAC系统下通用 所需工具: eclipse Maven 开发平台管理工具 若依快速开发平台(ruoyi) mysql native(可视化数据库软件) 实际操作: 1.打开eclipse——...9.修改为(其实就是在注释外添加) alimaven
Eclipse-Maven部署SpringMVC实例Demo
完整的springboot+mybatis框架,打开就可运行。不用再去找POM配置了。
flex+spring+struts2+ibatis 整合的eclipse工程,可以导入eclipse环境下直接使用,因为加入开发的jar大于了上传的最大限制,只能把jar另外打包上传,下载可以从我上传资源的lib1,lib2下载,这个工程的搭建花费了我两...
1. 配置服务器Tomcat 2 1.1. 详细配置如下 2 2. Axis2与Eclipse的整合 7 2.1. Axis2下载,并部署axis2到Tomcat 7 2.2. Eclipse下安装Axis2插件 8 2.2.1. 下载axis2的eclipse插件 8 ...5.6. Eclipse中轻松使用Ant 40
本课程内容包括Spring简介、Spring Boot简介、安装JDK、安装Maven、第一个Spring Boot程序(使用Spring Initializr构建、Spring Boot代码讲解、安装Notepad++)、构建系统、代码、配置、三种方式运行程序、安装...
围棋java源码eclipse 前言 Spring 的数据集成之旅简史 Spring 的数据集成之旅始于 . 凭借其编程模型,它为构建应用程序提供了一致的开发人员体验,这些应用程序可以连接外部系统,例如数据库、消息代理等。 快进到云...
spring部署入门 运行环境:eclipse 构建工具:maven 不提供maven构建,maven用来解决jar包的依赖
应网友要求,重新整理原《eclipse + maven多模块项目框架 + jetty热部署的实例源码》,增加了各配置的详细注释。 并且基于Spring MVC提供了一个完整功能:实现了生成验证码图片,以及验证输入是否匹配的两个接口,...
它提供了一个随时可用的环境来实现、调试、运行和部署Spring应用程序,包括针对Pivotal tc服务器、Pivotal Cloud Foundry、Git、Maven、AspectJ的集成,以及最新的Eclipse发行版。包含在Spring工具套件中的是关键tc...
3.10. 以J2EE RAR文件的形式部署Spring ApplicationContext 3.11. 基于注解(Annotation-based)的配置 3.11.1. @Autowired 3.11.2. 基于注解的自动连接微调 3.11.3. CustomAutowireConfigurer 3.11.4. @...
基于Spring、SpringMVC、MyBatis的酒店管理系统,java项目。 eclipse和idea都能打开运行。 推荐环境配置:eclipse/idea jdk1.8 maven mysql ...提供远程部署、代码讲解等服务 更多精品项目,请查看主页
今天小编就为大家分享一篇关于SpringBoot thymeleaf eclipse热部署方案操作步骤,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
3.10. 以J2EE RAR文件的形式部署Spring ApplicationContext 3.11. 基于注解(Annotation-based)的配置 3.11.1. @Autowired 3.11.2. 基于注解的自动连接微调 3.11.3. CustomAutowireConfigurer 3.11.4. @...
最全宝兰德中间件部署手册