How do I let user enter a number?

how do I let user enter a number?Any method or proccess.Plz help.

On the command line you can use:
BufferedReader in = new BufferedReader(new InputStreadReader(System.in));
String line = in.readLine(); // characters so far
int number = Integer.parseInt(line);Notify that if the user enters something different from a number an exception in thrown. In that case you should possibly ask him again.
In swing applications of applets you would do it different.
regards
Sven
regards
Sven

Similar Messages

  • How do I let user enter a primary key value on a form

    I'm creating my first APEX application. I have a simple table called HOSTS with 2 columns HOSTNAME and IP_ADDRESS. HOSTNAME is the primary key for the table. HOSTNAME is a perfectly acceptable primary key and I don’t wish to create an additional column to be populated by a sequence.
    What are my options for creating a form on the table without using "Existing trigger", "Custom PL/SQL function" or "Existing Sequence" to populate the primary key column, i.e. HOSTNAME, so that the user can enter a value for the primary key?
    Any assistance greatly appreciated.
    Gavin

    The debate about natural keys versus surrogate keys
    will no doubt continue with advocates for both sides.
    However there is also a difference between
    'making your life easier' for APEX development and
    'making your life more difficult' by having to
    analyse, implement and deploy a surrogate key only
    approach to an existing database which employs both
    natural keys and surrogate keys.
    hould we be forced to change the database design
    because a development tool does not cater for natural
    primary keys?The application development product is TRYING to save you from shooting yourself in the foot. The idea is to separate the primary key from being accessed by the user or ANY carbon based unit.. The key is mainly used by the system to join and lookup data rows, not for people to change whenever they decide that the key is WRONG.
    Think about this, if you use Last Name as a key in your system (a bad idea to begin with since this is NOT a unique id when you have two Smiths). When a person needs to change this because Jimmy Smith is NOT the only Smith working for Acme Toys, you have to cascade that change through all the child tables related to the main person table.
    If instead you use a system generated key, no change will be required since the key has NO relation to the data other than it represents a pointer to that row of data.
    Works for me, since I do not want to write all the supporting code when APEX builds it for you...
    Thank you,
    Tony Miller
    UTMB/EHN

  • How to keep a calculation field blank until the user enters a number?

    I am building a sales sheet for a school that sells scrip as a fund-raiser. I have the document set so that when the user enters the number of scrip certificates he wants (say, two $25 gift certificates at Lowe's), the program will automatically calculate that this user owes $50 for that scrip category. However, there are more than 100 companies that one can choose from, and if the user doesn't enter a number, the calculated field shows $0. Is there a way that each field can stay blank until the user enters a number bigger than zero? By the way, I'm using this calculation to determine the value (borrowed from a user on this forum): event.value = 50 * this.getField("Lowes").value
    Thanks!

    There are two approaches. You can either add the following Validate script:
    // Custom Validate script for calculated field
    if (+event.value !== 0) event.value = "";
    Or you can change your custom Calculate script and set the Format type of the field to "None":
    // Custom Calculate script
    (function () {
        var v = +getField("Lowes").value;
        event.value = (v !== 0) ? util.printf("$%.2f", v) : "";

  • How to get the user entered data?

    Hi all,
    I have created an HTMLB DynPage component.
    In That i have created my input screen with textboxes using response.write method.
    i have added one onConfirm event on which the data whould validate.
    so onConfirm method im trying to get the data with request.getParameter method which returns null...
    how to do...how to get the user entered data to do my validations...can anyone plz advice.
    Thanks,
    Viswes

    Hi
    inputfield or textbox component entered directly using response.write(...) are not htmlb , but html.
    to create portal input field (ie HTMLB), you should do something like
    this in the doProcessBeforeOutput member function
    InputField field1 = new InputField("Id1");
    field1.setSize(8); // 8 characters
    this.getForm().addComponent(field1);
    and in doProcessAfterInput member function
    InputField field1 =
    (InputField) this.getComponentByName("Id1");
    you can then manipulate the content of the field.
    Hope this help,
    Guillaume

  • How to differentiate whether user entered '0' or no value in the parameter?

    I need some clarification.On my selection screen I have 4 parameters( P_QTYLL,P_QTYUL,P_AMTLL,P_AMTUL). I have to check the values entered by the user in those fields and I have to display the user entered values in the next screen.My problem is if the user enters '0'(in any of the above fields) means '0' has to displayed in the next screen.But if he enters nothing means then nothing has to be displayed in the next screen.My problem is I am checking for '0', against the values(initial,'',space,0) for user entered value.But I am unable to differentiate the '0' and nothing(no value) even though I checked against the values(initial,'',space,'0').All the 4 conditions are treating both the '0' and 'novalue' the same.How to differentiate whether user entered '0' or entered nothing(no value).
    for example below is my code
    IF P_QTYLL EQ 0.
    P_QTY_LL = P_QTYLL.
    ENDIF.
    IF P_QTYUL EQ 0.
    P_QTY_UL = P_QTYUL.
    ENDIF.
    IF P_AMTLL EQ 0.
    P_AMTLL_S = 0.
    ENDIF.
    IF P_AMTUL EQ 0.
    P_AMTUL_S = 0.
    ENDIF.
    IF P_QTYLL EQ ''.
    P_QTY_LL = ' '.
    ENDIF.
    IF P_QTYUL EQ ' '.
    P_QTY_UL = ' '.
    ENDIF.
    IF P_AMTLL EQ ' '.
    P_AMTLL_S = ' '.
    ENDIF.
    IF P_AMTUL EQ ' '.
    P_AMTUL_S = ' '.
    ENDIF.
    LIKE THE ABOVE I checked against the values space,initial.But using those I am not getting any difference for no value and '0' .All the four values(space,initial,'0','') are treating both the '0' and no value in the same way.
    Thanks,
    Balaji

    hi,
    you said your teamlead doesn't want the type to be changed to 'C'.so try adding one dummy variable  of type c and pass your parameters value to this dummy variable and check  dummy variable for value '0'.
    eg:
    Data DUMMY(11) type c.
    DUMMY = P_QTYLL.
    IF DUMMY EQ 0.
    P_QTY_LL = P_QTYLL.
    ENDIF.
    DUMMY = P_QTYUL
    IF DUMMY EQ 0.
    P_QTY_UL = P_QTYUL.
    ENDIF.
    i think this will help you 2 some extend.

  • How do a let users add a link in a submission, similar to attaching a file?

    how do a let users add a link in a submission, similar to attaching a file?
    I want teachers who want to list a link to a website, be able to insert a link. how?

    would it be a good idea to send a shortcut to desktop from explorer, and then upload that as a file attachment? will that work for most people?

  • How do I make form or table where certain numbers update according to a formula when the user enters one number?

    Hi, I am an amature website designer and have made a website
    using dreamweaver. I am very lost when it comes to doing tougher
    things in dreamweaver. I want to create a small form or a table
    where there will be 7 or so numbers that are generated based on
    simple formulas for each one once you enter one number. Can someone
    please help me with this task whether it is in dreamweaver or even
    making it out of flash or anyway that this would be the easiest to
    make possible. Thanks

    Here's a very simple form you could use to perform a
    calculation, it this case, squares the input value and writes it
    back to another input field... Hopefully you can use this as a
    pattern to apply your own algorithm. You'll need to do validation
    to assure the entered fields are appropriate for the calculation
    (required fields are entered).
    Hope this gets you started.
    ================================================
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta content="text/html; charset=utf-8"
    http-equiv="Content-Type" />
    <script type="text/javascript">
    function squareit() {
    var num = document.getElementById('myinput');
    var res = document.getElementById('myresults');
    res.value = Math.pow(parseFloat(num.value), 2);
    </script>
    </head>
    <body>
    <form id="myform">
    <label for="myinput">Number: </label><input
    id="myinput"><br/>
    <label for="myresults">Result: </label><input
    id="myresults"><br/>
    <input type="button" value="Calculate"
    onclick="squareit()"/>
    </form>
    </body>
    </html>

  • How to find the user entered value is Integer or not?

    hi,
    i want to find, whether the user entered value is Integer or not. If it is Integer, i wanna continue the program. otherwise send an error message. i tried to find for function in API. But i couldn't. can somebody help me with sample code. very urgent.

    Do a Integer.parseInt(<string value>) in a try catch block If a NumberFormatException is thrown, the entered number is not an integer.

  • How to get the User entered value in the Submit request form for a parameter of a concurrent program in Oracle applications.

    Hi All,
    I have a requirement where i need to get the user entered value in the Parameter of a concurrent program while submitting it. i tried to query the FND_CONCURRENT_REQUESTS table but in that it stores the ID values from the value set of the Parameter.
    After submitting the Concurrent request when we click on the view Details button it opens a form where it displays the arguments in the parameter field .  i want to get that string.
    Thanks a lot in advance for your time and help.
    - Vijay

    Hi All,
    I have a requirement where i need to get the user entered value in the Parameter of a concurrent program while submitting it. i tried to query the FND_CONCURRENT_REQUESTS table but in that it stores the ID values from the value set of the Parameter.
    After submitting the Concurrent request when we click on the view Details button it opens a form where it displays the arguments in the parameter field .  i want to get that string.
    Thanks a lot in advance for your time and help.
    - Vijay

  • How to get the user entered  header text on a delivery

    Hi All,
    I am looking for a internal table which holds the user entered text in header text of the delivery. I was able to find header data in XTHEAD table. But actual lines(entered text)  in which structure it holds. I checked TLINETAB but its empty.
    My requirement is to check the user enterd text to validate at userexi_save .
    Any help will be appreciated
    Thanks
    Sai.

    Hi all,
    Thanks for ur replies.
    I already tried READ_TEXT. but its not giving the current value.
    check the following code:
            CLEAR lv_valid.
            READ TABLE catalog
                  INTO ls_catalog
                  WITH KEY tdobject = c_vbbk1
                             tdname = likp-vbeln
                               tdid = c_z043.
            IF sy-subrc = 0.
              CHECK ls_catalog-function NE 'D'.
              CALL FUNCTION 'READ_TEXT'
                EXPORTING
                  id                      = ls_catalog-tdid
                  language                = ls_catalog-tdspras
                  name                    = ls_catalog-tdname
                  object                  = ls_catalog-tdobject
                TABLES
                  lines                   = lt_tline
                EXCEPTIONS
                  id                      = 1
                  language                = 2
                  name                    = 3
                  not_found               = 4
                  object                  = 5
                  reference_check         = 6
                  wrong_access_to_archive = 7
                  OTHERS                  = 8.
              IF sy-subrc = 0.
                CLEAR lv_valid.
                READ TABLE lt_tline INTO ls_tline INDEX 1.
                CALL METHOD z2cl_utilities=>is_valid_text
                  EXPORTING
                    p_text  = ls_tline-tdline
                  IMPORTING
                    p_text1 = lv_text1
                    p_text2 = lv_text2
                    p_valid = lv_valid.
                IF lv_valid IS  INITIAL.
                  MESSAGE e504(z2vl) WITH lv_text1 lv_text2.
                ENDIF.

  • How can i control user to input number to the JTextField only?

    i want to control user to input the number only in the JTextField
    how can i do it?

    Add an actionListener to the textfield and then when someone enters a key into the textfield check and see if it is a number, if it is not send an alarm and remove it.

  • File upload....How to find the user entered any file or not

    Hi Team,
    I am working on with file upload UI.
    Some times without clicking on browse button, I mean without entering any file they are cliking on upload button, which is giving the exception.
    I know there is no action for UI element, Then how to resolve this?
    I just control the user, not to press the upload button without entering any file name there?
    How to resolve this?
    regards,
    Bala

    Hi,
    This code will solve ur problem.
    public void onActionUploadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUploadFile(ServerEvent)
        IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateFileUploadDownloadView.IContextElement.FILE_RESOURCE);
        IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType)attributeInfo.getModifiableSimpleType();
        IPrivateFileUploadDownloadView.IContextElement element = wdContext.currentContextElement();
        if(element.getFileResource() !=null)
             try
                  String mimeType = binaryType.getMimeType().toString();
                  byte[] file = element.getFileResource();
                  //element.s
                  wdComponentAPI.getMessageManager().reportMessage(IMessageFileUploadDownloadComp.SF__UPLOAD,new Object[] {binaryType.getFileName()},false);
             catch(Exception e)
                  throw new WDRuntimeException(e);
        else
              wdComponentAPI.getMessageManager().reportMessage(IMessageFileUploadDownloadComp.NO__FILE,new Object[] {" "},true);
        //@@end
    Here "fileresource" is context attribute name
    Regards,
    Sunaina Reddy T

  • How do i let users modify patch lists?

    I'm designing an application in which the user needs to create and modify patches. I would like the interface to have a list of user patches, followed by sliders an textual input boxes to modify parameters. I am aware that i could easily put together the interface with Core Data, however, i don't need a lot of the data management features of Core Data, and would like a simpler way to create mutable lists. Can someone please explain how I could do this?

    Can NSDictionary hold multiple values for one key, or do i create multiple dictionaries with the same keys? I am still not very familiar with the NSKeyedArchiver and it's subclasses.

  • Is it possible to let user restrict the number of the records in OVS?

    is it pissible ?
    For example a user can input 500 record .....
    Then when we search and we can get the value set by the user '500' so we can restrict our record in our application.
    Best regards,
    Anders

    Dear Anders,
    u can have an i/p field (say var) for the user where he can specify the no. of records and u can use the following logic.
    TYPES: BEGIN OF ST_BOQ,
              ITEMNO       TYPE ZITEMNO,
              MATNR        TYPE MATNR,
              MAKTX_P      TYPE ZPOTEXT,
               SRNO         TYPE ZSERIALNO,
           END OF ST_BOQ.
    DATA: IT_BOQ TYPE TABLE OF ST_BOQ,
          WA_BOQ LIKE LINE  OF IT_BOQ.
    data: var1 type i.
    var1 = 10.
            SELECT * FROM ZBOQ_ITEM UP TO var1 rows INTO CORRESPONDING FIELDS OF TABLE IT_BOQ .
    Regards
    Sajid

  • How can I create User Entered Additional Data Points in Credit Management?

    I currently have a requirement to create additional data points in Credit Management (11i) that require a data analyst to input the value so that the score can be calculated.
    For example: Does customer have a Qualified Audit Report?
    If YES = +10 points added to score
    If NO = 0 points added to score
    I was able to add an additional data point and the case folder was assigned to an analyst, however when opening the case folder to input the missing data, the additional datapoint was not included in the case folder. Does anyone know what I may have missed in the setup?
    Data Point was defined as follows and added to a checklist called TEST.
    Data point: Unqualified
    Category: (none)
    Parent: (none)
    Application: Receivables
    Scoreable: Y
    Enabled: Y
    PL/SQL Package: (none)
    Function: (none)
    Thanks in advance.
    Shauna
    Edited by: sphelps on Sep 22, 2011 8:29 AM

    The setup described above was correct. The datapoints did not show up in the case folder until the next day. I am assuming that maybe the changes required a bounce or a background process of some sort.

Maybe you are looking for

  • How do you make the date change for every entry when inserting.

    Hello, I am making a daily vehicle inspection report for my truck and I would like to make a 7 day calendar but I would like to insert the date ie Monday Feb 22, 2010, Tuesday Feb 23, 2010 etc...and have it change for each day of the week. is there a

  • Automator: Create folder with name and subfolders in it.

    Hello everyone, my question is related to Automator. I work in a company where we have a huge server. Every time a new job comes in it gets a six digits number and a folder with 5/6 subfolder needs to be created. The main folder will be xxxxxx_nameof

  • Problem about ExtensionFileFilter

    whats wrong with my code? please have a look at it. import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.util.zip.*; import javax.swing.*; import javax.swing.filechooser.FileFilter; public class ZipTest {     

  • Java-applet counter

    Hi there, I've created a java-applet that can be widely used so I encourage people to include the java applet into other sites by means of the <applet code="blah.class" codebase="http://www.blah.com/"></applet>I'm wondering however if it would be pos

  • Any Quality loss in FCE using H.264

    I have shot video using the new Canon SX30is with 720p. The files are H.264 (1280x720). I have put them directly into FCE and then rendered them. This took some time, but worked fine. My question is did I loose any quality be doing this? I saved it a