[program-java] Re: Struts: Casting

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <program-java@xxxxxxxxxxxxx>
  • Date: Thu, 24 Mar 2011 14:21:53 -0400

Because the return type of getParameters is most likely Object and not Boolean.
 
Take care,
Sina
 
From: program-java-bounce@xxxxxxxxxxxxx 
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Corbett, James
Sent: Thursday, March 24, 2011 10:47 AM
To: 'program-java@xxxxxxxxxxxxx'
Subject: [program-java] Struts: Casting
 
Hi:
 
On one of my jsp pages I have a check box. When the box is checked and the 
submit button is clicked I can review the value of the
check box in my form bean validation method thus:
 
Boolean myValue = (boolean)request.getParameters("Xxx34DTO.pofIndicator");
 
The Xxx34DTO.pofIndicator is defined as type boolean. So, why do I need to cast 
it to boolean if it's already a primative boolean?
 
Just wondering.
 
Jim 
 
James M. Corbett
 
Programmer / Analyst | 
Canada Revenue Agency | Agence du revenue du Canada
875 Heron Rd.
Ottawa, On.
K1A0L5 
 
James.Corbett@xxxxxxxxxxxxx
Telephone | Téléphone: (613) 941-1338  
Facsimile | Télécopieur: (613) 941-2261  
 
Government of Canada | Gouvernement du Canada
 
"What I do tomorrow is just as important as I do today"
 
Neil Young
 
 

Other related posts: