request.getParameter() returns unexpected value...
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Steve_Long
Posted On:   Sunday, March 10, 2002 03:02 PM

here is the html snippet: What would you like to do ? One Two here is the servlet code snippet: int item = -1; try {      String s = (String)request.getParameter( "item" );      item = Integer.parseInt( s ); } catch (Exception e) {     item = 100; } The result I keep getting is     s = "One" regardless of what button I push. What I expect is 100 or 200. Any thoughts ? TIA ! steve    More>>

here is the html snippet:


What would you like to do ?







here is the servlet code snippet:

int item = -1;

try {
     String s = (String)request.getParameter( "item" );
    
item = Integer.parseInt( s );

}
catch (Exception e)
{

    item = 100;
}


The result I keep getting is


    s = "One"

regardless of what button I push. What I expect is 100 or 200.

Any thoughts ? TIA !

steve

   <<Less

Re: request.getParameter() returns unexpected value...

Posted By:   AlessandroA_Garbagnati  
Posted On:   Monday, March 11, 2002 01:54 AM

Steve,

I'm afraid this does not depend on the request.getParameter() method, but on the way the browser is passing the information to the server.


request.getParameter() just reads the value that has been passed to the server from the browser that has created the key/value pair list.


In the case of the

About | Sitemap | Contact