我做了一个非常简单的应用程序,但遇到了错误。
我的 Web.XML
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Servlet-context.XML
<beans:bean name="newpage.jsp" class="com.project.NewHello.resultsController"/>
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="com.project.NewHello" />
newpageController.java
package com.project.NewHello;
import java.util.Locale;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
public class newpageController {
public String newpage(Locale locale, Model model) {
return "newpage";
}
}
**Some of Error lines:**
它没有找到 newpage.jsp 文件,并且在控制台显示中,警告:[SetContextPropertiesRule]{Context} 将属性 'source' 设置为 'org.eclipse.jst.jee.server:NewHello' 没有找到匹配的属性。
谢谢