Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Alternative to using getParameter  RSS feed

 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I enter a URL such as www.website.com/some.jsp?page=text.txt but when trying to grab the "page"'s value using getParameter I get null. Is there another way to grab this value from the URL instead of from embedded in a form? Thanks.

Rob
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest try and figure out why getParameter is not working. Can you post some real code that you are trying with. Ofuscate something that you don't want to show, but surely in case of any special character or space etc. do include them.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the URL is properly formatted, getParameter() should work just fine.

Anupam Sinha is correct. When something that should work does not, it's best to try and figure out why rather than look for work-arounds.
[ May 16, 2007: Message edited by: Bear Bibeault ]
 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought that maybe getParameter worked only on values coming from a form and not from the query string. That's the issue I was really having (i.e. whether or not getParameter could extract from the URL). The getParameter does work it's just the cases whereby the call to the URL was not passing correctly. Thanks for the help.

Rob
 
Mario Rezende
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,

Try use Expression Language (EL): ${param.page}

Goog lucky =]
[ May 17, 2007: Message edited by: Mario Rezende ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought that maybe getParameter worked only on values coming from a form and not from the query string.


Anybody seriously interested in working with servlets and JSP should keep a copy of the API on hand. Start here to get a copy of the JSP api. That way you can resolve questions such as the above quickly.

Bill
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!