Home > Back-end >  For SpringMVC introduction to jump
For SpringMVC introduction to jump

Time:10-07

this is my project directory


this is web. The XML content:

"-//Sun Microsystems, Inc.,//DTD Web Application/2.3/EN"
"Http://java.sun.com/dtd/web-app_2_3.dtd" & gt;


Archetype Created Web Application

Springmvc

Org. Springframework. Web. Servlet. DispatcherServlet
ContextConfigLocation
The classpath: for springmvc. Xml
1


Springmvc
/& lt;/url - pattern>





this is for springmvc. XML content:

<? The XML version="1.0" encoding="utf-8"?>
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 "& gt;
Id="internalResourceViewResolver" & gt;




this is HelloController content:

Package it. The demo. The controller;

The import org. Springframework. Stereotype. The Controller;
The import org. Springframework. UI. Model;
The import org. Springframework. Web. Bind. The annotation. RequestMapping;

@ Controller
Public class HelloController {

@ RequestMapping ("/hello! ")
Public String sayHello () {
System. The out. Println (" come on ");
Return "success";
}
}

this is a success. The JSP content:

<% @ page contentType="text/HTML. Charset=utf-8 "language=" Java "% & gt;


Title

<body>




This is the index. The JSP content:
<% @ page contentType="text/HTML. Charset=utf-8 "language=" Java "% & gt;


Title

<body>





this is the server configuration:



finally running index. When the JSP: appear below



only left click manually click the console for springmvc: war to run out of the results:


q: why only manually click soringmvc: war to run a success?


CodePudding user response:


This position into/can not add the project name,
Configuration, such as you need to add your own path configuration in the link

  • Related