• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp button runs java program

 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need help regarding java and jsp. I am new to java programming and I have to make a jsp webpage in which I will make buttons, which when clicked should run the java program i wish and perform actions such as starting or stopping a script. How will I enable my jsp buttons to run the java program?
Thank you
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The final jsp is rendered as html to client. So you wish to start or stop a script at client end, is it possible, or do you wish to execute some script at server end?
 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swastik Dey wrote:The final jsp is rendered as html to client. So you wish to start or stop a script at client end, is it possible, or do you wish to execute some script at server end?


Hello
I wish to start and stop the scripts at Server end. How would I do that? I have already written the code that starts and stops my shell scripts which works fine. Please explain in detail. Thank you for your time.

 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably what you need to do is, submit the request back to a controller servlet, that makes the method call.
 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swastik Dey wrote:Probably what you need to do is, submit the request back to a controller servlet, that makes the method call.


Thank you
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this article to understand what JSP is and why there really isn't any such thing as a "JSP button".
 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swastik Dey wrote:Probably what you need to do is, submit the request back to a controller servlet, that makes the method call.


Can you show it by some small example? I have been searching for it and I haven't got a single example that would show me how to do that. Thanks in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To start, do you know how to submit a form? That's one way that will submit the whole page and cause it to refresh (or navigate to another page).

If that's not what you want to do, then you need to learn how to make Ajax requests which will not cause the current page to unload. Look into using jQuery to make Ajax request using JavaScript upon the press of a button or other event.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!