2014年5月22日星期四

Hateful No mapping found for HTTP request with URI, resolved a night, not resolved, crazy

<!-- 启动SpringMVC的注解功能,它会自动注册HandlerMapping、HandlerAdapter、ExceptionResolver的相关实例 -->
<mvc:annotation-driven />
<mvc:default-servlet-handler />
<!-- 启动Spring的组件自动扫描机制 -->
<context:component-scan base-package="com.usoft.synusn.controller"></context:component-scan>


<!--通用视图解析器 -->
<bean id="viewResolverCommon"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="order" value="1" />
</bean>
<!-- SpringMVC的前端控制器 -->
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<!-- <param-value>classpath*:applicationcontext-webmvc.xml,classpath*:applicationcontext-freemarker.xml</param-value> -->
<param-value>classpath*:applicationcontext-web.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<!-- 由SpringMVC拦截所有请求 -->
<url-pattern>/</url-pattern>
</servlet-mapping>
/**
 * freemarker控制器
 * @author
 * 
 */
@Controller
public class FreeMarkerControler {
    
    @RequestMapping("/hello")
    public String sayHello(ModelMap map) {
        System.out.println("say Hello ……");
        map.addAttribute("message", "Hello World,FreeMarker!");
        return "test";
    }
}


This is my profile and controller, I did not find anything wrong , you can always No mapping found for HTTP request with URI
------ Solution --------------------------------------------
to < ; url-pattern> / * try it.
------ Solution ---------------------------------------- ----
you visit the url is what
------ Solution --------------------------- -----------------
here finally /


@ RequestMapping ("/ hello") / / Here it should be hello, should not be / it.
------ Solution ---------------------------------------- ----
multi-view to configure multiple DispatcherServlet job.
------ Solution ---------------------------------------- ----
certainly not normal. No deployed
------ Solution ------------------------------------- -------
http://www.cnblogs.com/penguin-panda/archive/2011/07/09/2101880.html
------ For reference only --- ------------------------------------
I would like to ask for , / * and / What is the difference
------ For reference only --------- ------------------------------
I changed , even the home have not visited

------ For reference only ---------------------------------- -----
http://localhost:8080/spring_mybatis/hello

------ For reference only ---------------------------------- -----
HTTP Status 404 -

type Status report

message

description The requested resource is not available.

Apache Tomcat/7.0.32
This is my error page
------ For reference only ---------------------------- -----------
in fact, my original view resolver is configured and jsp freemarker parser , with two , freemarker the order is 0, jsp 's order is an achieve different view resolution , there is always a mistake I said , no way, I changed a single jsp view resolution , or that mistake , I did not approach the
------ For reference only ------ ---------------------------------
not right , there should be a DispatcherServlet. Multi-View is nothing to configure multiple view resolvers it . There is also a case of , ah, after I posted my project , WEB-INF/class folder is empty, normally do , this situation ?
------ For reference only -------------------------------------- -
not be the reason for it
I'm a normal deployment , ah, in myeclipse , then how do
------ For reference only -------------------- -------------------
forgot to say , I was using maven to build the project, and then released into the normal project in myeclipse tomcat in
------ For reference only ---------------------------------------

------ For reference only ---- -----------------------------------
brother, I also have this problem , the solution of the it? Seeking help ! QQ 393922808
------ For reference only ----------------------------------- ----
I am also the same problem ah , tangled waited a long time the
------ For reference only ------------------ ---------------------
configuration view when last there is a slash , slash the
not write in RequestMapping annotation ---- - For reference only ---------------------------------------
I tangled half months, in the same way construction projects at home is good, the company is bad. Swollen do it, read countless articles have tried does not work. . .
------ For reference only -------------------------------------- -
buddy you say plausible , but in fact no difference . . .
------ For reference only -------------------------------------- -
with asking the same question , the company is not good at home , at home using myeclipse 6.5 of maven plugin companies using eclipse maven plugin pom is the same but No home visit is less than a controller, tangled 3,4 days on solutions
------ For reference only -------------------- -------------------
\


/ in three configurations
① exact match
/ test / list.do

② path matching
/ * struts2 match all requests under the root path

③ extension matches
*. do struts1
*. html match all html at the end of the request
* * can not be used , otherwise an error
------ For reference only -------- -------------------------------
Make sure there is test.jsp file directory under views .
------ For reference only -------------------------------------- -
in springmvc configuration file to add can be resolved.
------ For reference only -------------------------------------- -
brother, you are facing the example of others to do is put ? In the first plain text code there :

<-! start automatic scanning mechanism components of Spring - >
com.usoft.synusn.controller ">

com.usoft.synusn.controller this package we wanted to change the package name your own controller , otherwise sweep less than class , I just also this error , then changed their package name just fine.

I am also white .
------ For reference only -------------------------------------- -
I have encountered such a problem , then I added
like, seeking to tell why the

没有评论:

发表评论