• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Integer vs. String

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a problem with displaying a number which I has inserted through HTML input



Does somebody know why or how?

regardes,
Marko
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
addition:

when I input String on same whay its ok:


but on number, everything colapse

regardes,
Marko
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm really confused as to what you are trying to accomplish.

Firstly, you are mixing JSTL, EL and scriptlets? Why the scriplets?

Secondly, you are trying to obtain request params in the same page as defines the form. In this case, the form hasn't even been displayed yet, so how can it have been submitted in order to generate the request params?
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,
I am doing some web services, and I am calling operation within jsp, and I passing her a input var, and proceding output of operation on the next page.jsp, so it is a problem - I must mix

But this is very little mixing , and it must be done.



when I pass the String, it is ok

but when I need to pass int
but before
<%....%>
I have
so, I need to put those values into <%....%>, but String it accept, and on int, it colapse

And I cant get it,
please help,
regardes,
Marko
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I ment this that I have for printing out
 
Bear Bibeault
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


The getParameter() method returns a String. Always.

Is this the way that you'd convert a string into an int in a Java program? Of course not. You can't cast a String to an int.

In an earlier code snippet you used Integer.parseInt(). Why did you stop using that?
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
because it didnt work ,
so I ment that I am loosing track

Marko
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tryed this to, end nothing
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


end this
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



Integer.parseInt returns an int so there is no need for the cast.
 
Bear Bibeault
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

it didnt work



These are the three most useless words you could post on this forum. How did it not work?
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what I get with



 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

org.apache.jasper.JasperException: java.lang.NumberFormatException: null




This is the exception that will be thrown if you try to convert a null to an int.
This means that no "id_user" parameter was sent to your page.
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but here I have itand immidietly after this I have

It is wery odd
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have figure out:
I will pass String parameter in web service operation, but on the server side I will do parsing before entering the database.

Thank you guys on the thinking with me,
Regardes,
Marko
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi marko,
please can you show me how you figured it out?
Kind regards
 
Marshal
Posts: 80775
489
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I am afraid this is a thread from 2006, and MD is unlikely to be around to give you an answer.
Please explain what your current problem is, and the rest of us can see what we can do.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic