How to get input values till pressing enter key

hi!!!
i need to enter values thru keyboard using bufer reader etc etc
but i need to stop entering when i press enter key
how to do this??

First off I would take a look at this link because it gives quite a few good examples if you've never used scanner.
You can find all this on the link.-> http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html
in order to use scanner you have to import it.
import java.util.Scanner;then inside your main method you need to create a scanner wrapped around the keyboard inputstream.
Scanner userIn = new Scanner(System.in);take a look at the api to decide which method you want. For this I would suggest nextLine().
also I would specify that you want the numbers separated by spaces or comma's or something so you can use the String.split(" "); method which returns an array of Strings;
then traverse through the array of strings and convert them to ints
http://www.rgagnon.com/javadetails/java-0004.html

Similar Messages

  • How to submit a form by pressing enter key

    Hi,
    I'm having a problem..............i have a form having text field and a button created using struts html tags..........when user enters the value and presses the button then the value is being taken...........
    but if the user enters the data and just presses enter key the form refreshaes but value is not submitted.............
    the button is created using <html:submit >tag.............can any one pls help me out with this???????????

    <script language="JavaScript">
    <!--
    var isNav, isIE
    if (parseInt(navigator.appVersion) >= 4) {
    if (navigator.appName == "Netscape")
    isNav = true
    else
    isIE = true
    function showKeyValue(evt) {
    var keyValue
    if (isNav)
    keyValue = evt.which
    else
    keyValue = window.event.keyCode
    /*status = keyValue*/
    if (keyValue == 13) {
    javascript:validateForm();
    return false
    </script>
    in the field call this method
    onKeyPress="showKeyValue(event)"

  • How to get input value from a HTML form?

    Hi,
    I use URL class to connect to a simple HTML file. In the returned page there is a form with hidden input with default value. How can I get the values?
    Thanx.

    By parsing the HTML.

  • How to get a Value based on Foreign Key item

    Hi,
    I have two tables as below
    TABLE 1
    T1_COL1 NUMBER ---primary_key
    T1_COL2 NUMBER ---foreign_key to TABLE2.T2_COL1
    TABLE 2
    T2_COL1 NUMBER ---primary_key
    T2_COL2 VARCHAR2(40)
    Table 2 is my reference table. I have created a form for table 1, however I want to show user the value of T2_COL2 all the time . My user is not interested in seeing primary key value data.
    Can some please advise what is the best way to do this in APEX.
    Thanks
    Aali
    Edited by: aalishan on 31-Jul-2009 10:40

    Hello:
    One way to do what you want done is to
    1) On the form make the page-item corresponding to T1_COL2 a hidden item
    2) Create a new page-item of type Display Only.
    3) Set the Source Type for this item to be 'Sql Query'
    4) In the Source Value or Expression enter the query select T1_COL2 from table_2 where t2_col1=:pxx_t1_col2Varad

  • How to get inputted value in a RTE field on custom page and submit by REST call in 'Sharepoint hosted app'.

    Hi I am facing the three questions below.
    1. How to use default RTE in custom page in Sharepoint hosted app.
     I saw the article of Rich text Editor (ribbon based) in a webpart in SharePoint 2013 and tried it. But it did not work well. I guess it needs code-behind setting, however sharepoint hosted app does not support code-behind.
    Does anybody know how to do this?
    2. In above case, I placed the below code on custom page and tried to get the field's value when submit button was clicked.
    <SharePoint:InputFormTextBox ID="rftDefaultValue"
    RichText="true"
    RichTextMode="FullHtml" runat="server"
    TextMode="MultiLine" Rows="5">
    </SharePoint:InputFormTextBox>
    In debugger, the returned value was 'undefined'.
    var note = $('#hogehoge').val();
    Is it possible to get the RTE value? If yes, please let me know how to do this.
    3. I need to submit the RTE value using REST call.
    In this
    article in MSDN, the item creation sample treats single line text field. Does anybody know the sample for RTE?

    Hi,
    According to your description, you might want to use Rich Text Editor control in your SharePoint hosted app.
    First of all, I would suggest you post one question in one thread to make it easier to be discussed, which would also help you get a quick solution.
    Though we can add this control into a SharePoint hosted app, however, as we can’t add code behind for it, plus with the potential compatibility issues in different
    browsers, I would suggest you use other JavaScript Rich Text Editor plugins instead.
    Two JavaScript Rich Text Editor plugins for your reference:
    http://quilljs.com/
    http://nicedit.com/
    If you want to submit the value of Rich Text Editor control to a SharePoint list using REST call, since the content in the Multiple Line of Text column is wrapped
    with nested HTML tags, the similar requirement would also be applied to the content to be submitted.
    Here is a code snippet about how to update a Multiple Line of Text column for your reference:
    updateListItem(_spPageContextInfo.webAbsoluteUrl, "List018", 1);
    function updateListItem(siteUrl, listName, itemId)
    var itemType = GetItemTypeForListName(listName);
    var item = {
    "__metadata": { "type": itemType },
    "MultiTextEnhanced": "<div><a href='http://bing.com/'>Bing</a><br></p></div>",
    "Title": "123"
    $.ajax({
    url: siteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items(" + itemId + ")",
    method: "GET",
    headers: { "Accept": "application/json; odata=verbose" },
    success: function (data) {
    console.log(data);
    $.ajax({
    url: data.d.__metadata.uri,
    type: "POST",
    contentType: "application/json;odata=verbose",
    data: JSON.stringify(item),
    headers: {
    "Accept": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val(),
    "X-HTTP-Method": "MERGE",
    "If-Match": data.d.__metadata.etag
    success: function (data) {
    console.log(data);
    error: function (data) {
    console.log(data);
    error: function (data) {
    console.log(data);
    // Getting the item type for the list
    function GetItemTypeForListName(name)
    return"SP.Data." + name.charAt(0).toUpperCase() + name.slice(1) + "ListItem";
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Patrick Liang
    TechNet Community Support

  • How to get parameter value from report in event of value-request?

    Hi everyone,
    The customer want to use particular F4 help on report, but some input value before press enter key are not used in event of "at selection-screen on value-request for xxx", How to get parameter value in this event?
    many thanks!
    Jack

    You probably want to look at function module DYNP_VALUES_READ to allow you to read the values of the other screen fields during the F4 event... below is a simple demo of this - when you press F4 the value from the p_field is read and returned in the p_desc field.
    Jonathan
    report zlocal_jc_sdn_f4_value_read.
    parameters:
      p_field(10)           type c obligatory,  "field with F4
      p_desc(40)            type c lower case.
    at selection-screen output.
      perform lock_p_desc_field.
    at selection-screen on value-request for p_field.
      perform f4_field.
    *&      Form  f4_field
    form f4_field.
    *" Quick demo custom pick list...
      data:
        l_desc             like p_desc,
        l_dyname           like d020s-prog,
        l_dynumb           like d020s-dnum,
        ls_dynpfields      like dynpread,
        lt_dynpfields      like dynpread occurs 10.
      l_dynumb = sy-dynnr.
      l_dyname = sy-repid.
    *" Read screen value of P_FIELD
      ls_dynpfields-fieldname  = 'P_FIELD'.
      append ls_dynpfields to lt_dynpfields.
      call function 'DYNP_VALUES_READ'
        exporting
          dyname     = l_dyname
          dynumb     = l_dynumb
        tables
          dynpfields = lt_dynpfields
        exceptions
          others     = 1.
      check sy-subrc is initial.
    *" See what user typed in P_FIELD:
      read table lt_dynpfields into ls_dynpfields
        with key fieldname = 'P_FIELD'.
    *" normally you would then build your own search list
    *" based on value of P_FIELD and call F4IF_INT_TABLE_VALUE_REQUEST
    *" but this is just a demo of writing back to the screen...
    *" so just put the value from p_field into P_DESC plus some text...
      concatenate 'This is a description for' ls_dynpfields-fieldvalue
        into l_desc separated by space.
    *" Pop a variable value back into screen
      clear: ls_dynpfields.
      ls_dynpfields-fieldname  = 'P_DESC'.
      ls_dynpfields-fieldvalue = l_desc.
      append ls_dynpfields to lt_dynpfields.
      call function 'DYNP_VALUES_UPDATE'
        exporting
          dyname     = l_dyname
          dynumb     = l_dynumb
        tables
          dynpfields = lt_dynpfields
        exceptions
          others     = 0.
    endform.                                                    "f4_field
    *&      Form  lock_p_desc_field
    form lock_p_desc_field.
    *" Make P_DESC into a display field
      loop at screen.
        if screen-name = 'P_DESC'.
          screen-input = '0'.
          modify screen.
          exit.
        endif.
      endloop.
    endform.                    "lock_p_desc_field

  • How to get the value entered in input enabled field of a list output?

    Hi all,
    I am developing a program to display  list with two input enabled fields . After users enetered the values into these fields I need to do some calculations based on these values and modify the value of another field in the list.
    But i couldn't have an idea how to read the values after users enter into these fields.
    Please help me on solving this problem?  If possible please provide the sample code.
    Thanks,
    Aravind.

    You can enable disable screen fields in at selection screen output event.
    And by using loop at screen.
    And for changing the values you can do in initialization event.
    I Hope you are doing these in Reports.

  • How to get the value from the Input field of the Table view.

    Hi Experts,
    I have created a table view with 10 rows and each rows contains input fields in it.Can you please help me getting the values that are entered in all 10 rows.
    Currently I am using the below code,but using the below I am able to get only the first row details of the table.
      lo_el_table->get_static_attributes(
        IMPORTING
          static_attributes = ls_table).
    Please let me know you suggestions on this.Thanks in advance.
    Regards,
    Arun

    Hi Arun,
    You should use this method:
    lo_nd_table->get_static_attributes_table(
    IMPORTING
    table = lt_table).
    Cheers,
    Roelof
    http://www.nl4b.com

  • How to get Input-Ready Cell  Value of Input Ready Query?

    Hi,
    How to get input ready cell value in fox formula?
    for example :
    In Input-Ready Query,
    C_Code Month        Psale(input ready)
    1000          05.2012       800
    now i want Psale 800 in fox formua before value save in cube,
    is it possible?
    Thanks
    Ravi

    Hi,
    as I understand your requirement: you want to execute a planning function before 'save'. This possible, cf. note 1356805
    for more details.
    Regards,
    Gregor

  • How to get the values from popup window to mainwindow

    HI all,
       I want to get the details from popup window.
          i have three input fields and one search button in my main window. when i click search button it should display popup window.whenever i click on selected row of the popup window table ,values should be visible in my main window input fields.(normal tables)
       now i am able to display popup window with values.How to get the values from popup window now.
       I can anybody explain me clearly.
    Thanks&Regards
    kranthi

    Hi Kranthi,
    Every webdynpro component has a global controller called the component controller which is visible to all other controllers within the component.So whenever you want to share some data in between 2 different views you can just make it a point to use the component controller's context for the same. For your requirement (within your popups view context) you will have have to copy the component controllers context to your view. You then will have to (programmatically) fill this context with your desired data in this popup view. You can then be able to read this context from whichever view you want. I hope that this would have made it clear for you. Am also giving you an [example|http://****************/Tutorials/WebDynproABAP/Modalbox/page1.htm] which you can go through which would give you a perfect understanding of all this. In this example the user has an input field in the main view. The user enters a customer number & presses on a pushbutton. The corresponding sales orders are then displayed in a popup window for the user. The user can then select any sales order & press on a button in the popup. These values would then get copied to the table in the main view.
    Regards,
    Uday

  • How to get default values while using the transaction "BP"

    Hi Group,
    I have a query on how to get default values while using the transaction <b>BP</b>?
    The thing is:
    when I enter into the transaction "BP", I need to see some default values to some of the input fields in the screen.
    how can I achieve this?
    So please kindly let me know the procedure to achieve this.
    Thanks & Regards,
    Vishnu.

    Hi,
    The events of BDT can be used to default some fields on creating a partner.
    For this create a function module for ISDAT. attach that event in BUS7.
    In the ISDAT funtion modulethe following code should be used.
    For example to set the nationality:
    I_BUSDEFAULT-NATIO = 'DE.
    CALL FUNCTION 'BUP_BUPA_FIELDVALUES_SET'
    EXPORTING
    i_busdefault = I_BUSDEFAULT
    Regards, Smita.

  • How to get return values from task flow in af:region ?

    Hi!
    I'm working with a taskFlow that is rendered inside a popup using the "popup inside a region pattern" (http://www.oracle.com/technology/products/adf/patterns/popupregionpattern.pdf), but now this taskFlow has an input parameter and a return value definition. So the question is how to get a value returned by this taskFlow thas is called inside a region?
    Any suggestion?
    Thanks in advance!

    Hi,
    write the value to a shared memory scope like session and read it in the regionNavigation listener. If you follow the paper you refer to then the listener determines of the viewId is null, this a return happens. It wuld then look in the memory scope for the return value.
    Another option would be to use an object that you pass as an argument to the task flow you open in the popup. Then you change the object you passed in, which then makes the return information available in teh calling flow. The object you pass in would have to be in a shared scope too
    Frank

  • How to get the values of 2 dynamic comboboxes in one jsp to another jsp?

    I have 2 comboboxes and one submit button on my jsp page.I select a value in 1st combobox then the values in the second combobox populated from the database. next i select 2nd combobox and then submit the button.After submit the button call the next jsp page. In that page i want to display the values of two comboboxes. but my problem is , in that page only 2nd combobox value is displayed.1st combobox is displayed as null. plz tell me, how to get the values of two comboboxes at a time?
    Select.jsp:
    <%@ page language="java" import="java.sql.*" %>
    <%!
         Connection con = null;
         Statement  st  = null;
         ResultSet  rs  = null;
         String     sql = null;
         void addItems(javax.servlet.jsp.JspWriter out, String sql)
           try{     
              rs = st.executeQuery(sql);
              while( rs.next() )
                   out.println("<option>" + rs.getString(1) + "</option>");               
         }catch(Exception e)
                   System.out.println(e);
    %>
    <HTML>
    <HEAD>
    <TITLE>JSP WITH  MULTIPLE FORMS</TITLE>
    <script language="javascript">
              function checking()
                        form1.submit();
         </script>
    </HEAD>
         <body>
             <center>
             <b><font size="5" color="#333399">Staff ID:</font></b></center>
                     <FORM NAME="form1" METHOD="POST" ACTION="Select.jsp">
                         <p align=center>
                         Details of Staff :  
                       <SELECT 1 NAME="type" onchange="checking();">
                                    <option> Administrator </option>
                              <option> OfficeAssistent </option>
                              <option> Clerk </option>
                                  </SELECT 1>
                          </p>
    </FORM>
                      <FORM NAME="form2" METHOD="POST" action="welcome1.jsp">
                      <center>
                          <TABLE><TR><TD>Staff ID:</TD>
                                 <TD><SELECT 2 NAME="staff_id">
                    <%    
            String type = request.getParameter("type");
            try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            con = DriverManager.getConnection("jdbc:odbc:java","system","manager");
            catch (ClassNotFoundException ex) {
                   System.out.println(ex);
            catch (SQLException ex)
                System.out.println(ex);
         st  = con.createStatement();
         sql = "select staff_id from "+type+"";
         addItems(out, sql);
    %>
              </SELECT 2>
           </TD>
         </TR>
    </table></center>
    <h2> Details of <%= type + "s" %> </h2>
                         <center><input type=submit value=ok onclick="submit();"></center>
                  </FORM>
         </BODY>
    </HTML>
    welcome1.jsp
    <center><h1>WEL COME</h1></center>
    <%    
            String type = request.getParameter("type");
            String sid = request.getParameter("staff_id");
    %>
    <h2> Details of <%= type + "s" %> </h2>
    <h2> Details of <%= sid %> </h2>

    <SELECT 1 NAME="type" onchange="checking();">
                                    <option value = "0"> Administrator </option>
                              <option value = "1"> OfficeAssistent </option>
                              <option value = "2"> Clerk </option>
                                  </SELECT 1>

  • How to get the values of Select-options from the screen.

    The value of parameter can be obtained by function module 'DYNP_VALUES_READ' but How to get the values of Select-options from the screen? I want the F4 help values of select-options B depending on the values in Select-option A.So I want to read the Select-option A's value.

    Hi,
    Refer this following code..this will solve your problem...
    "Following code reads value entered in s_po select options and willprovide search
    "help for s_item depending upon s_po value.
    REPORT TEST.
    TABLES : ekpo.
    DATA: BEGIN OF itab OCCURS 0,
    ebelp LIKE ekpo-ebelp,
    END OF itab.
    SELECT-OPTIONS   s_po FOR ekpo-ebeln.
    SELECT-OPTIONS s_item FOR ekpo-ebelp.
    INITIALIZATION.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_item-low.
      DATA:
      dyn_field TYPE dynpread,
      temp_fields TYPE TABLE OF dynpread,
      zlv_dynpro TYPE syst-repid.
      zlv_dynpro = syst-repid.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname     = zlv_dynpro
          dynumb     = syst-dynnr
          request    = 'A'
        TABLES
          dynpfields = temp_fields
        EXCEPTIONS
          OTHERS     = 0.
      LOOP AT temp_fields INTO dyn_field.
        IF dyn_field-fieldname EQ 'S_PO-LOW'.
            SELECT * INTO CORRESPONDING fields OF TABLE itab FROM ekpo
            WHERE ebeln EQ dyn_field-fieldvalue.
            EXIT.
        ENDIF.
      ENDLOOP.

  • How to get the value of a variable defined in javascript in JSP

    how to get the value of a variable defined in javascript in/through JSP????

    In Javascript you can use the DOM to access the input element and set it's value before submitting the form. Then it's value will just be passed.

Maybe you are looking for

  • HT3819 Does anyone get an unknown library under their shared libraries on the ITunes desktop?

    I have never turned on sharing and have a secure home network yet somehow I have a shared library under my ITunes desktop that I would appear to have access to.  This seems really strange.  Anyone seen this before?

  • Got error when creating stored procedure

    Hi, I am a rookie in Oracle. I created a stored procedure: create or replace procedure my_first_sp as begin select cid from actions where rownum<3; end; And I got an error : "**** compilation error" After I "show error" I got the description to see a

  • NetWeaver Developer Studio - PI deployment prerequisites?

    Hello everybody, at the moment i am facing the problem that i can not deploy an adapter module from nwds 7.1 ehp 1 to an as java of our pi-system. I am getting this error: DeployException,cause=[ERROR CODE DPL.DCAPI.1023] AuthorizationException.Reaso

  • Wireless Backup Disk

    I was wondering if you could do wireless backups with not only Apple routers, but other ones too.

  • How can I post the screenshot in my topic in this forum?

    <p>Dear Expert:</p><p>I want to load the screenshot in my topic which I posted to this forums. I just copy and paste the screenshot in the topic body when I edited, and I can see it when I edited. But after I submit to post it to the forums, the scre