我正在尝试填写申请表并打开一个新页面,为什么我不断收到404错误?我正在使用Rest jersey,并将我的jsp页面放在正确的层次结构中。
@POST
@Path("/register")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.TEXT_HTML)
public Response register(@Context ServletContext context,@Context UriInfo uriInfo,@FormParam("userName") String userName, @FormParam("password") String password)throws URISyntaxException {
URI uri = UriBuilder.fromUri("http://localhost:8080/jersey-webapp/profilePage.jsp").build();
return Response.temporaryRedirect(uri).build();
/*User u1 = service.registerUser(userName, password);
if(u1 == null) {
URI uri = UriBuilder.fromUri("http://localhost:8080/jersey-webapp/register.jsp").build();
return Response.temporaryRedirect(uri).build();
}
JSP页面:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Register</title>
</head>
<body>
<div class ="form-group form2">
<form action="register" method="post">
<div>
<label>
User name:
</label>
<input type="text" id="userName" name="userName" placeholder="userName" class="form-control2"/>
<br>
<label>
Password:
</label>
<input type="text" id="password" name="password" placeholder="password" class="form-control2"/>
<br>
</div>
<button id="RegisterButton" class="form-control2">Register</button>
</form>
</body>
</html>