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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Getting parameters from doGet()

village idiot
Posts: 1207
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is sort of a duplicate post, I asked a similar question in the HTML forum, but it occured to me maybe my problem is related more to servlets than HTML.
I'm working on a CattleDrive assignment. I'm trying to send a parameter along with the url in an href link to a servlet. The servlet will look at the parameter and decide which jsp page to forward the request to.
I got this whole thing working using forms, because I know how to send and read parameters using a form, but I have to figure out how to do it using a link only, which means a get request with no form for submitting data. No button involved. Only a link.
I tried appending the name/value pair on to the url in the link, but my servlet still can't read the parameter using getParameter(), getParameterValue(), or getAttribute(), or getString( key ) for that matter. (A method in the com.javaranch.common package.)
Is there a special way to access parameters in the querystring that I am unable to find any info on? All the stuff I'm reading seems to be for getting data from forms.
I guess I need to figure out the following:
A) How to get data into the querystring without using an input button.
B) How to retrieve said data in my servlet.

Any thoughts?
Posts: 67451
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Regardless of how the request parameters get to the servlet, the getParameter() family of methods is used. So the problemis most likely in the building of your URL.

I'll closed this topic and we'll focus on the HTML forum post.
Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic