Results 1 to 6 of 6
Thread: reading parameters from URL
- 03-01-2012, 04:49 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 3
- Rep Power
- 0
reading parameters from URL
Hi
Apologies for this question as it is probably one of the simplest things to do but i have been looking at this issue for so long i am now starting to confuse myself more.
I am wondering if someone would be able to point me in the direction of finding information on now to solve an issue i am encountered.
I am trying unsuccessfully to create an application that will allow the user to sent a URL like http://www.abc.makeup/en/doSomething...vale&par2=val2 and then my application to be able to read the value of what par1 and par2 (after the URL clicked) and save these to variables with the doSomething. Is this even possible?
I have edited the web.xml to redirect the application to the correct page when the URL contains the string "doSomething".
The intention is that this will be done through java servlets.
I have tried request.getParameter("par1"); but either i have defined this in the wrong place or it being called.
Thanks for any help in advance
- 03-01-2012, 05:20 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,479
- Rep Power
- 16
Re: reading parameters from URL
What code have you got?
What is that code doing that it shouldn't?
Do you have any errors?Please do not ask for code as refusal often offends.
- 03-01-2012, 05:33 PM #3
Member
- Join Date
- Mar 2012
- Posts
- 3
- Rep Power
- 0
Re: reading parameters from URL
The code should be reading the values from the URL and putting them into variables to allow me to process and pass the values onto a web service which I have created. At present the code I have appear to be doing nothing. There are no errors being displayed.
My code is below and I have break point at least to see if they are being initialized. Am I missing something so simple?
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
final String par1 = request.getParameter("par1");
final String par2 = request.getParameter("par2");
- 03-01-2012, 05:46 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,479
- Rep Power
- 16
Re: reading parameters from URL
So is it getting into that doGet?
WHen you say "redirect ... to the correct page" you do mean "forward" don't you?Please do not ask for code as refusal often offends.
- 03-01-2012, 05:59 PM #5
Member
- Join Date
- Mar 2012
- Posts
- 3
- Rep Power
- 0
Re: reading parameters from URL
Apologies yes I mean that it forwards me to the correct page. As for the doGet method not it doesn't appear to be getting into this method at all (well it isn't hitting any of my breakpoint when the code is running in debugging mode).
As for reading the parameters of the URL am what I trying to do the correct approach or have I got seriously lost along the way somewhere.
- 03-01-2012, 06:03 PM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,479
- Rep Power
- 16
Similar Threads
-
Java from console with parameters... with inetrnal parameters
By metoda in forum New To JavaReplies: 10Last Post: 01-24-2012, 10:02 PM -
how to pass parameters from a method to another which accepts to parameters?possible?
By amrmb09 in forum Advanced JavaReplies: 5Last Post: 11-21-2010, 02:08 PM -
problem with reading excel sheet data reading using poi libraries
By sandeepsai17 in forum New To JavaReplies: 5Last Post: 08-21-2009, 11:03 AM -
How to add two other parameters?
By albi_87m in forum Advanced JavaReplies: 3Last Post: 05-18-2009, 01:25 PM -
get parameters in jsp
By cecily in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 08-05-2007, 04:29 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks