Share on Google+Share on Google+

Valli
previous values in servlet
1 Answer(s)      6 years and 10 months 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









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 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
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 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
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
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
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
next and previous record in php
next and previous record in php  How to display next and previous records in PHP
remove previous view iphone
remove previous view iphone  How to remove previous view in iPhone application on loading a new subview
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
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
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
Mysql Date Previous Month
Mysql Date Previous Month       Mysql Date Previous Month is used to return the current and previous... that help you to describe Previous Month value. To understand this, we have
Tutorials   
Java Spring Hibernate Struts Training fat image from db fat image from db fat image from db fat image from db unable to get value returned from javascript variable in page How to change image size before adding to mysql using jsp Design a registration.jsp page with input for user registration details Cart Quantity jsp servlet coding issue servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? image pdf marking pdf marking Multiple image upload using JSP Read code from excel sheet and upload into database using JSP Student java about search engine Convert BLOB to PDF and save it to a location how to copy files from remote to local machine using SFTP SSL in java? Like Team viewer Socket and Servert -Jsp how to copy files from remote location to local using java? How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java how to create SOAP based web service in java? how to fetch data from mysql database table and draw a bar chart on that data using in jsp how to create users in LDAP using java? how to authenticate user using TIVOLI api in java? how to create users using IBM Tivoi API in jsp/servelet? Java/J2ee Please explain this code as many packages and classes are unknown to me .! how to download the uploaded folder files using jsp Login Query image is display from path of mysql database please reply the code to store dynamic fields in database? Reloading issue in jsp How to get Button Id ? calling one jap page from another jsp page login login Problem to get connection from DAO class to JDBC Page Loading Time Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below Sending hidden values

Ads

 
Advertisement null

Ads