Hi friends
plz go throgh this problem...and give me solution for this problem i am facing.....i developed this page in
jsp.
i am having one button [named it as ADD],and another button [ named it as Remove] and Combo box.Combo is filled with database values.
If i select the Combobox value and then click the ADD button i have to create one HTML row in the same page.
<%
String url = request.getScheme()+"://" +
request.getServerName() + ":" +
String.valueOf(request.getServerPort())+ request.getRequestURI();
%>
function submitData()
{
document.form1.method = "post";
document.form1.action = "<%=url%>";
document.form1.submit();
}
Each time i am clicking the ADD button i am calling the javascript function to submit the selected data to the same page.
End User can select any values from the combo and press the ADD button at any number of times.for each time the user presses the ADD button i created one HTML row in the same page below the ADD button.
Once if the user clicks the ADD button i put that selected value into session variable.i am using HttpSession.then i retrieved the data from the session and then displayed it as one HTML row.
Suppose if i click the browser refresh button or Control-R or f5 the value which is added recently is keep on adding in session and it will create a HTML row in the page.Same thing happen for Remove button.The purpose of Remove button is to remove a particular row which is added by the user.
Actually what i want is if i click the browser refresh button i dont want to add the same value again and again in the session.
The row created after hitting the ADD button is like this ::-)
QName Leftpara Operator enterValue Rightpara Terminator
Sex ( = Male ) OR
Money ( > 2000 ) AND
Salary ( != 10000 )
session.setAttribute("QName",qname);
// qname is the Vector containing Sex,Money,Salary.
session.setAttribute("Leftpara",lpara);
// lpara is the Vector containing all the ( brackets
session.setAttribute("Operator",operator);
// operator is the Vector containing =,>,!= like all operators.
session.setAttribute("enterValue",textval);
// textval is the Vector containing all the values
// entered by the user for the particular rows.
session.setAttribute("Rightpara",rpara);
// rpara is the Vector containing all the ) brackets
session.setAttribute("Terminator",terminator);
// terminator is the Vector containing all the OR,AND,None
// Operators.
If i click the browser refresh button then the last row added called Salary is added one more time like this ::--)
QName Leftpara Operator enterValue Rightpara Terminator
Sex ( = Male ) OR
Money ( > 2000 ) AND
Salary ( != 10000 )
Salary ( != 10000 )
QName,Leftpara,Operator,enterValue,Rightpara and Terminator are Table Headings.
QName is nothing but the Selected Value from the ComboBox.Based on this user selection and entered values i have to generate the report.
if anybody didnt understand this problem what i am facing plz let me know.
Thanks and Regards
Kumaran.S