Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Servlets
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Servlets section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 2nd, 2006, 04:40 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default calling a servlet by clicking a menu?

Dear Friends ,


            i want to call a servlet by clicking a menu. please help me

regarding this.............
Reply With Quote
  #2 (permalink)  
Old February 4th, 2006, 10:28 AM
Authorized User
 
Join Date: Jan 2006
Location: , , USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to longjava
Default

Here is how you would call a servlet when a user clicks on the menu:

(Assuming that the menu is made of CSS and HTML, and the menu item is an anchor html tag <a>)

<html>
<head>
<script type='text/javascript'>
function invokeServlet()
{
   // form a URL with the servlet name to be invoked
   var URL = 'http://hostname/servlet/servletName';

   // This line will inkove a servlet and reload your page
   location.href = URL;
}
</script>
</head>
<body>

<a href='#' onclick='invokeServlet()'>Click here to invoke servlet</a>
</html>


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in calling classes in simple Servlet sanna231 J2EE 6 December 23rd, 2012 01:06 AM
Calling java Servlet from ascx page pradeepnair74 BOOK: ASP.NET AJAX Programmer's Reference : with ASP.NET 2.0 or ASP.NET 3.5 ISBN: 978-0-470-10998-4 0 October 7th, 2008 07:31 AM
Calling a btn_click method without clicking it dhirajDac VB.NET 1 April 18th, 2008 08:24 AM
Calling a command from a servlet emirant1 Servlets 1 December 23rd, 2005 11:33 AM
calling java servlet from javascript bearfacts Javascript How-To 1 August 26th, 2004 04:57 PM



All times are GMT -4. The time now is 10:39 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.