previous values in servlet

Ads

 
 

Share on Google+Share on Google+

Valli
previous values in servlet
1 Answer(s)      7 years ago
Posted in : JSP-Servlet
Hi...

I've an application where there are two links link1 and link2
when i clicked link1 there's a form with relevant drop down lists and text boxes...
and similarly to link2...there's another form..
when i filled the form of link1 and submitted it...
and when i again go to the link1 after link2 the same values are still in the form...
How to remove those...??

thanks in advance..
Ads
View Answers

June 2, 2010 at 12:43 PM


Hi Friend,

Try the following code:

1)home.jsp:

<a id="one" href="register.jsp">Link1 </a><br>
<a id="two" href="form.jsp">Link2</a><br>

2)register.jsp:

<html>
<script>
function call(){
var f=document.form;
f.method="post";
f.action="insertIntoExcel.jsp";
f.submit();
f.firstname.value="";
f.lastname.value="";
f.username.value="";
f.password.value="";
f.address.value="";
f.contact.value="";
f.email.value="";
f.city.value="";
f.state.value="";
f.country.value="";
}
</script>
<body>
<center><h3>Registration Form</h3></center>
<form name="form" >
<center>
<table>
<tr><td>First Name:</td><td><input type="text" name="firstname" size="20"></td></tr>
<tr><td>Last Name:</td><td><input type="text" name="lastname" size="20"></td></tr>
<tr><td>User Name:</td><td><input type="text" name="username" size="20"></td></tr>
<tr><td>Password:</td><td><input type="text" name="password" size="20"></td></tr>
<tr><td>Address:</td><td><input type="text" name="address" size="20"></td></tr>
<tr><td>Contact No:</td><td><input type="text" name="contact" size="20"></td></tr>
<tr><td>Email:</td><td><input type="text" name="email" size="20"></td></tr>
<tr><td>City:</td><td><input type="text" name="city" size="20"></td></tr>
<tr><td>State:</td><td><input type="text" name="state" size="20"></td></tr>
<tr><td>Country:</td><td> <input type="text" name="country" size="20"></td></tr>
<tr><td><input type="button" onclick="call();" value="Submit" name="B1"></td><td><input type="reset" value="Reset" name="B2"></td></tr>
</table>
</center>
</form>
</body>
</html>

3)form.jsp:

<script>
function call(){
var f=document.form;
f.method="post";
f.action="adds.jsp";
f.submit();
f.name.value="";
f.address.value="";
f.contactNo.value="";
}
</script>
<form name="form" >
<table border="1">
<tr><td>Name:</td><td><input type="text" name="name" ></td></tr>
<tr><td>Address:</td><td><input type="text" name="address" ></td></tr>
<tr><td>Contact No:</td><td><input type="text" name="contactNo" ></td></tr>
<tr><td></td><td><input type="button" onclick="call();" name="button" value="Add"></td></tr>
</table>
</form>

Hope that the above code will be helpful for you.
Thanks

Ads









