• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Button click to access Servlet

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am trying to create a graphical button to call a servlet and pass parameters to this servlet. Can someone give me an example to do this? I was able to create a link and pass two parameters, but have not been successful creating a button to do the same.

I am very new to JSP/Servlet programming, any help would be greatly appreciated.

Thank you..
[ October 19, 2008: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"mountaingirl2008", please check your private messages for an important administrative matter.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is an HTML and JavaScript question, so it has moved accordingly.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can either do this entirely with HTML by creating a form with the servlet as its action and the button as the form's submit button, or you can create a non-submit button and use JavaScript to invoked the servlet in the button's onclick handler.
[ October 19, 2008: Message edited by: Eric Pascarello ]
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From your other post:Firstly, don't use all uppercase for your html -- it's very old-fashioned to do so and makes the code hard to read. Use lowercase.

Secondly, your button should be of type "submit" to act as a submit button.

And thirdly, your action URL is not valid. It should be context-relative, not page relative. See the JSP FAQ for more information.
reply
    Bookmark Topic Watch Topic
  • New Topic