This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes found String rquired int Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "found String rquired int" Watch "found String rquired int" New topic
Author

found String rquired int

raji toor
Greenhorn

Joined: Jun 01, 2007
Posts: 20


this passes a return value of type String to property IP1. so it threw IllegalArgumentException for this function.


bean specs definne that getIP1() method should return String if i use String as argument for setIP1(). But i want to manipulate them as int's not strings what should i do.


toor
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Bean specs definne that getIP1() method should return String

Does it ? Where did you read this ? If your ip1 variable is an int, it's getter should be :


By the way, you should avoid mixing upper/lower case that way, or you'll get troubles with beans. You'd better rename your instance variable to "ip1", and declare setIp1 and getIp1.


[My Blog]
All roads lead to JavaRanch
raji toor
Greenhorn

Joined: Jun 01, 2007
Posts: 20
I think i am misunderstood
According to this code I get IllegalArgumentException

and this function in my class

but when i changed my functions to below it went well. I had also to change ip1 instance variable to String.

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You should be able to user integers too.


What is the value of param.subnet1 ?
[ June 19, 2007: Message edited by: Satou kurinosuke ]
raji toor
Greenhorn

Joined: Jun 01, 2007
Posts: 20
i have allowed values form 0 to 255 to be input in the form
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

comment that line :

and try this instead :


Check what is being printed. I have a feel that your subnet1 is null/empty. It may happen the first time you access the page (which means that subnet1 has not been submitted yet)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: found String rquired int
 
Similar Threads
IOException while reading objects
Invalid property in <set>:
Unable to Redirect to the On submitting a form
set property as value of another property
Problem whne used custom squence name in JPA (hibernate) annotations