Related Tutorials/Questions & Answers:
previous values in servlet - JSP-Servlet
previous values in servlet  Hi... I've an application where there are two links link1 and link2 when i clicked link1 there's a form with relevant... to the link1 after link2 the same values are still in the form... How to remove
NEXT and PREVIOUS Records - JSP-Servlet
NEXT and PREVIOUS Records  Dear Sir, In my Project i have next and previous buttons at bottom of my page which is working fine.But as per our requirement next,previous buttons should be placed at top of the page as well
Advertisements
retrive values - JSP-Servlet
retrive values  how to get multiple values from html to jsp
retrive values - JSP-Servlet
retrive values  how to retrive multiple values from html to jsp  Hi Friend, Try the following code: 1)calljsp.html: Enter Name: Enter Address: Gender:MF Qualification: Btech MBA MCA MSC
insert values - JSP-Servlet
insert values  How to insert values in the oracle database using JSP. Plz tell the core answer as soon as possible .  HiThis is html...;insert user_details values('"+username+"','"+jobposition+"
passing values - JSP-Servlet
_DataInsertion(Name,Hallno,Time,Date,Mobileno,Status) values('"+name+"','"+hallno+"','"+time
Loading updated values - JSP-Servlet
Loading updated values  In my jsp project profile updating is one of that part. While updating i have to show updated values in choice list for birthday date column. How can we show the previously updated values in choice list
How to pass multiple values from a servlet to JSP?
How to pass multiple values from a servlet to JSP?  hi, I want to pass multiple values form a servlet to JSP. Hw do i do that? I am able to send one...) values
How to get a values - JSP-Servlet
How to get a values  Dear sir, I have one input text field and one submit button .Within one file how to get a values within a same jsp. Thanks and Regards Harini Veerapur.  Hi Friend, Try the following
How to carry multiple values from a Servlet to a JSP?
How to carry multiple values from a Servlet to a JSP?  By using...). ----response.sendRedirect("index.jsp?uname="+username);---- But I want multiple values needs to be carried from my servlet to a JSP. How do I do
How to get a values - JSP-Servlet
getting a null value aprt from a attachmented file,so how to get a other values
getting values from database - JSP-Servlet
getting values from database  I tried the following code abc.html... JSP code separately.If it will not display database values then try your code in Servlet. Thanks
passing the form values with image upload - JSP-Servlet
passing the form values with image upload  Hii . I want to get the solution for passing values with an image uploading form. I cant access the request values from the fields rather than image . I want to know how can cut
how to store a dynamic values - JSP-Servlet
in that i have stored a values from a excel sheet specified column values and i... and bonus is ~5 . Thanks Hr in another arraylist i have a values ~2,~3,~4,~5 values.Now i want to insert these values into a string ,use that string
dynamic multiplecheckbox values insertion - JSP-Servlet
dynamic multiplecheckbox values insertion  hi How to insert dynamically generated checkbox values to store in mysql data base using jsp?  Hi Friend, Try the following code: 1)checkbox.jsp: Name
Get values from JSP pages - JSP-Servlet
Get values from JSP pages  I have welcome.jsp in which it has... or input fields.   Hi Friend, Do you want to pass the column values to another JSP page?Do you want to use database to add column values or you want
how to get a values from processRecord - JSP-Servlet
how to get a values from processRecord  dear sir, i have a problem in getting a values from java to jsp.Here jsp is used to read a excel sheet that intern call a java program so i want a column values i.e a column contains
count values using jsp - JSP-Servlet
count values using jsp  hai deepak i have a query i am dynamically generating textbox with names in that i am having headings and subheadings i want to get the count of textboxes which are heading under that how
values of Combo boxes are not stored in database - JSP-Servlet
values of Combo boxes are not stored in database   i have some combo box values. when i click the submit button after select combo box values, the values are not going in database. please review the code: function
What values initialized inside init() in servlet - Java Interview Questions
What values initialized inside init() in servlet  What will happen inside init() in servlet. my interviewer asked servlet lifecycle. i said "once servlet is loaded in to memory init() will be called which performs servlet
how to load values of html form into an excel table using java servlet?
how to load values of html form into an excel table using java servlet?   i have written a java servlet program, which has a html form to be filled. after filling the form the servlet generates a receipt and the values should
getting dropdown values using apache commons in servlet
getting dropdown values using apache commons in servlet  i want to get dropdown values in my program in order to merge the string to my file path so that the path will change dynamically according to user input.iam new to apache
Passing java variables from JSP to Servlet - return null values
from JSP to servlet gives null values. I got msg=null. Is there another way...Passing java variables from JSP to Servlet - return null values  I want to pass some variables from a JSP page to a servlet. These variables are from
Displaying Constant values from Interface in JSP - JSP-Servlet
Displaying Constant values from Interface in JSP  Hi, ******Sorry but I forgot to mention in my previous question that I am using struts2, also... values public interface ProjConstant { public static final String PROJECT_NAME
not able to get values from jsp file - JSP-Servlet
not able to get values from jsp file  hi thanks for u feedback, her am sending the file jsp and servlet but in the servlet file am not able to get...; ================================================================= servlet file
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
how to pass the mutiple values from    I am getting the error when passing the values from this way emp2=${employee.lastName1} & name=${employee.firstName.How to pass the values from hyperlink in column
Values from servlet into dropdownlist in jsp page using ajax
Values from servlet into dropdownlist in jsp page using ajax  1) jsp...); } } } Im not able to get values retrived from servlet into dropdownlist of jsp page...kindly check the code attached and tell me
retrieving values from dynamically added textboxes in jsp - JSP-Servlet
retrieving values from dynamically added textboxes in jsp  hai friends, iam new to this site ,please help me in this senario in jsp how to retrieve values from dynamically added textbox like we can see in naukri.com
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
how to pass the mutiple values from      Hi Friend, Please post your full code. Thanks
How to Sort Column values of a jsp table - JSP-Servlet
How to Sort Column values of a jsp table  Hi Friend Please help me. I am displaying reultset values on multiple jsp page. I want to sort selected column values on every page onclick of an event its very urgent pleasehelp
How to store values in a database using JSTL? - JSP-Servlet
How to store values in a database using JSTL?  I want to store values in a database... How can i store in database? Here is my code... This wil extract details and displays in a table format... Now i want to store these values