File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

casting error

 
sagar khana
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everybody,
how are you?
i am having this casting problem i want to convert String s whose value is retrieved by a text field but i am getting this casting problem in:
"int i=(int)s;"

 
Paul Clapham
Sheriff
Pie
Posts: 20205
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is that Java code doing in a JSP?

At any rate, you've got this question about your Java code. So let's put the question into one of the Java forums. Moving...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64204
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, Java code in a JSP is a huge no-no! Please read this JspFaq entry.

Secondly, you cannot cast a String to an int. That's just basic Java.

As this isn't really about JSP at all, it's been moved to the Beginning Java forum.

[Edit: Paul beat me by 20 seconds!]
 
sagar khana
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Firstly, Java code in a JSP is a huge no-no! Please read this JspFaq entry.

Secondly, you cannot cast a String to an int. That's just basic Java.

As this isn't really about JSP at all, it's been moved to the Beginning Java forum.

[Edit: Paul beat me by 20 seconds!]


hey ,

i am just trying to learn the concept to used scriplet and sorry to ask in this section thought it would be hoping to get the solution of my problem
 
Paul Clapham
Sheriff
Pie
Posts: 20205
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem... it's just that your question has nothing to do with scriptlets. When you put Java code into a scriptlet, it's still Java code. Don't let the fact that it happens to be embedded in a JSP cloud your mind, it's still Java code. So questions about it are questions about Java code.

When you're programming, and especially when you're trying to fix problems, it's important to focus on the right things. Try to avoid being distracted by things which aren't relevant. I know, when you're a beginner it isn't always easy to tell what's relevant, so consider this moderator action to be part of your problem-solving process.
 
sagar khana
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
all i am trying is increasing my knowledge i used Integer.parseInt() function and problem solved thanks for your sharing
have a nice day :)

Paul Clapham wrote:No problem... it's just that your question has nothing to do with scriptlets. When you put Java code into a scriptlet, it's still Java code. Don't let the fact that it happens to be embedded in a JSP cloud your mind, it's still Java code. So questions about it are questions about Java code.

When you're programming, and especially when you're trying to fix problems, it's important to focus on the right things. Try to avoid being distracted by things which aren't relevant. I know, when you're a beginner it isn't always easy to tell what's relevant, so consider this moderator action to be part of your problem-solving process.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic