首页 > 其他分享 >Appengine部署springMVC3.1

Appengine部署springMVC3.1

时间:2023-05-24 13:01:16浏览次数:34  
标签:springMVC3.1 部署 spring jar springframework 3.1 RELEASE org Appengine


参考:[url]http://sikeh.iteye.com/blog/364043[/url]
获得springMVC的方法:[url]http://panyongzheng.iteye.com/blog/1759912[/url]

[b]1. mvn archetype:create -DgroupId=com.pandy -DartifactId=study[/b]
[b]2. cd study [/b]
需要做一些另外的事情,然后再打包,得到的pom.xml如下:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.pandy</groupId>
  <artifactId>study</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>study</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
	<dependency>  
            <!-- 增加spring-webmvc依赖 -->  
            <groupId>org.springframework</groupId>  
            <artifactId>spring-webmvc</artifactId>  
            <version>3.1.2.RELEASE</version>  
        </dependency> 
  </dependencies>

  <build>  
        <plugins>  
            	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-dependency-plugin</artifactId>
		<executions>
			<execution>
				<id>copy</id>
				<phase>install</phase>
				<goals>
					<goal>copy-dependencies</goal>
				</goals>
				<configuration>
					<outputDirectory>$/lib</outputDirectory>
					-->拷贝所以依赖存放位置
				</configuration>
			</execution>
		</executions>
	</plugin>  

        </plugins>  
    </build> 
</project>



[b]3.mvn dependency:copy-dependencies[/b]


所有依赖的jar文件将被复制到target/dependency目录下。得到所有springmvc的依赖包.


并加入:jstl.jar ,standard.jar



[b]4.在eclipse建立appengine项目.[/b]



[b]5.web.xml加入:[/b]


<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
	</context-param>

	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<servlet>
		<servlet-name>dispatcher</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>dispatcher</servlet-name>
		<url-pattern>*.do</url-pattern>
	</servlet-mapping>



[b]6.war/WEB-INF/dispatcher-servlet.xml[/b]


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context 
		http://www.springframework.org/schema/context/spring-context.xsd
		http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

	<bean
		class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />

	<context:component-scan base-package="com.gae.pandy.controller" />
	<mvc:annotation-driven />

	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver"
		p:prefix="/views/" p:suffix=".jsp" />

</beans>



[b]7.war/views/test.jsp[/b]


<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page isELIgnored="false"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
	Hi,
	<c:out value="${name}" />
	<br /> It works!
	<br />
	<a href="/index.jsp">Back</a>
</body>
</html>



[b]8.index.jsp[/b]


<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
	<form action="test.do" method="post">
		your name: <br /> <input type="text" name="name" /> <br /> <input
			type="submit" value="Submit" />
	</form>

</body>
</html>



[b]9.Controller[/b]


package com.gae.pandy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class TestController {

	@RequestMapping(value = "/test.do", method = RequestMethod.POST)
	public String test(String name, Model model) {
		model.addAttribute("name", name);
		return "test";
	}
}



[b]10.http://localhost:8888/index.jsp 测试springmvc[/b]



附:

aopalliance-1.0.jar

appengine-api-1.0-sdk-1.7.4.jar

appengine-api-labs.jar

appengine-endpoints.jar

appengine-jsr107cache-1.7.4.jar

apps-marketplace.jar

asm-4.0.jar

commons-logging-1.1.1.jar

datanucleus-api-jdo-3.1.1.jar

datanucleus-api-jpa-3.1.1.jar

datanucleus-appengine-2.1.1.jar

datanucleus-core-3.1.1.jar

geronimo-jpa_2.0_spec-1.0.jar

jdo-api-3.0.1.jar

jsr107cache-1.1.jar

jstl.jar

jta-1.1.jar

junit-3.8.1.jar

spring-aop-3.1.2.RELEASE.jar

spring-asm-3.1.2.RELEASE.jar

spring-beans-3.1.2.RELEASE.jar

spring-context-3.1.2.RELEASE.jar

spring-context-support-3.1.2.RELEASE.jar

spring-core-3.1.2.RELEASE.jar

spring-expression-3.1.2.RELEASE.jar

spring-web-3.1.2.RELEASE.jar

spring-webmvc-3.1.2.RELEASE.jar

standard.jar


