Skip to content

Commit b02f072

Browse files
authored
Add files via upload
1 parent 32556d5 commit b02f072

37 files changed

+179
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Manifest-Version: 1.0
2+
Class-Path:
3+
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2+
pageEncoding="ISO-8859-1"%>
3+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4+
<html>
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
7+
<title>Insert title here</title>
8+
</head>
9+
<body>
10+
${welcomeMsg }
11+
</body>
12+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.hello.config;
2+
3+
import javax.servlet.ServletContext;
4+
import javax.servlet.ServletException;
5+
import javax.servlet.ServletRegistration.Dynamic;
6+
7+
import org.springframework.web.WebApplicationInitializer;
8+
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
9+
import org.springframework.web.servlet.DispatcherServlet;
10+
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
11+
12+
13+
public class ServletInitializer extends AbstractAnnotationConfigDispatcherServletInitializer{
14+
15+
@Override
16+
protected Class<?>[] getRootConfigClasses() {
17+
// TODO Auto-generated method stub
18+
return null;
19+
}
20+
21+
@Override
22+
protected Class<?>[] getServletConfigClasses() {
23+
// TODO Auto-generated method stub
24+
return new Class[]{WebConfig.class};
25+
}
26+
27+
@Override
28+
protected String[] getServletMappings() {
29+
// TODO Auto-generated method stub
30+
return new String[]{"/"};
31+
}
32+
33+
34+
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.hello.config;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.ComponentScan;
5+
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
6+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
7+
import org.springframework.web.servlet.view.InternalResourceViewResolver;
8+
import org.springframework.web.servlet.view.JstlView;
9+
10+
11+
@EnableWebMvc
12+
@ComponentScan(basePackages={"com.hello.controller"})
13+
public class WebConfig {
14+
15+
@Bean
16+
public InternalResourceViewResolver viewResolver() {
17+
18+
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
19+
resolver.setViewClass(JstlView.class);
20+
resolver.setPrefix("/WEB-INF/views/");
21+
resolver.setSuffix(".jsp");
22+
23+
24+
return resolver;
25+
}
26+
27+
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.hello.controller;
2+
3+
import org.omg.CORBA.Request;
4+
import org.springframework.beans.factory.annotation.Autowired;
5+
import org.springframework.stereotype.Controller;
6+
import org.springframework.web.bind.annotation.RequestMapping;
7+
import org.springframework.web.bind.annotation.RequestMethod;
8+
import org.springframework.web.bind.annotation.RequestParam;
9+
import org.springframework.web.servlet.ModelAndView;
10+
11+
import com.hello.service.MessageService;
12+
13+
14+
15+
@Controller
16+
@RequestMapping(value="/")
17+
public class HelloController {
18+
19+
20+
MessageService messageService;
21+
22+
@RequestMapping( method=RequestMethod.GET)
23+
public ModelAndView welcome() {
24+
25+
return new ModelAndView("welcomePage", "welcomeMsg", messageService.welcomeMessage());
26+
27+
28+
}
29+
30+
31+
@RequestMapping(value="/welcomeAgain", method=RequestMethod.GET)
32+
public ModelAndView welcomeAgain() {
33+
34+
return new ModelAndView("welcomePage", "welcomeMsg", messageService.welcomeAgainMessage());
35+
36+
37+
}
38+
39+
40+
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.hello.service;
2+
3+
import org.springframework.stereotype.Service;
4+
5+
6+
public class MessageService {
7+
8+
public static String welcomeMessage() {
9+
return "WElcome to the spring world...Testing";
10+
}
11+
12+
public Object welcomeAgainMessage() {
13+
// TODO Auto-generated method stub
14+
return "Hello Welcome to the spring world Againnnn...Testing";
15+
}
16+
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Manifest-Version: 1.0
2+
Class-Path:
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://www.springframework.org/schema/beans"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:util="http://www.springframework.org/schema/util"
5+
xsi:schemaLocation="
6+
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
7+
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
8+
9+
10+
11+
</beans>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
3+
<display-name>SpringMVC_commandController</display-name>
4+
<welcome-file-list>
5+
<welcome-file>index.html</welcome-file>
6+
<welcome-file>index.htm</welcome-file>
7+
<welcome-file>index.jsp</welcome-file>
8+
<welcome-file>default.html</welcome-file>
9+
<welcome-file>default.htm</welcome-file>
10+
<welcome-file>default.jsp</welcome-file>
11+
</welcome-file-list>
12+
</web-app>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<%@taglib uri="http://www.springframework.org/tags/form" prefix="html"%>
2+
3+
<html:form>
4+
5+
<pre>
6+
Name: <html:input path="name"/>
7+
Email: <html:input path="email"/>
8+
9+
<input type="submit" value="submit">
10+
</pre>
11+
12+
</html:form>
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package controller;
2+
3+
public class RegController extends {
4+
5+
}

0 commit comments

Comments
 (0)