aspose file tools*
The moose likes JSP and the fly likes Problem i am facing here................ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem i am facing here................" Watch "Problem i am facing here................" New topic
Author

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

Kumaran Sowrirajan
Ranch Hand

Joined: Oct 15, 2001
Posts: 36
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
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
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.


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Kumaran Sowrirajan
Ranch Hand

Joined: Oct 15, 2001
Posts: 36
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.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem i am facing here................