文件名是repository可能会是本地仓库的路径名中含有了repository关键字的原因。所以我也把文件名改了,改成了repositories。
但是我看默认的地址其实文件名也是repository,所以我一开始只改settings里面设置的配置本地仓库的名字后运行还是有错误,只有手动在idea里面改文件路径才运行正常。
启动后,再次运行时 报 adress in use. 解决办法,将 IDEA 里的 terminal 关掉,重新打开新 terminal 终端,再次运行即可不报 address in use 错误。但 HTTP ERROR: 503 的问题依然还在
根据你的url你在直接访问jsp 如果jsp在web-inf内不能被直接访问 需要通过controller的requestmapping
建议你参看老师视频去了解下老师用的是怎样的url
这是资源文件
就是你demo实体类的包路径,这个路径你自己可以定义
把$后面的括号()改成大括号{}
请问一下,这个问题是怎么解决的?
可以检查2个方面:
1、url,如楼上所说,需要加上工程名称。如http://localhost:8080/spring-mvc-study/hello/mvc。
2、WEB-INF里lib文件夹下有没有jstl.jar。
我的是没有lib文件夹及jstl.jar,添加进去,并Bulid Path就可以正常访问了。
mvc.xml 中的context:component-scan包名与你 HelloMvcController.class所在包名一致吗?
<context:component-scan base-package="com.imooc.mvcdemo.controller" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
勾选上Create a simple project (不使用maven的项目骨架)
pom文件中添加?
就你找这串依赖的地方,上面有小标签,有一个plugin的选项
亲,这边觉得不需要呢
路径写错了
你的冒号是中文的输入法吧
用eclipse jee那个软件,你那个好像没有,如果自己建可能要手动依赖
主页上可以下载整个项目,然后在里面找就可以了
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>imooc-arthur</groupId>
<artifactId>spring-mvc-study</artifactId>
<version>1.0-SNAPSHOT</version>
<name>spring-mvc-study Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<commons-lang.version>2.6</commons-lang.version>
<slf4j.version>1.7.6</slf4j.version>
<spring.version>4.3.5.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
<build>
<finalName>spring-mvc-study</finalName>
</build>
</project>
<?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:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
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.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<!-- 激活标注 -->
<context:annotation-config />
<!-- 对module包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能-->
<context:component-scan base-package="com.imooc.mvcdemo.controller">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"></context:include-filter>
</context:component-scan>
<mvc:annotation-driven></mvc:annotation-driven>
<!-- 启用基于annotation的handlerMapping -->
<!-- 定义视图解析器,在视图模型前后添加前缀后缀-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsps/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
包有问题,删除,重新导入
这个页面好像是需要自己配置的,视频里有一点讲解的
Alt + / 可自动生成 (输入 disp)
https://blog.csdn.net/baoyu_G/article/details/80397485
参考下这个看看如何
右键项目,在maven选项中update project一下试一下
console有报其他错吗
哪位大老帮帮忙
我根据你的做法也解决了,谢谢!
可以用tomcat试试,不用mvc jetty