发表于: 2017-07-17 22:18:57

2 1132


今天完成的事情:

主要是学习了如何让一个springmvc环境下的helloworld运行起来。原以为自己在中央仓库一个一个区搜索spring的jar包,就可以保证这个环境安全没有障碍了。结果还是一样。或者说又少了那些东西。在网上找实例的时候根本没有说看的特别明细的。有些配置文件的内容有多有少,这个就不知道为什么了。他们在基础的头部都不一样。这让我费了很多的时间在找寻这个原因,然而自己还是没懂。一开始想直接试着敲一敲springmvc crud的实例。结果这个配置文件感觉样式太多先放弃,然后回来发现helloworld实例都敲不上去。


8-Jul-2017 08:48:01.014 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors

[2017-07-18 08:48:01,030] Artifact HelloSpringMVC:war: Error during artifact deployment. See server log for details.

18-Jul-2017 08:48:09.035 信息 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\Java\tomcat9\webapps\manager]

18-Jul-2017 08:48:09.076 信息 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\Java\tomcat9\webapps\manager] has finished in [40] ms




@Transactional
public class  Controller {
@RenderMapping("/hello")
public String hello() {
System.out.append( "成功....." );
return "successResult";
}
}


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>My JSP 'successResult.jsp' starting page</title>
</head>
<body>
<h1>Hello SpringMVC 测试成功</h1>
</body>
</html>


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>My JSP 'successResult.jsp' starting page</title>
</head>
<body>
<h1>Hello SpringMVC 测试成功</h1>
</body>
</html>


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/mvc
       http://www.springframework.org/schema/mvc/spring-mvc.xsd  (中间是灰色的)
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd">

<!--配置自动扫描的包  -->
   <context:component-scan base-package="com.jnshu.controller"></context:component-scan>
<!--配置视图解析器:如何把handler方法,返回值解析为实际的物理视图  -->
   <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
</beans>

貌似没那么好run的起来的。因为在网上看博客还看不懂他们sevlect.xml的配置信息,因为我初始的sevlect只有很少信息,完全不知道哪些信息去哪里加载。一脸懵逼。

明天的计划:搞定最基础的hello,学习配置文件的中的头部和中间功能在哪里找

遇到的问题:不知道哪些

因为很多博客这一个东西都不一致。看了会视频。有的人是从jar包源码里面拿出来的。但是用idea不知道这个功能在哪里。而且我用的是maven。jar包压根没可以打包查看或者复制什么得内容。



明天的计划:搞清楚怎么配置文件的信息和头部为什么不一致


遇到的问题:sevlect.xml配置不一,不清楚哪一个才是正确的。




收获:收获只知道controller是作为一个中间收发器 去调用各个部件,然后解析最后从中间件中的内容。渲染过后反馈结果给用户。但是卡在环境的问题上。


返回列表 返回列表
评论

    分享到