Reading in input from a user

I am waiting to read in few different user actions. One of them is if they hit the "enter key" and nothing else. How can you check if the enter key has been pressed?
In java and I am reading the input in through a BufferedReader

Will it? Maybe you are right. I was justguessing.
It does when I read an empty line from a text file...
so why not from System.in? :)I was thinking it would buffer the input. It would return until it hit whatever triggers it to return. So it would return an empty line but perhaps not right away. I guess I could just try it, huh?

Similar Messages

  • How do i get input from the user?

    For example if i wanted to ask "Whats your favorite number" and then get the input from the user and assign it to a variable how would i go about doing that?

    hi,
    if you want to get input from your console your should work with io(input and output).The BufferedReader class, InputStreamReader class
    you should import "java.io.BufferedReader" and "java.io.InputStreamReader" package, and do something like this:
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    String favoriteNumber;
    System.out.println("Whats your favorite number ");
    favoriteNumber = input.readLine();
    System.out.println ("Your favorite Number Is " + favoriteNumber);
    if its a gui you should import "javax.swing.JOptionPane" and do the following
    String favoriteNumber = JOptionPane.showInputDialog(null, "Enter your favorite Number", "Favorite Number", JOptionPane.INFORMATION_MESSAGE);
    anjiie([email protected]).

  • How to execute BAPIs by getting the input from the user through the browser

    Hi,
    I have created a simple xMII transaction using BAPI. It is a simple BAPI with one input. Now i want the transaction to be executed by getting the input from the user through browser. Once the user enters the value and clicks on a button, I want the result of the BAPI to be displayed in the grid. How to link the BAPI/transaction with applet/Javascript coding.
    Thanks.

    The first thing I would recommend would be for you to collaborate with your colleague Vinodh, since his/her recent thread is very similar to yours:  Calling a BAPI from web page
    In your case, the iGrid applet will run the Xacue query template and automatically display the results from your output parameter.
    I would encourage you to take a look at the sticky thread at the top of the forum entitled "MII Manufacturing Templates Updated" since this MII project is full of samples for you and your colleague to learn from.

  • Multiple inputs from a user using the same variable !

    Hi Folks,
    I am trying out the following code block,which should ask the users to enter 3 different names using '&' operator & assign it to a variable v_ename every time the loop executes.
    declare
    type ename_table_type is table of
    emp.ename%type
    index by binary_integer
    ename_table ename_table_type
    begin
    for i in 1..3 loop
    ename_table( i ):= '&v_ename';
    dbms_output.put_line(ename_table(i));
    end loop;
    end
    The above code accepts a single input from the user & assigns the same input 3 times to "ename_table".thus the output shows the same name 3 times.
    Is it possible that we can have the user input 3 different names & then print them using the concept of Index by binary_integer ?
    Please help
    Thanks
    Om

    Server side PL/SQL is NOT designed for this kind of user interaction.
    the "&" character is intrepreted by the SQL*Plus application and before the PL/SQL block is submitted to the DB by the SQL*Plus application, it replaces each appearance of the &variable with the value entered. Once the block gets to the database, all it sees is a constant value - no more a variable name.
    &variable_name is a SQL*Plus application thing, not the database.
    Where will this type of logic will be eventually used? What client application will interact with the server side PL/SQL? You need to code this input logic in that client application.

  • Using jsp to read a input from a radio button

    i am trying read a input from a radio button ,normly if the name of radio button is "priority" and if u referrence it as request.getParameter("priority") it shld work right but mine does not.
    <% rs = stmt.executeQuery("select PRIORITYNAME,PRIORITYDESC from TBL_PRIORITY ");
    <td>Priority</td>
    <% while(rs.next())
    %>
    <input name="priority" type="radio"><% out.println(rs.getString(1)); %><% out.println(rs.getString(2)); %><br>
    <%
    %>
    is it bcs i am using a loop !! bcs am populating the radio fields from a database

    i am trying read a input from a radio button ,normly
    if the name of radio button is "priority" and if u
    referrence it as request.getParameter("priority") it
    shld work right but mine does not.
    A couple of things not necessarily addressing your problem, but still..
    Avoid too much Java code in the JSP. Use existing tags or write new custom tags to do the task.
    Avoid database access form the JSP itself, if possible.
    <% rs = stmt.executeQuery("select
    PRIORITYNAME,PRIORITYDESC from TBL_PRIORITY ");
    <td>Priority</td>
    <% while(rs.next())
    %>
    <input name="priority" type="radio"><%
    out.println(rs.getString(1)); %><%
    out.println(rs.getString(2)); %><br>
    <%
    %>
    I'm not quite sure what are you trying to do with the above. You want the labels of the radio buttons to be obtained from the database as well as their values, is it?
    Does PRIORITYNAME correspond to the value of the radio button and PRIORITYDESC correspond to the label of the radio button?
    If that's the case, I think you need to do it as follows:
    Radio button is declared as follows in HTML
    <input name="priority" type="radio" value="<%rs.getString(1)"%>><%rs.getString(2)%></input>
    is it bcs i am using a loop !! bcs am populating the
    radio fields from a databaseNo

  • Read query string from End User Menu

    In our IdM application, I want to be able to read a variable passed in a query string.
    The string is part of the JSP page which takes the user back to the end user menu (user/main.jsp).
    Is there a way for the end user menu to read a value from a query string?
    Or can user/main.jsp be modified to pass the value from the query string to the end user menu?

    can you brief ur requirement?

  • Is LabView able to read digital inputs from maxon motors controller, EPOS2?

    Hello,
    I would like to ask that if LabView is able to read any digital inputs directly from a maxon motor controller, EPOS2. As i have tried making a new VI from the maxon example VI, but the difference is that i've added a input control. But the program doesn't seems to work.
    That's why i would like to ask if LabView can read a direct digital input from the maxon motor controller.
    Thank You & Regards,
    ParkyPak
    Attachments:
    sensor.vi ‏34 KB

    Hello Parky,
    I understand now. I check on the motion controller and it is connected through USB to your computer. In term of controlling the motion controller, you are using some LabVIEW library from maxon. The photosensor is connected to the motion controller may be as a switch or as a limit switch.
    In order to read the value of the Digital input port, you may need to take a look of the libraries to check on what function call and the supported command to check the digital input port. If this is not successful, then question or referring to examples from Maxon motors would be the best.
    I hope that this helps.
    James
    - Meadow -
    LabVIEW 7.0 - 2011, Vision, RT, FPGA
    TestStand 3.0 - 4.5

  • Event.rc and Restriction of inputs from the User...

    Im using Adobe Professional Live cycle designer 7.0 to design pdf form. Also, Im using an existing pdf (supplied by the customer), which is designed through teleform designer (with adobe 6.0) model for this design. In the existing one, the javascript methods are working fine for restricting keys, validation, etc. But these scripts are not working in designer as the designer is using XFA model.
    Im trying to restrict the key inputs (like only numbers/characters should be entered). But I couldnt find the equivalent statements for some of the statements (which are used in the teleform pdf).
    For eg.
    event.rc = true. Allows keystroke to be added to entry. event.rc = false. Prevents keystroke being added to entry in the following function:
    function TFTemplate_KeyStroke( mask )
    if (event.willCommit) {
    return;
    var value = AFMergeChange( event );
    if (!mask.test( value )) {
    event.rc = false;
    app.beep( 0 );
    But I couldnt find the matching statements in Designer for event.willCommit, AFMergeChange(),event.rc, etc.
    If I get, I can restrict the inputs.
    Expecting any solutions from you...
    Thanks in Advance...

    Hi,
    Based on your description, I understand that you want to use application or some functional tools and then
    monitor the user printer job. When be greater than a certain number, it will need to acquire additional information. As I know, it seems that there is no such function can meet your requirement. Sorry for it.
    In addition, I find that you use a third-party software for this functionality before. Please check and confirm
    if you can get a new version (or some updates, service package) that may help it to be supported in Windows Server 2012.
    Hope this helps.
    Best regards,
    Justin Gu

  • Reading dilimited input from a text file with tokenizer

    i am trying to read in a text file with the following structure: 2 integers on each line with comma as the delimitor.
    i am using the BufferedReader stream and Tokenizer to detect ",".
    try {
    BufferedReader in = new BufferedReader(new FileReader(filename));
    //read in the data file
    while ((s = in.readLine())!= null) {
    int i = 0;
    for (i = 0; i < 100; i++) {
    t = new StringTokenizer(s,",");
    A1 = Integer.parseInt(t.nextToken());
    catch (IOException e) {System.err.println(e);}
    When i print out A1[i], it only reads the last line of the text file. Please tell me what's wrong.
    Also i'd really like A1[i] to store the integer before the comma and another array A2[i] to store the integer after the comma. Please help.
    Thanks.
    p.s. A1 and A2 are arrays...when i previewd message in Netscape 7 it left out the brackets and the index....

    What is the for i loop for? If it is to read the next line from the file, then the while loop has taken care of it. Other than this there should be no problem with the rest of the code.
    Just add another line to store the next token into A2.

  • How do I save input from a user into a html file?

    Sure could use a couple of pointers here, I am a newbie to jsp's. I am trying to create an html file with meta tag keywords and description for search indexing purposes, the idea is to have the user call a jsp page and enter the desired meta tags in a form then save this info in html format so the Spider can index it at a later time. Not sure of the most efficient way to do this. Any help/ideas would be greatly appreciated. Thanks in advance.

    Hi,
    I would like to take Meta keywords and descriptions from a form entered by the user and generate an html page with the keywords and descriptions in the proper tags. This html page must be saved on the server so our Spider can index it. The idea is to increase the results for a webpage by indexing an html page with proper meta tags defined and redirect the searcher to the desired page. I'm not sure how to create an html file to be saved on the server, not displayed in the originating browser. Thanks

  • Capture CLI input from another user

    Is it possible to capture commands entered on a router by another user?  What device can I use to monitor my routers everyday and check the logs to see what changes have been made?

    Hi, If TACACS authentication is working try adding these commands to your router:
    aaa accounting commands 1 default start-stop group tacacs+
    aaa accounting commands 15 default start-stop group tacacs+
    Then check your TACACS server after you have made some config changes.

  • Reading user input from a form within a workflow and perform actions in workflow based on the input

    Sharepoint 2013
    Need to get input from a user based on some condition within a workflow and based on the input received continue with the workflow. It can be a form with a text box and button to which i can redirect and when user enters a value and clicks on the button
    ,I should come back to the workflow and perform other processing. I should also be able to manually start this workflow from VS.
    Tried different approaches like initiation forms ,user input action of SP2010 etc all of these approaches either add some tasks to task list or force me to click on the workflow link to get input from a user.
    Any suggestions on this?

    Hello
    Thanks for the code, but I don't need an array of beans. By the way this code make a bean and an arraylist everytime it's called?
    I was looking for something like this:
    <form action="myjsp.jsp" method="post">
    ...so after submitting the result will go to the myjsp.jsp file and in the myjsp.jsp file
    <jsp:useBean id="value" class"myBean">
    <jsp:setpropertiy name"value" ....>so everytime I click the add button the values will go the mysjp.jsp file and that will set them in the javabean file. this method uses two files but I was looking for doing this in the same jsp file and not sending it to another file.
    chers
    Ehsan

  • Need help with ouput of a list or array of numbers input from user

    I'm only a few weeks into learning java, so this may seem simple to some, but...
    I am trying to write a program that will receive numbers from a user,
    and then list, add, average those numbers. I've got the program to
    work except for listing the numbers that were input.
    Can someone help guide me????
    i've left the code I've tried in as comments.
    Enter an integer value, the program exits if the input is 0:
    20
    Enter an integer value, the program exits if the input is 0:
    40
    Enter an integer value, the program exits if the input is 0:
    60
    Enter an integer value, the program exits if the input is 0:
    80
    Enter an integer value, the program exits if the input is 0:
    0
    Total numbers entered: 4
    The array of numbers is: 0 0 0 0
    The sum is 200
    The average is 50
    The maximum number is 0
    The minimum is 0
    Here is my code:
    * Title:        Reads integers and finds the total, average, maximum of the input values
    * Description:
    * Copyright:    Copyright (c) 2002
    * Company:      Duke Court.
    * @author Mary Davenport
    * @version 1.0
    public class part3page6
      public static void main(String[] args)
      int data = 0;
      int sum = 0;
      int countnum = -1;
      int maximum = 0;
      int minimum = 0;
      int average = (countnum - 1);
      do
          System.out.println("Enter an integer value, " +
            " the program exits if the input is 0:  ");
          data = MyInput.readInt();
          sum += data;
          countnum++;
        } while (data != 0);
          //in order to figure the max & the min it appears that the
        //program will need to utilize arrays to store the individual numbers
        //that are input from the user.
        //create an array of the input data
        int[] number = new int[countnum];
        //creat a list of the input data
        int []myList = {data};
        //lists how many numbers entered
        System.out.println("Total numbers entered:  " + number.length);
        //list array of numbers -- this is giving me [I@3179c3,
        //instead of 20, 40, 60, 80 when I use "new int[countnum]"
    //     System.out.print("The array of numbers is: "
    //      + new int[countnum]);
        //list array of numbers:  this is giving me " 0 0 0 0 "
           //instead of 20, 40, 60, 80  with the following for statement
           // (number[i] + " ")
        System.out.print("The array of numbers is: ");
          for(int i=0; i<number.length; i++)
            System.out.print(number[i] + "  ");
      //list mylist of numbers from input, 20, 40, 60, 80
      //output is The list of numbers is: [I@3179c3
    //  System.out.print("The list of numbers is: " + myList);
        System.out.println();
        System.out.println("The sum is " +  sum);
        average = sum/countnum;
        System.out.println("The average is " + average);
        System.out.println("The maximum number is " +  maximum);
        System.out.println("The minimum is " +  minimum);

    When you input the data you need to save it to the array. Currently you are not saving the value you are just adding it
    ArrayList nums = new ArrayList();
       do
           System.out.println("Enter an integer value, " +
             " the program exits if the input is 0:  ");
           data = MyInput.readInt();
    nums.add(new Integer(data));
           sum += data;
           countnum++;
         } while (data != 0);

  • How do i get input from user?

    For example if i wanted to ask "Whats your favorite number" and then get the input from the user and assign it to a variable how would i go about doing that?
    Any help would appreciated

    hope this helps
    import java.io.*;
    public static void main(String[] args)
      //this is the important part
      BufferedReader in = new BufferedReader( new InputStreamReader(System.in) );
      String response = "";
      System.out.println("What is your favorite color?");
      try{
           //now read the line
           response = in.readLine();
      }catch(Exception e){
            //enter error code here
      System.out.println("I like " +response+ " as well!");
    }

  • Apex_Collection Adding member via input from user

    Good day to all, I have this code how do I add member based on an input from a user via a textfield? I can just add one member only because when i select the collection it retrieves only one data, I want it to add more data based on the user if he enters 5 values I must retrieve 5 values also when I select it. How will I do that? thanks in advance.
    DECLARE
    v_arr apex_application_global.vc_arr2;
    BEGIN
    v_arr := apex_util.string_to_table(:P1_DEPTNO);
    apex_collection.create_or_truncate_collection(p_collection_name => 'PCOL');
    FOR i IN 1 .. v_arr.count
    LOOP
    apex_collection.add_member(p_collection_name => 'PCOL', p_c001 => v_arr(i));
    END LOOP;
    END;Edited by: mang jose on Jan 12, 2011 6:21 PM

    Hi Jose,
    There are only two steps needed. On my page, my page item is P4_DEPTNO (so adjust this for your page):
    1 - Create a process on your page that runs "On Load - Before Header". The process code should be:
    BEGIN
    IF NOT APEX_COLLECTION.COLLECTION_EXISTS('PCOL') THEN
      APEX_COLLECTION.CREATE_COLLECTION('PCOL');
    END IF;
    END;This creates the PCOL collection if it does not exist, otherwise does nothing if it does exist
    2 - Create another process on your page that runs "On Submit - After Computations and Validations". The code for this should be:
    BEGIN
    APEX_COLLECTION.ADD_MEMBER('PCOL', :P4_DEPTNO);
    END;I have set this process to be triggered by my button (P4_ADD_BUTTON in this example) but I have also set it to be conditional on P4_DEPTNO being NOT NULL - so, I have selected "Value of Item in Expression 1 is NOT NULL" and have entered P4_DEPTNO into Expression 1.
    And that is all you should need to do!
    Andy

Maybe you are looking for

  • Difference between web server and presentation service

    Hi, Can anyone please help me in getting the answer following query: What is difference between the presentation service and a web server? OR If we have a presentation service then why do we require a web server? Thanks & Regards, Satej

  • Issuance (pack size) Qty and Minimum Lot Size

    Hi Experts, I have a problem, I have to maintain Minimum Lot Size and issuance (pack size) in the material master. Suppose Minimum Lot size of one material is 2000 and Pack size vendor provides is 400. Means, when we place order, minimum order can be

  • Why are presets being applied to my photos?

    When I used to import my photos into LR5, I could click develop and go through and make any changes I wanted to enhance the photo.  Now any photo that comes in seems to have all the features of developing already chosen and it is really messing up my

  • Can't watch purchased content on Apple TV-?

    Hi there, I am an American living in Saudi Arabia. I have purchased my Apple TV from the United States when I was there last and it is the 2nd generation. I have updated the software to 5.1.1. I have a few accounts on my Apple TV, but I am unable to

  • Ical Helper grabbing all CPU

    After a migration from a MacBook with Mac OS Lion to a new MacBook Pro, iCal Helper is grabbing almost all the cpu. IF , making the use of the computer nearly impossible. After I quit iCal Helper through Activity Monitor, the system works fine. So fa