Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,190,351 members, 7,940,373 topics. Date: Thursday, 05 September 2024 at 01:22 AM |
Nairaland Forum / Science/Technology / Programming / Java Servlet Question (749 Views)
Help On How To Run A Servlet Http Program (2) (3) (4)
Java Servlet Question by bigboyslim(m): 7:37pm On Jun 01, 2010 |
I click on a link in an HTML form, How can I read in my Servlet code that I clicked on that link. I'm guessing I would have to use the HttpRequest object. Thanks |
Re: Java Servlet Question by candylips(m): 10:39am On Jun 02, 2010 |
implement doPost() in the servlet and in your html page have the form implement action="post" |
Re: Java Servlet Question by logica(m): 1:12pm On Jun 02, 2010 |
"doGet" will be more appropriate since it's a link (and I'm assuming the link is not to execute a form submit through Javascript). The link should of course conform to the URL pattern defined for the servlet. And yes, the HttpServletRequest parameter passed to the "doGet" method will allow you to access any parameters you passed through the URL query string. |
Re: Java Servlet Question by candylips(m): 1:42pm On Jun 02, 2010 |
true i forget he was talking about a link |
Re: Java Servlet Question by bigboyslim(m): 4:02pm On Jun 02, 2010 |
Logica and Candylips, You guys are awesome. Thanks very much. What i didn't know before was how to pass parameters through the URL. I have only used submit buttons to send form parameters in the past. The URL query string sounds like a good approach. |
Re: Java Servlet Question by candylips(m): 4:33pm On Jun 02, 2010 |
yes query string is a very neat way of passing parameters easily |
(1) (Reply)
X Years Of Programming - X Years Of Doing Things Wrong / Important Tools You Need To Boost Your Projects / Great Opportunity For Developers
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 7 |