request.getparameter在我的spring mvc中不工作我在下面使用html5是代码。
我试过在html中的text属性中添加名称,但它没有用。
package com.springmvc.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
public class HelloWorldController implements Controller {
@Override
public ModelAndView handleRequest(HttpServletRequest req,
HttpServletResponse res) throws Exception {
System.out.println("***************");
String userName = req.getParameter("userName");
String user = req.getParameter("user");
String nameCheck = req.getParameter("Username");
ModelAndView mv = new ModelAndView("Sucess");
return mv;
}
}
<input type="text" placeholder="Username" />
<input type="password" placeholder="Password"/>
<input type="email" placeholder="Email Address"/>
<input type="tel" placeholder="Phone Number"/>
<button>Register</button>