Home Answers Viewqa JSP-Servlet previous values in servlet

 
 


Valli
previous values in servlet
1 Answer(s)      3 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..
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 Pages:
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
retrive values - JSP-Servlet
retrive values  how to get multiple values from html to jsp
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
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
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
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
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
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
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
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
How to use next and previous button(or href) for database table that is retrieved from MySQL DB using jsp,jstl,javascript
How to use next and previous button(or href) for database table... button/link then it must display next 10 record from database and same for previous to display previous 10records. Database Query like this: Select * from table
Servlet-JSP population - JSP-Servlet
Servlet-JSP population  Hi, this is regarding my previous question... is to take the number of items of checked values and multiply with the price and display in the next page. I changed my servlet code something like this but i
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
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
ma access reading values
values throught servlet and register.jsp now i need code for reading values from... and inserted values throught servlet and register.jsp now i need code for reading...(table in my ms access) need to display values in jsp .............please help me
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
ma access reading values
has to login . i already created ms access page and inserted values throught servlet and register.jsp now i need code for reading values from "username... access) need to display values in jsp .............please help me
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
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
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
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 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
servlet
"); st.executeUpdate("insert into emp_sal values('uiu',89)"); pw.println("succes"); con.close
JSON-JSP example
; In the previous section of JSON-Servlet example you have learned how to create a servlet class by using JSON classes. Now in this example we will tell..., ezmorph.jar and json-lib-2.2.2-jdk15.jar. To get string values of array object we
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
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
servlet
"); st.executeUpdate("insert into emp_sal values('uiu',89)"); pw.println("succes
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
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
SERVLET
_PASSWORD) " + " VALUES("+id+",'"+user_name+"',to_date('"+user

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.