I'm working in a small project and part of it is when a user registers,
there details are checked for errors (eg null value). If there is an error
it should appear on screen if there is not it should forward to
a confirmation page from the register page. A simple example of the code
on both pages appears below. At the moment it is not working. I would appreciate
any help
JSP #1: exampleregister.jsp
form name="form1" method="post" action="/exampleregister.jsp">
<p>USERNAME:
<input type="text" name="username">
<p>AGE:
<input type="text" name="age">
<p>
<input type="submit" name="submit" value="submit">
</form>
<p>
<%if (request.getParameter("submit") == null) { %>
<% if (request.getParameter("username") == null) {%>
<br>must show user name
<% if (request.getParameter("age") == null) {%>
<br> must show age
<%}else{%>
<jsp:forward page="/exampleconfirm.jsp" />
<% } %>
<% } %>
<% } %>
<p>
JSP #2: exampleconfirm.jsp
<body bgcolor="#FFFFFF" text="#000000">
Details entered =
<form name="form1" method="post" action="">
<p>Username:
<input type="text" name="username" value="<%=request.getParameter("username")%>">
</p>
<p>Age:
<input type="text" name="age" value="<%=request.getParameter("age")%>">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
Anybody any ideas where I'm going wrong??
-
relativley simple jsp problem (1 messages)
- Posted by: mick fgyggggya
- Posted on: June 28 2001 13:10 EDT
Threaded Messages (1)
- relativley simple jsp problem by Aditya Anand on June 28 2001 15:50 EDT
-
relativley simple jsp problem[ Go to top ]
- Posted by: Aditya Anand
- Posted on: June 28 2001 15:50 EDT
- in response to mick fgyggggya
This is what is wrong....
<%if (request.getParameter("submit") == null) {
when the form is submitted... the param submit is not null... so the if construct is skipped