473,503 Members | 11,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JSP what will happen if i click submit button twice

67 New Member
Hi All
I have an interview question
What will happen if i click the submit button twice in a JSP. Will the second request be processed or not.

Thanks
new learner
Sep 21 '09 #1
3 5486
Frinavale
9,735 Recognized Expert Moderator Expert
Of course it will be.
If you hit a button twice then you hit a button twice. Unless you have some sort of JavaScript code (that runs in the browser) to prevent the user from submitting twice it will submit twice. The server could also check to see if the page has been submitted twice but by that point the page is already submitted.
Sep 21 '09 #2
newlearner
67 New Member
thanks Frinavale
if i am not wrong... it would get submitted twice,but since the object is already found in the session another instance is not created.so there is no response to the second click.

please clarify
Sep 21 '09 #3
Frinavale
9,735 Recognized Expert Moderator Expert
Session exists on the server.

It's a type of "container" that is used to store variables that need to be remembered between page submits to the server...and need to be remembered between several different pages.

Session doesn't really play a part in the page being submitted to the server. It plays a part in what is returned to the browser though because usually the variables in Session are used for logical decisions that determine your page's output.

So, if you click a submit button twice, the page is submitted to the server twice.

Session, is just a container of variables that you can access in your server code.

After the page is submitted the Java server-side code is executed. Session is available to the Java server-side code and it can be used to determine what should be sent back to the user.

Session kind of works as a key-value list of stuff. The key can only exist once and the value for that key can be over written whenever you need it to be.

So if your page submits to the server, and then your Java code sets a variable in Session, that variable will be available the second time the page is submitted.

That means that whatever happens to your Session variable depends on your server-side logic....Does the Session variable get set every time the page is submitted? Does the Session variable only get set if it hasn't already been set? Is the Session variable used to determine whether or not the user is allowed to view the content?

The important thing to note is that the action of page being submitted is completely separate from Session...the only thing that connects the two is that the page submit submits a request to the server which executes your Java server-code and your server-code may or may not use Session to make decisions on what should be returned to your user.

You really should research the topic of Session.

-Frinny
Sep 21 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
11376
by: JSjones | last post by:
Hi all, I'm new to these boards and my javascript experience is fairly limited and basic so please bear with me. Anyway, on to the question and some background. I'm developing using ColdFusion...
15
6540
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and...
1
5191
by: rmgalante | last post by:
I have written an ASP.Net application that uses the standard client-side and server-side validation for various fields on the form. Some of the customers that use the form report symptoms that...
16
3403
by: Barry Gilmore | last post by:
Is there a way to disable a button after it is clicked? I am trying to avoid having someone click on it twice while they wait for it to process. Thank you!
4
4058
by: Ian Davies | last post by:
Hello I am struggling for a solution to clear some fields on my webpage that takes their values from some sessions My solution below works when the button is clicked twice. I sort of know why I...
7
2057
by: Bjorn Sagbakken | last post by:
Hello. There maybe an simple answer to this, but sometimes one get a strange blindness when working intensely on one single problem. I'm using ASP.NET 2003, building pages that include 3 user...
2
1220
by: technoGirl | last post by:
Hey guys, I'm doing something similar to the example below (c# version): ...
14
3360
by: Ed Jay | last post by:
Despite searching the net, I can't find a suitable solution that prevents a user's double click from submitting a form twice. I'm currently using the following in a button element: <input...
8
3875
by: thatcollegeguy | last post by:
http://smarterfootball.com/exits/theHTML.html I am not sure what is wrong w/ this code. The main issue is that the table that is in the initial html will empty its td but the table that I load...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7015
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.