Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6850975

Browse files
Spring Creación de Aplicaciones Web MVC
Introducción a la creación de aplicaciones web usando el Framework Spring MVC
1 parent 1ba4718 commit 6850975

File tree

8 files changed

+137
-0
lines changed

8 files changed

+137
-0
lines changed

‎tutorial_web_mvc/nb-configuration.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project-shared-configuration>
3+
<!--
4+
This file contains additional configuration written by modules in the NetBeans IDE.
5+
The configuration is intended to be shared among all the users of project and
6+
therefore it is assumed to be part of version control checkout.
7+
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
8+
-->
9+
<spring-data xmlns="http://www.netbeans.org/ns/spring-data/1">
10+
<config-files>
11+
<config-file>src/main/webapp/WEB-INF/springmvc-servlet.xml</config-file>
12+
</config-files>
13+
<config-file-groups/>
14+
</spring-data>
15+
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
16+
<!--
17+
Properties that influence various parts of the IDE, especially code formatting and the like.
18+
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
19+
That way multiple projects can share the same settings (useful for formatting rules for example).
20+
Any value defined here will override the pom.xml file value but is only applicable to the current project.
21+
-->
22+
<org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled>
23+
</properties>
24+
</project-shared-configuration>

‎tutorial_web_mvc/pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>carmelo.spring</groupId>
5+
<artifactId>tutorial_web_mvc</artifactId>
6+
<packaging>war</packaging>
7+
<version>1.0</version>
8+
<name>tutorial_web_mvc</name>
9+
10+
<properties>
11+
<spring.version>4.3.7.RELEASE</spring.version>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
<maven.compiler.source>1.8</maven.compiler.source>
14+
<maven.compiler.target>1.8</maven.compiler.target>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.springframework</groupId>
20+
<artifactId>spring-webmvc</artifactId>
21+
<version>${spring.version}</version>
22+
</dependency>
23+
</dependencies>
24+
25+
<build>
26+
<finalName>tutorial_web_mvc</finalName>
27+
<plugins>
28+
<plugin>
29+
<groupId>org.apache.maven.plugins</groupId>
30+
<artifactId>maven-war-plugin</artifactId>
31+
<version>2.3</version>
32+
<configuration>
33+
<failOnMissingWebXml>false</failOnMissingWebXml>
34+
</configuration>
35+
</plugin>
36+
</plugins>
37+
</build>
38+
39+
</project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package carmelo.spring.webmvc;
2+
3+
import org.springframework.stereotype.Controller;
4+
import org.springframework.web.bind.annotation.RequestMapping;
5+
import org.springframework.web.servlet.ModelAndView;
6+
7+
@Controller
8+
public class HelloController {
9+
10+
@RequestMapping(value = "/hello")
11+
public ModelAndView saluda() {
12+
ModelAndView mv = new ModelAndView();
13+
mv.addObject("titulo", "Tutoriales Spring MVC");
14+
mv.addObject("mensaje", "Mi Primera Aplicacion Web Spring MVC");
15+
mv.setViewName("hello");
16+
17+
return mv;
18+
}
19+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Context antiJARLocking="true" path="/tutorial_web_mvc"/>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<beans xmlns="http://www.springframework.org/schema/beans"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:context="http://www.springframework.org/schema/context"
6+
xsi:schemaLocation="http://www.springframework.org/schema/beans
7+
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
8+
http://www.springframework.org/schema/context
9+
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
10+
11+
<context:component-scan base-package="carmelo.spring.webmvc" />
12+
<context:annotation-config />
13+
14+
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
15+
<property name="prefix" value="/WEB-INF/views/" />
16+
<property name="suffix" value=".jsp" />
17+
</bean>
18+
19+
</beans>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<%@page contentType="text/html" pageEncoding="UTF-8"%>
2+
<!DOCTYPE html>
3+
<html>
4+
<head>
5+
<title>Spring Web MVC</title>
6+
</head>
7+
<body>
8+
<h1>${titulo}</h1>
9+
<p>${mensaje}</p>
10+
</body>
11+
</html>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
4+
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
5+
<servlet>
6+
<servlet-name>springmvc</servlet-name>
7+
<servlet-class>
8+
org.springframework.web.servlet.DispatcherServlet
9+
</servlet-class>
10+
<load-on-startup>1</load-on-startup>
11+
</servlet>
12+
13+
<servlet-mapping>
14+
<servlet-name>springmvc</servlet-name>
15+
<url-pattern>/</url-pattern>
16+
</servlet-mapping>
17+
18+
</web-app>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<html>
2+
<body>
3+
<h2>Hello World!</h2>
4+
</body>
5+
</html>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /