jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "jsp" Watch "jsp" New topic
Author

jsp

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Instead of calling different files for performing different
operations(based on the button click event) i want to
write a jsp page which should include all the operation to be performed .eg:add,delete,modify,view,listview.
to perform all the above mentioned operation in the same jsp
page,i want to know which button is clicked first.
so is there any option to check that in javascript and assign
the checked condition in some variable.
if this is acheived i think i can check it in jsp
and write coding accordingly in jsp.

thanks in advance,
s.praba
kichu kichu
Ranch Hand

Joined: May 10, 2001
Posts: 59
Hai,
can u make your question more clear???
regards,
kichu.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

If I understand your question correctly, you can use the fact that you know which button was pressed to determine the operation...
OK, that sounded confusing.
What I mean is, you can have several buttons on the page and the button pressed will be a part of the information returned to the server.
I'd have to go back and test, but if you give your buttons (or 'submit' or whatever) a name AND a value, it will be passed normally as a name/value.
Dave.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"s.praba",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
mohana konakanchi
Ranch Hand

Joined: May 16, 2001
Posts: 67
Hi,
If I understand your problem correctly,
Your want to know, which button is pressed, so that you can do process that.
You add, Onclick = "someJavaScriptFunction();" to each button.
And use a global var btnCliked = "false";

in each javaScriptFunction() check the condition, if no other button is pressed, process the request. if some other button is pressed neglect the request.

function someJavaScriptFunction()
{
if(btnCliked == "false")
{
btnCliked = "true";
// do call related servelt
}
else
{
return false;
}
}
In Servelt
You need to check requested operation type, before processing.
Hope I answered your problem, if not please elabarate more.
Raja Shekhar
Ranch Hand

Joined: Apr 02, 2001
Posts: 49
Hi
U wanted 2 manipulete/ do U.I.D operations
using single button instead of multilple button
..rite..
if (rite)
A Liitle bit of Smart ness is needed 4 this...
just ..instially take one operation as defualt
and using java script decide on the next operation
pass that variable to the next JSP page
and depending on condition..
put the code...

Got IT

Raj
 
wood burning stoves
 
subject: jsp
 
Similar Threads
How to refres a jsp with the help of Swing
Progress of an action
Showing the status of an operation
Adding progressbar
how can i map different Actionform class to single Action class