<jsp:useBean id="upd" class="UserDBProp" scope="session"/>
<jsp:setProperty name="upd" property="dir" value="c:/tmp"/>
<% 
 String errormessage="";
 boolean err=false;
 if (request.getParameter("uid")!=null)  {
    if (!request.getParameter("pw").equals(request.getParameter("pw2"))) {
      errormessage="Passwords did not match";
      err=true;
    }
    if (request.getParameter("pw")==null ||
        request.getParameter("pw").equals("")) {
           errormessage="Password must not be blank";
           err=true;
     }
    if (!err) {
      upd.setUser(request.getParameter("uid"));
      if (upd.create(request.getParameter("pw"))) {
           upd.writeProperty("name",request.getParameter("uname"));
           upd.save();
           response.sendRedirect("updlogin.jsp");
           }    
       errormessage="User ID in use.";
       err=true;
       }
   }


%>
<HTML>
<HEAD><TITLE>Creating new ID</TITLE>
</HEAD>
<BODY BGCOLOR="cornsilk">

<TABLE>
<% if (err) { %>
<BR>
  <FONT COLOR=RED SIZE=3><%= errormessage %></FONT>
<BR>
<% } %>
<FORM METHOD=POST ACTION=updcreate.jsp>
<TR><TD>
Name: </TD><TD><INPUT Name=uname></TD></TR>
<TR><TD>
UserID: </TD><TD><INPUT NAME=uid></TD></TR>
<TR><TD>
Password:</TD><TD> <INPUT NAME=pw TYPE=PASSWORD></TD></TR>
<TR><TD>
Verify password:</TD><TD><INPUT NAME=pw2 TYPE=PASSWORD></TD></TR>
<TR><TD>&nbsp;</TD><TD>
<INPUT TYPE=SUBMIT VALUE="Create"></TD></TR>
</FORM>
</TABLE>

</BODY>
</HTML>
