深夜发帖。。。
发现spring+springmvc+mybatis+Intellij简直要任命。。。
各种奇葩的错误和警告。
接下来看下我的代码:
controller.java
然后index.jsp直接在welcome-list中写着,启动tomcat后直接显示index.jsp,然后index.jsp的内容如下:
我想直接在index.jsp中填完信息跳转到userInfo.jsp页面,显示输入的用户名和密码,然后userInfo.jsp的内容如下:
我的工程目录:

spring-mvc.xml的配置如下:
现在的情况是,当我输入用户名和密码后点击submit,直接提示

不知道是什么原因?好纠结。。。
各种奇葩的错误和警告。
接下来看下我的代码:
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,直接提示

不知道是什么原因?好纠结。。。
...全文


