Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Spring
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Liutauras Vilda
Paul Clapham
Sheriffs:
paul wheaton
Tim Cooke
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Piet Souris
Bartenders:
Mike London
Forum:
Spring
@Requestmapping
mike molin
Greenhorn
Posts: 17
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How does requestmapping works ?
i am just trying to print something in the console but nothing happens?
any ideas?
class
package se.springapp; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller public class HomeController { @RequestMapping(value = "/", method = RequestMethod.GET) public void myMethod() { System.out.println("jjjj"); } }
webb xml:
<servlet> <servlet-name>springapp</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springapp</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
spring xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" 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-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <context:component-scan base-package="se.springapp" /> <mvc:annotation-driven /> </beans>
Mark Spritzler
ranger
Posts: 17347
11
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I always get confused if you need a "/" in front, but you definitely need "*" in your mappings for the DispatcherServlet.
Mark
Perfect World Programming, LLC
-
iOS Apps
How to Ask Questions the Smart Way FAQ
mike molin
Greenhorn
Posts: 17
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
It's working now , seems to be some kind of bug , i just had to move the
jsp
from web-content to WEB-INF :-)
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
spring security 3.1 login not working.
Problem running app under Tomcat v7
org.springframework.web.servlet.DispatcherServlet noHandlerFound
Spring MVC question
How to register ContextLoaderListener ?
More...