标签:springMVC3.1,部署,spring,jar,springframework,3.1,RELEASE,org,Appengine
From: https://blog.51cto.com/u_3871599/6338692

相关文章

  • windows环境下的vue部署(使用nginx)
    首先需要将vue项目打包成dist,在需要部署的服务器上进行解压然后我们使用nginx进行反向代理设置,具体操作如下打开解压后的nginx,进入目录:nginx-1.23.4->conf,打开编辑nginx.conf*注意:对于后端路径的映射这里一定是^~/前缀/对应于地址的端口/前缀/,这里一定是两个//包裹。以下......
  • wordpress部署
    wordpress部署1,拉取镜像dockerpull192.168.100.10/library/wordpressdockerpull192.168.100.10/library/mysql:5.62,编写compose文件mkdir/root/wordpressvimdocker-compose.yamlversion:'3.3'services:wordprss:image:192.168.100.1......
  • 3d打印机添加AI炒面检测服务 klipper+fluidd ubuntu本地部署TheSpaghttiDetective Ser
    炒面检测(TheSpaghettiDetective)介绍:炒面检测服务可以借助打印机的摄像头,检测打印是否炒面(打印失败)并作出提醒或停止打印的一种服务,该服务由服务器和客户端组成客户端支持两种: ocoprint或klipper服务器也有两种:ocobi官方提供的有限免费服务......
  • 阿里云vpc下面部署自建k8s一些注意事项
    简介这几天接手了一个政府单位项目,所有的资源均为云资源,而且是阿里云vpc机器。在部署k8s的过程中发现我部署的k8s跨主机网段不通。折腾了我好几天最后发现问题是我在vpc里面是用的不是规定的cidr,我是用的是172.235.0.0修改到规定的cidr清空etcd删除网络重装k8s即可。解决阿......
  • mysql、redis、mongo本地docker部署命令备忘
    1mysqldocker环境部署####获取镜像dockerpullredis####启动mysqldockerrun--name=mysql-it-p3306:3306-eMYSQL_ROOT_PASSWORD=123456-dmysql####登录mysql-h127.0.0.1-P3306-uroot-p1234562redisdocker环境部署####官⽅方指引https://hub.docker.c......
  • 用CentOS服务器自己搭建部署个Discuz论坛网站,网站搭建教程
     Linux系统CentOS服务器使用堡塔搭建论坛网站全套教程。服务器大本营,技术文章内容集合站发车啦! 操作系统:Centos 7.6网站程序:Discuz-X3.4前言首先,搭建一个网站需要准备:服务器、域名、网站程序。 服务器是什么?服务器从字面理解就是提供服务的机器,服务器可以提供哪些......
  • MVC4 部署 could not load file or assembly system.web.http.webhost.....出错
    1.确保项目是.net4.0版本 2.如下图标出的部分,确保这个dll引用是项目本地,找到项目下的“引用”,找到对应的引用右键属性,将“复制本地”改为True,这里我们可以在项目下新建一个存入dll的文件夹,将这些dll放在这个文件夹里面,路径引用改为复制本地为True后就自动引用这个文件夹的路......
  • https部署与docker下nginx的转发+文件获取
    进入nginx容器查看是否有etc/nginx/cert目录将https的域名证书放到cert目录下配置80和443server{#listen80;#侦听80端口listen80;#侦听443端口,用于SSLserver_name127.zyfdtsite.com;client_max_body_size1024m;#charsetkoi8-r;#acc......
  • BSN-DDC基础网络详解(十二):算力中心开发者门户部署说明(1)
    面向对象:本文档主要面向运维人员、客户方实施人员部署内容:适用于部署BSN算力中心环境,V2.2.1版本前置条件:部署前需准备所需的软硬件环境,并验证是否符合部署要求01版本信息版本号:1.1创建日期2023-2-14审核人周晓明02变更日志03名词解释04环境要求1.硬件环境说明应用环境部署所需......
  • IIS/如何查看IIS上部署网站的实时连接数
    我们在IIS发布的Web网站,如何查看网站实时的连接数呢?1、首先打开运行框,输入perfmon.msc  2、打开监视工具-->性能监视器  3、点击“+”号,添加计数项WebService/CurrentConnections  4、可以查看到网站的实时连接数(线条颜色、粗细可以修改)  PS:本人IIS网站......