Results 1 to 3 of 3
  1. #1
    KumbhaniMehul is offline Member
    Join Date
    Apr 2010
    Posts
    16
    Rep Power
    0

    Question Calling Servlet on link click event

    I want to call servlet when user click on link(<a href="">...</a>).
    I also Want to Pass One Value.
    It is possible to do this.:confused:

  2. #2
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    366
    Rep Power
    6

    Default

    Use web.xml do define servlet and <servlet-mapping>
    with path to your servlet


    Java Code:
    <web-app>
    ...
        <servlet>
            <servlet-name>MyServlet</servlet-name>
            <servlet-class>package1.MyServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>MyServlet</servlet-name>
    	[B]<url-pattern>/myserv</url-pattern>[/B]
        </servlet-mapping>
    </web-app>


    After that just use that URL in HREF of your <a> tag like

    Java Code:
    <a href="[B]/myserv[/B]">View My servlet</a>
    I'm leaving value passing to you :)

    regrads

  3. #3
    KumbhaniMehul is offline Member
    Join Date
    Apr 2010
    Posts
    16
    Rep Power
    0

    Default How can i pass value

    how can i achieve that
    how i can pass value what its property of <a...> .. </a>
    Please give me example

Similar Threads

  1. click event
    By raman_v in forum Java Servlet
    Replies: 2
    Last Post: 01-08-2010, 01:05 PM
  2. how can i link html+servlet+xml to form servlet
    By balachandarr in forum Java Servlet
    Replies: 0
    Last Post: 04-15-2009, 05:06 PM
  3. Swing - catching click button event
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-12-2008, 12:03 AM
  4. AWT - catching click button event
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-12-2008, 12:02 AM
  5. How to perform some event to button click
    By eva in forum AWT / Swing
    Replies: 2
    Last Post: 01-16-2008, 01:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •