• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem i am facing here................

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually I'm not sure I totally understood your problem: you don't want the page to process another submit when the user does a refresh, is that right?
Since a refresh of a page containing the results of a form-submission is always going to resubmit the form, then I think you're asking for the impossible.
 
Kumaran Sowrirajan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Adam
you are correct.I dont want the page to process another submit when the user does a refresh.is it possible???
regards
Kumaran.S

Originally posted by Adam Hardy:
Actually I'm not sure I totally understood your problem: you don't want the page to process another submit when the user does a refresh, is that right?
Since a refresh of a page containing the results of a form-submission is always going to resubmit the form, then I think you're asking for the impossible.


 
reply
    Bookmark Topic Watch Topic
  • New Topic