previous values in 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 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..
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









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
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
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 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
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 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
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
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
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
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
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
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
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
how to get a values from a multipart/form-data - JSP-Servlet
how to get a values from a multipart/form-data  Dear sir , I used your code for getting a values,i used the fllowing function... ,matter,file field values but not status and from field i am getting null
Transferring values between javascript and java code in jsp - JSP-Servlet
Transferring values between javascript and java code in jsp  Is there a way to transfer values between the javascripts and the java code(scriptlet, expressions etc) in a jsp page?   Hi Friend, 1)Pass value from jsp
How to get the values from the Combo Box - JSP-Servlet
How to get the values from the Combo Box   Sir, Actually i am getting the values in the combo box from table.I want what ever... in their respective text box. e.g suppose i select ram values from the combo box and its
Facing Problem to insert Multiple Array values in database - JSP-Servlet
Facing Problem to insert Multiple Array values in database  Hai friend , Iam beginner in jsp and creating the project in shopping cart but ihave facing the problem while inserting the data in database. iam using the MsAccess
how to access radio buttons selected in a servlet??...iam unable to retrieve values...it is returning NULL
how to access radio buttons selected in a servlet??...iam unable to retrieve values...it is returning NULL  <html> <head> <title>online exam</title> </head> <body> <div
how to access radio buttons selected in a servlet??...iam unable to retrieve values...it is returning NULL
how to access radio buttons selected in a servlet??...iam unable to retrieve values...it is returning NULL  <html> <head> <title>online exam</title> </head> <body> <div
How to read a rows which have a values in a excel file using apache poi - JSP-Servlet
How to read a rows which have a values in a excel file using apache poi  Dear sir, How to read excel file in that only a rows which are having some values using apache poi...please help me sir. Thanks and Regards
how to get a column values from a excel file after attaching it - JSP-Servlet
how to get a column values from a excel file after attaching it  hi sir, How to get a column values from a excel file after attaching it while... and get a values from that store that value in To input box.Please help me sir
how to set the values in jsp
how to set the values in jsp  how to set the values text boxs in jsp frm dbase via servlet
remove previous view iphone
remove previous view iphone  How to remove previous view in iPhone application on loading a new subview
next and previous record in php
next and previous record in php  How to display next and previous records in PHP
fetch values in dropdown
fetch values in dropdown  in my application i want fetch dropdown values in jsp page through servlet. means i have to fetch the database fields values in array variable of servlet and then i have to print those values in dropdown
previous view controller
previous view controller  How to get back to the previous view... to go back to the previous view controller. See the example given below...: In an Array the root viewController is at index 0 Previous viewController
reain values
submit form it goes to servlet in servelets it checks for the username if it already exits i m using reuest.sendredirect to same jsp but all textbox values are cleard, i want to retain all values in textboxs after request.sendredirect .Please
Servlet
Servlet  What is Servlet
servlet
servlet  How do we define an application level scope for servlet?   Application scope uses a single namespace, which means all your pages... or change the values when they're likely to be read by another page (this is called
Servlet
Servlet  how to navigate one servlet page to another servlet page
Mysql Date Previous Month
Mysql Date Previous Month       Mysql Date Previous Month is used to return the current and previous... illustrate an example that help you to describe Previous Month value. To understand
JAVA SERVLET - JSP-Servlet
JAVA SERVLET Log   Hi, A servlet file which create the log files ,then writing values to the list & log, we should have a thousand separator and no decimal values. This means instead of writing 986300.0 in the Log file

Ads