Can I set the value of an existing request attribute again?

cor3y

New Member
I have a homepage in which I have a header, a sidebar, and a div tag. When the user clicks on "register", \[code\]Registration.jsp\[/code\] is loaded into the div tag.On successful submission of the registration form I want to forward it to the same page where I want to display a html "bookimages.html" in the div tag.I tried setting an attribute value to do this.This is my mainpage.css:\[code\]<body id="userprofilepage"><% request.setAttribute("regisstatus",null); %><div><%@ include file="header.jsp" %><br></div><div id="mainsidebar"><%@ include file="sidebar.html" %></div><div><%@ include file="priviledges.html" %></div><div id="contentarea"><% if(request.getAttribute("regisstatus")==null){ %><%@ include file="bookimages.html" %><% } else if((request.getAttribute("regisstatus").toString()).equals("success")) { %> <%@ include file="Register.jsp" %> <% } else { %><h3>Sorry could not register.. Try again</h3><% } %></div></body>\[/code\]jqueryIn my header I have a register button:\[code\] $(function(){ $("#register").click(function(){ $("#contentarea").load("RegistrationServlet.jsp"); });});\[/code\]...which is working fine. and calls RegistrationServlet.java:\[code\] protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub //Takin all parameters String fname = request.getParameter("fname"); //System.out.println(fname); String lname = request.getParameter("lname"); //System.out.println(lname); String mobileno = request.getParameter("mobno"); //System.out.println(mobileno); String pwd = request.getParameter("password"); //System.out.println(uid); // String cpwd = request.getParameter("password"); //System.out.println(pwd); String email = request.getParameter("email"); String off_add= request.getParameter("off_add"); String perm_add = request.getParameter("perm_add"); String[] r = request.getParameterValues("role"); for(int i=0;i<r.length;i++) { System.out.println(r); } ArrayList<Integer> role=new ArrayList<Integer>(); for(int i=0;i<r.length;i++) { Integer r1=new Integer(RoleManager.getRoleid(r)); role.add(r1); } /*for(int i=0;i<r.length;i++) { Integer r1=new Integer(RoleManager.getRoleid(r)); role.add(r1); }*/ String g[]=request.getParameterValues("genre"); ArrayList<Integer> genre=new ArrayList<Integer>(); for(String i : g) { Integer g1=new Integer(GenreManager.getGenreid(i)); genre.add(g1); } // creating user object RegisteredUser uobj = new RegisteredUser(); //setting values in RegisteredUser obect uobj.setFname(fname); uobj.setLname(lname); uobj.setPassword(pwd); uobj.setMobileno(mobileno); uobj.setPassword(pwd); uobj.setEmail(email); uobj.setOffadd(off_add); uobj.setPermadd(perm_add); uobj.setRole(role); uobj.setGenre(genre); uobj.setUid("abc2"); //send user object to manger boolean suc=UserManager.createUser(uobj); System.out.println("user object created"); if(suc) request.setAttribute("regisstatus", "success"); else request.setAttribute("regisstatus", "fail"); RequestDispatcher rd=request.getRequestDispatcher("/userprofilepage.jsp"); rd.forward(request, response); }}\[/code\]But in my homepage, the request attribute is not being set. Can you help me identify the problem?
 
Back
Top