我试图在注册完成后立即使用 JSP 或 JavaScript 将用户重定向到我的登录页面。
我应该提到注册表正在调用同一页面,当我说时window.location
,glassfish 会抛出错误,因为找不到资源。
{
if(request.getParameter("submit")!=null)
{
String uname=request.getParameter("txtusername");
String password=request.getParameter("txtpassword");
String mail=request.getParameter("txtemail");
String dob=request.getParameter("dob");
String city=request.getParameter("txtcity");
String state=request.getParameter("txtstate");
String country=request.getParameter("txtcountry");
String address=request.getParameter("txtstreetaddress");
String scity=request.getParameter("txtscity");
String sstate=request.getParameter("txtsstate");
String scountry=request.getParameter("txtscountry");
String saddress=request.getParameter("txtsaddress");
String mobile=request.getParameter("txtno");
String gender=request.getParameter("rdbgender");
adminClasses.user u= new adminClasses.user(0, uname, password, mail, dob, city, state, country, address, scity, sstate, scountry, saddress, mobile, gender);
int result=adminClasses.userfunctions.addNewUser(u);
%>
<script>
var res=<%=result%>;
if(res==0)
{
window.alert("Registration Unsuccessful");
}
else
{
window.alert("Resgistration Successful!Click Ok to Sign in");
window.location="signin.jsp";
}
</script>
<%
}
}
catch (Exception e)
{
out.println(e.getMessage());
}