GeeCON Prague 2014*
The moose likes Servlets and the fly likes request.getParameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "request.getParameter" Watch "request.getParameter" New topic
Author

request.getParameter

raj guntupalli
Greenhorn

Joined: Dec 16, 2002
Posts: 27
Hi,
com.ibm.servlet.engine.webapp.WebAppDispatcherRequest myReq =(com.ibm.servlet.engine.webapp.WebAppDispatcherRequest) request;
String url = "/Remote";
myReq.setRawParameters(temp_map);
myReq.setPathInfo(url);
Stis giving an
request.getRequestDispatcher("/RemServlet").forward(
myReq,
response);
String value=req.getParameter(name) is giving a
but the getParameterNames is working fine
Servlet Error: java.lang.String: java.lang.ClassCastException: java.lang.String
Thanx
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
May I help you?


- Varun
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
is name a String object? you haven't created a local class called String have you?


Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
String value = req.getParameter(name)
getParameter returns an Object, you have to type cast it.
String value = (String)req.getParameter(name)


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Originally posted by Andres Gonzalez:
String value = req.getParameter(name)
getParameter returns an Object, you have to type cast it.
String value = (String)req.getParameter(name)


Hi,
By default req.getParameter("name") returns a String Object only. You don't required to type cast it.
Regards,
M.S.Raman
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
well
It has to be

hth
MB
[ October 21, 2003: Message edited by: Malhar Barai ]

Malhar Barai
SOA & Java Book
 
GeeCON Prague 2014
 
subject: request.getParameter