Try this
  In the action attribute of a form set the value to the same page . Using
request.getParameter check the selected value in the list box so that's its not
null , because the first time it will always be null. If its not null set the
selected value in the desired variable. After that you can forward to any page
you want , instead of putting that page in the action attribute.

Sample code , not sure whether this is what you are looking for.

Page : Benefits.jsp

<html>
<h1>Benefits Info</h1>
<form name="login" action="Benefits.jsp" >
<pre>
First Name     <input type=text name="fname" size=40>
Middle Initial <input type=text name="mname" size=40>
Last Name <input type=text name="lname" size=40>
Address   <input type=text name="address" size=40>
City      <input type=text name="city" size=40>
State          <select name="state">
<option value=Al>Alabama
<option value=NC>NorthCarolina
<option value=DC>Columbia
<option value=CA>California
</select>
DP Code/CONO   <input type=text name="ist" size=40>
DP UserId/SSN  <input type=text name="ssn" size=40 onBlur="checkssn(ssn.value);"
 >
<input type=submit name="submit" value ="SelfSeviceNow" >
</pre>

<script>
function checkssn(ssnval)
{
var regexp = /^(\d{9}|\d{3}-\d{2}-\d{4})$/;
if (ssnval !=null)
{
if (!regexp.test(ssnval))
{
window.alert("Invalid SSN ");
document.login.submit.disabled="true";
}
}
}
<%
if ( request.getParameter("submit")!=null)
{
String btnvalue = request.getParameter("submit");
if ( btnvalue.equals("SelfSeviceNow"))
{
 %>
  <jsp:forward page="SelfServiceNow.jsp"/>
 <%
 }
 }
%>


Santosh

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to