深夜发帖。。。

qwer_boo qwer_boo 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
发现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,直接提示

不知道是什么原因?好纠结。。。
...全文
评论 8
收藏 已收藏
分享
返回顶部
qwer_boo
Java EE 67,535 成员 225,843 内容