This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request.getParameter

 
raj guntupalli
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May I help you?
 
Tim Baker
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is name a String object? you haven't created a local class called String have you?
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String value = req.getParameter(name)
getParameter returns an Object, you have to type cast it.
String value = (String)req.getParameter(name)
 
Malli Raman
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well
It has to be

hth
MB
[ October 21, 2003: Message edited by: Malhar Barai ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic