• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do i make a <button> activate a scriplet?  RSS feed

 
Thor Wium Giversen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone. Well the title says it all. I need my button to trigger the jsp event but i do not understand why my code wont work. Hope you can explain it to me :) ..

My code looks like this.

 
ujjwal soni
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The scriptlet would have been executed at your Webserver and the result of the scriptlet would be available within the Javascript in the JSP that you are viewing in your browser. Please check the JSP's source using View source from the browser.
Btw, the scriptlet would never execute on the button click. only your java script does.

You can try achieving it using ajax/jquery.

Thanks,

Ujjwal Soni
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, no JSP page written after 2002 should contain scriptlets. They have been discredited since the introduction of JSP 2. Time to update your knowledge.

Also, it is clear from your question that you don't understand what JSP is and how it operates. Please see this article for an explanation of why you can't execute JSP code as the result of a client event.
 
Thor Wium Giversen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you are probably right. I am taking an intro course in programming and i think i may have focused to much on learning Java. Anyways, thanks for the link.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Learning Java and learning web development are two very different tasks and I would not counsel learning them simultaneously. if your plan is to create Java-powered web apps, I'd advise to get a good handle on Java first.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!