深夜发帖

J2EE 码拜 8年前 (2016-03-21) 1027次浏览
发现spring+springmvc+mybatis+Intellij简直要任命。
各种奇葩的错误和警告。
接下来看下本人的代码:
controller.java

@Controller
public class UserInfoController {
//    @Autowired
//    private IUserService iUserService;
    @RequestMapping(value = "userInfo", method = RequestMethod.GET)
    public String UserInfo(@RequestParam("UserName") String userName,
                                 @RequestParam("PassWord") String passWord,
                                 ModelMap model)
    {
        model.addAttribute("UserName", userName);
        model.addAttribute("PassWord", passWord);
        return "UserInfo";
    }
}

然后index.jsp直接在welcome-list中写着,启动tomcat后直接显示index.jsp,然后index.jsp的内容如下:

<html>
  <head>
    <title>login</title>
  </head>
  <body>
<form action="/userInfo">
  UserName: <input type="text" name="UserName">
  PassWord: <input type="password" name="PassWord">
  <input type="submit" value="Submit">
</form>
  </body>
</html>

本人想直接在index.jsp中填完信息跳转到userInfo.jsp页面,显示输入的用户名和密码,然后userInfo.jsp的内容如下:

<html>
<head>
    <title>UserInfo</title>
</head>
<body>
UserName:${UserName}<br/>
PassWord:${PassWord}<br/>
</body>
</html>

本人的工程目录:
深夜发帖
spring-mvc.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.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
    <mvc:annotation-driven/>
    <!-- spirngmvc的配置文件-->
    <!--自动扫描控制器-->
    <context:component-scan base-package="com.kyee.baby.controller"/>
    <!--视图渲染-->
    <bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
</beans>

现在的情况是,当本人输入用户名和密码后点击submit,直接提示
深夜发帖
不知道是什么原因?好纠结。

解决方案

10

控制台的信息贴出来啊

30

环境的问题 和工具没关系

20

引用:
Quote: 引用:

控制台的信息贴出来啊

深夜发帖
这个是tomcat localhost log里的错误信息。

缺包  spring-webmvc-2.5.6.jar


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明深夜发帖
喜欢 (0)
[1034331897@qq.com]
分享 (0)