Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
can u make your question more clear???
regards,
kichu.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
mohana konakanchi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic