Results 1 to 5 of 5
  1. #1
    mallyjay is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Default Linking a servlet from HTMl

    I am trying to link the servlet through html page using link rather than a form.

    I linked it using <a href="myservlet">You clicked me</a>

    But now i have many link calling same servlet and process it as per the link was clicked. But I am not able to find out which link invoked servlet? How could I find that??

    In advance Thanks..

  2. #2
    kattavijay's Avatar
    kattavijay is offline Member
    Join Date
    Jan 2009
    Location
    Hyderabad,india
    Posts
    21
    Rep Power
    0

    Default

    you can call the servlet in this way also..
    but iam not getting what exactly you are asking for in line no 3&4

  3. #3
    mallyjay is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by kattavijay View Post
    you can call the servlet in this way also..
    but iam not getting what exactly you are asking for in line no 3&4
    Lets say i have a link dog and cat.
    When I click dog that a servlet is invoked and it look in database for the detail about dog and show the user.
    and When I click cat it should do the same but the paramater should be cat instead of dog during lookup.
    So how can I achieve this. How servlet will know I clicked dog or cat??

    Did you get me?

  4. #4
    kattavijay's Avatar
    kattavijay is offline Member
    Join Date
    Jan 2009
    Location
    Hyderabad,india
    Posts
    21
    Rep Power
    0

    Default

    yah i get u ,

    1.from u r html u need to send the pet type(i.e dog or cat),
    2.for this u can try this simple code..
    <body>
    <a href="hello?param=dog">dog</a>
    <a href="hello?param=cat">cat</a>
    </body>


    3.then when u click on the dog it calls the servlet with hello url pattren with parameter dog same for the cat also .
    4.at the servlet u read the parameter name param which contains cat or dog

    by using that parameter value u can do further operations..

  5. #5
    mallyjay is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Default

    okay I get it. Let me chek this out. Thank you very much for the help.

Similar Threads

  1. calling up servlet from Html
    By mosto in forum Java Servlet
    Replies: 7
    Last Post: 10-18-2009, 03:38 PM
  2. HTML linking and java applets
    By Bomber_Will in forum Java Applets
    Replies: 4
    Last Post: 02-08-2009, 07:50 PM
  3. Servlet should return a jsp page not html
    By hannehomuth in forum Advanced Java
    Replies: 1
    Last Post: 08-12-2008, 03:14 PM
  4. get data from servlet to html
    By lema in forum Java Servlet
    Replies: 7
    Last Post: 05-22-2008, 04:00 PM
  5. get data from html to servlet
    By lema in forum Java Servlet
    Replies: 66
    Last Post: 04-09-2008, 02:43 PM

Posting Permissions

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