Setting the value of a JScrollBar inside a JScrollPane not working.

I have a display area (JPanel) inside a JScrollPane. What i want to do is that every time the user closes my application a file is saved with some preferences, like position and size onscreen, and the values of the scrollbars. My problem is that when I try to set the values of the JScrollBars, they seem to be completely ignored.
I made a small class to illustrate this:
import java.awt.*;
import javax.swing.*;
public class ScrollExample extends JFrame
     private JPanel display;
     private JScrollPane displayScroll;
     public ScrollExample()
          display = new JPanel();
          display.setPreferredSize( new Dimension( 800, 600 ) );
          displayScroll = new JScrollPane( display );
          add( displayScroll );
          setSize( 400, 300 );
          setVisible( true );
          displayScroll.getHorizontalScrollBar().setValue( displayScroll.getHorizontalScrollBar().getMaximum() );
     public static void main( String args[] )
          new ScrollExample();
}The behaviour of is as intended. However if we switch the two lines to be:
displayScroll.getHorizontalScrollBar().setValue( displayScroll.getHorizontalScrollBar().getMaximum() );
setVisible( true );and launch it, the scrollbar appears to have moved only a small amount. This leads me to believe that it has something to do with the main window being visible. In my actual application, this call to setValue is ignored, unlike in this sample one. Even placing it after the setVisible call, it does not do anything.
When I tried to use:
     Runnable doScroll = new Runnable()
             public void run()
                  taskDisplayScroll.getHorizontalScrollBar().setValue( 200 );
         SwingUtilities.invokeLater(doScroll);after the setVisible call, as mentioned on http://forum.java.sun.com/thread.jspa?threadID=723424, it rarely (maybe 3 out of 20 times) sets the scrollbar to the indicated value.
My question is this: What does the setValue() call depend on to run properly, and how do I code it to work in my program?
If you need any additional information, please ask.
Note: In the sample class I provided, the scrollbar moves to its proper spot, I could not cause it to not move at all, as is the case in my application that seems to have the same calls.
Thanks, Serge.
Edited by: super_serge on Jun 26, 2008 8:23 AM

Can you please explain to me how b) would be implemented.Read the Swing tutorial on Concurrency for the new approach in JDK1.6, or I still prefer to use SwingUtilities.invokeLater for somthing simple like this.

Similar Messages

  • Setting the value of a textfield inside dataTable

    Hi All
    I have a dataTable which contains one textField and a commandLink in each row.When the commandLink is clicked a popup containing list of values is opened.When the user selects a value from that popup I have to set it to the adjacent textfield.
    This behaviour is working fine outside the table.What am doing is finding the adjacent textfield by client id and calling
    textField..getValueBinding("value").setValue(context,value)
    But inside the table the following exception is thrown.
    Caused by: javax.faces.el.PropertyNotFoundException: Base is null: mem
         at org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:463)
         at org.apache.myfaces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:251)
         at ....
    Whats the ideal way to tackle this issue ?
    Please Advice.
    Thanks
    Balu

    Thanks for your reply...
    My bean is in session scope.But the issue is , when i call the inputField.getValueBinding("value") for a component inside table, the binding obtained is that of the request scope variable var.
    When i calls the valueBinnding.setValue(context,"value") this attribute is not available.
    i think my approach is not correct...
    Please advice
    Thanks
    Balu

  • Setting default value to columns on tabular form is not working.

    Hi,
    I created a tabular form and i want to set some default values to columns based on the values in page items.
    so i set the page item to column value in tabular form attributes by selecting the Default type as PLSQL Expression & Function DEFAULT value &P24_ISSUE_ID. it worked fine but
    in the similar way i tried for the another column by selecting the default type as pl/sql expression & function and default value &P24_CASE_NAME.
    but it throwing an error for this like failed to parse SQL query:    ORA-00904: "C254DB": invalid identifier
    i don't understand where i gone wrong even i checked for the data types of the columns, everything is fine.
    so please help me out of this problem.

    Tulasi 1243 wrote:
    for the first column
    i selected
    DEFAULT TYPE as PL/SQL Expression & FUNCTION
    Default as *&P24_ISSUE_ID.* This is a number data type column
    2nd column
    Default Type as PL/SQL Expression & Function
    Default as *&P24_CASE_NAME.* This is Varchar2 data type column.The appropriate options for a default value from a page item are Item (application or page item name) for Default Type and the item name ( P24_ISSUE_ID, P24_CASE_NAME etc) for Default.
    *&P24_ISSUE_ID.* is not a "PL/SQL Expression or Function".
    but it throwing an error for this like failed to parse SQL query: ORA-00904: "C254DB": invalid identifierWhat you are doing results in the APEX engine substituting the P24_CASE_NAME value "C254DB" into the default value and then trying to evaluate this string as a piece of PL/SQL. Outside of a block in which it is defined as a variable, constant or function "C254DB" is not a valid PL/SQL expression.

  • Setting the values inside xml file in xmlparsing

    Hi,
    Iu2019ve an xml file without containing any values inside the tags. I need to get the values from the text file and set the values inside the xml file. When I try to set the string variable inside the setValueNode()  using DOM parser, itu2019s not setting any values inside the xml file. 
    Please help me on this..
    Regards
    Vineela

    Hi,
    I am doing conversion from EDIFACT format to xml format.
    I am writing this code using core java. So I am using xmlparsing to convert my data. Iu2019ve one Hash table with me. I need to get the values from there and populate those values into xml file.
    Regards
    Vineela

  • Setting the value of a java variable in javascript function

    How can i set the value of a java variable in a javascript function?
    <%
    String fName = "";
    %>
    now i want to define a javascript function which can set the value of fName to the value it has been passed.
    <script language="javascript">
    function setJValue(val)
    </script>
    Thanks

    The only way you could simulate this, would be call the same page inside the Javascript function, and send it the parameter that was passed. Then you would have your Java code retrieve this parameter by request.getParameter("value");, and set the variable accordingly.

  • How set the values programatically in custom tables ?

    Hi Guru's,
    Please help me where i did mistake....
    My scenario is i have 4 columns that 4 columns are look up based on row i need save the "XX_hr_Vacancies_CompTab"
    4 columns look like....
    column1(15 questions ) column2(message choice) column3(message choice) column4(free text)
    (1-15)question manually select (1-10) manually select (1-10) comments
    this vo purpose i am using this query
    SELECT ROWNUM,
    xhv.VACANCY_ID
    , xhv.RFP_NO
    , hl.lookup_code
    , hl.meaning
    , XJCT.BUHR_RATING
    , XJCT.COMBEN_RATING
    , XJCT.RATIONALE
    FROM hr_lookups hl ,
    xx_hr_vacancies xhv,
    XX_JOBEVAL_COMP_TAB XJCT
    WHERE lookup_type = 'XX_JE_QUESTIONAIRE'
    AND xhv.RFP_NO = 'IRC616'
    AND XJCT.VACANCY_ID(+) = XHV.VACANCY_ID
    ORDER BY ROWNUM
    I am using sample code is for one column inserting.....please help where i am doing mistake.
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    am.invokeMethod("createjobVacancy1");
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    if (pageContext.getParameter("Save") != null)
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    OAViewObject vacncyVO = (OAViewObject)am.findViewObject("XXTableLookupVO1");
    int fetchedrowcount = vacncyVO.getRowCount();
    RowSetIterator multiIter;
    multiIter = vacncyVO.createRowSetIterator("VacancyId");//Attribite of the select box
    multiIter.setRangeStart(0);
    multiIter.setRangeSize(fetchedrowcount);
    System.out.println("no before for loop condition rows"+fetchedrowcount);
    for(int i=0;i<fetchedrowcount;i++)
    am.invokeMethod("createjobVacancy1");
    OAViewObject vacncyVO1 =
    (OAViewObject)am.findViewObject("XX_hr_Vacancies_CompTab_EOVO1");
    Object vacancy = vacncyVO.getRowAtRangeIndex(i).getAttribute("VacancyId"); */*63 Line code is this one*/*
    System.out.println("vacancy number is in table region current row is "+vacancy);
    System.out.println("no or rows"+fetchedrowcount);
    if(vacancy != null && !"".equals("vacancy"))
    vacncyVO1.getCurrentRow().setAttribute("VacancyId",vacancy);
    System.out.println("set create vacancy number is in table region current row is "+vacancy);
    }else{
    vacncyVO1.getCurrentRow().setAttribute("VacancyId",null);
    am.invokeMethod("apply1");
    System.out.println("out of for loop :"+fetchedrowcount);
    Sop:
    13/01/10 06:55:28 no before for loop condition rows15
    13/01/10 06:55:29 Header is =725
    13/01/10 06:55:30 vacancy number is in table region current row is 616
    13/01/10 06:55:30 no or rows15
    13/01/10 06:55:30 set create vacancy number is in table region current row is 616
    13/01/10 06:55:30 Header is =726
    Error:
    ## Detail 0 ##
    java.lang.NullPointerException
    at xxsup.oracle.apps.per.jobevaluation.webui.MainCO.processFormRequest(MainCO.java:63)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
    at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
    Regards,
    Srinivas

    Thanks Keerthi,
    i am getting values but i unable to set the values, once i am setting values i am facing null pointer exception ..
    java.lang.NullPointerException
         at xxsup.oracle.apps.per.jobevaluation.webui.MainCO.processFormRequest(MainCO.java:86)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
    i am using below coding in PFR
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    if (pageContext.getParameter("Save") != null)
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    OAViewObject oaviewobject =(OAViewObject)am.findViewObject("XXTableLookupVO1");
    if(oaviewobject!=null)
    pageContext.writeDiagnostics(this,"View Object is exists",OAFwkConstants.STATEMENT);
    int rowcountValue = oaviewobject.getRowCount();
    pageContext.writeDiagnostics(this,"Row returned by the View Object"+rowcountValue,OAFwkConstants.STATEMENT);
    System.out.println("before for loop geting values = "+rowcountValue);
    Row rowAdv= oaviewobject.first();
    RowSetIterator iterator = oaviewobject.createRowSetIterator("iterator");
    iterator.setRangeStart(0);
    iterator.setRangeSize(oaviewobject.getRowCount());
    for(int i=0; i<iterator.getRowCount(); i++)
    pageContext.writeDiagnostics(this,"Inside For loop ",OAFwkConstants.STATEMENT);
    rowAdv =iterator.getRowAtRangeIndex(i);
    if(rowAdv != null)
    pageContext.writeDiagnostics(this,"flag not null",OAFwkConstants.STATEMENT);
    pageContext.writeDiagnostics(this,"Flag Value Checked as Y",OAFwkConstants.STATEMENT);
    OAViewObject vacncyVO1 =
    (OAViewObject)am.findViewObject("XX_hr_Vacancies_CompTab_EOVO1");
    if(rowAdv.getAttribute("VacancyId")!=null)
    Object vacancyname = rowAdv.getAttribute("VacancyId").toString();
    vacncyVO1.getCurrentRow().setAttribute("VacancyId",vacancyname); This is the 86 line
    System.out.println("Vacancy ID IS = "+vacancyname);
    System.out.println("Vacancy ID IS = "+rowAdv);
    am.invokeMethod("apply1");
    // System.out.println("out of for loop :"+iterator);
    please help me where i am doing mistake...
    Regards,
    Srinivas

  • Setting the value of a single attribute for multiple line items

    Hi all,
    I am working on a Web Dynpro application, I have created this applicaion for an accounting document so it has header data and multiple line item data. As per the requirement I have to put the following logic:
    1. When a user enters a value in the field KBLNR on the line item, all the other fields like cost centerm fund, functional area should populate from a database table based on the value of the KBLNR. to get this I have put the following code:
    TYPES: BEGIN OF t_kblp,
              fipos     TYPE kblp-fipos,
              kostl     TYPE kostl,
                      END OF t_kblp.
      DATA lv_kblnr TYPE wd_this->element_t_bseg-kblnr.
      DATA: lt_kblp TYPE STANDARD TABLE OF t_kblp,
            wa_kblp LIKE LINE OF lt_kblp,
            lt_bseg              TYPE STANDARD TABLE OF bseg,
            wa_bseg              TYPE bseg.
      DATA lo_nd_t_bseg TYPE REF TO if_wd_context_node.
      DATA lo_el_t_bseg TYPE REF TO if_wd_context_element.
      DATA: ls_t_bseg TYPE wd_this->element_t_bseg,
            lo_api_controller    TYPE REF TO if_wd_controller,
            lo_message_manager   TYPE REF TO if_wd_message_manager,
            lo_nd_tbseg          TYPE REF TO if_wd_context_node,
             lo_el_tbseg          TYPE REF TO if_wd_context_element,
             lt_el_tbseg          TYPE wdr_context_element_set,
             lv_bseg              TYPE bseg.
      lo_nd_t_bseg = wd_context->path_get_node( path = `ZDATA.CHANGING.T_BSEG` ).
      lo_api_controller ?= wd_this->wd_get_api( ).
      CALL METHOD lo_api_controller->get_message_manager
        RECEIVING
          message_manager = lo_message_manager.
      lo_nd_tbseg = wd_context->path_get_node( path = `ZDATA.CHANGING.T_BSEG` ).
      lt_el_tbseg = lo_nd_tbseg->get_elements( ).
      LOOP AT lt_el_tbseg INTO lo_el_tbseg.
        lo_el_tbseg->get_static_attributes(
                               IMPORTING static_attributes = lv_bseg ).
      IF lv_bseg-kblnr NE ' '.
          SELECT belnr
                 fipos
                 kostl
                 PSPNR
                 geber
                 saknr
                 fkber
                 grant_nbr
                 gsber
                 FROM kblp
                 inTO corresponding fields of wa_kblp
                 WHERE belnr = lv_bseg-kblnr and
                      saknr = lv_bseg-saknr.
            ENDSELECT.
    lo_nd_t_bseg = wd_context->path_get_node( path = `ZPRELIMINARY_POSTING.CHANGING.T_BSEG` ).
    * get element via lead selection
            lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
    lo_el_tbseg->set_static_attributes(
                               EXPORTING static_attributes = wa_kblp ).
       CLEAR: lv_bseg, wa_kblp.
      ENDLOOP.
    everything is working fine but now the problem is couple of fields that I have in wa_kblp are with different names in bseg table and hence they are not updating... I tried putting the following logic within the loop :
    lo_el_t_bseg->set_attribute(
        name =  `PROJK`
    value = wa_kblp-pspnr ).
    but it's only setting the value of the first line item and not working for the multiple line items, can you please tell me how can do this?
    Thanks,
    Rajat Garg
    Edited by: rajatg on Jun 24, 2011 5:09 PM

    Hi Chris,
    I tried your code and it worked fine but after I put this code I am getting another issue. within the loop I had a code to make the fields non modifiable on the screen and was working fine but now what's happening is it's making the all the lines uneditable except the one with data on it (which is completely opposite), this is what I have coded:
    LOOP AT lt_el_tbseg INTO lo_el_tbseg.
        lo_el_tbseg->get_static_attributes(
                               IMPORTING static_attributes = lv_bseg ).
    IF lv_bseg-kblnr NE ' '.
      SELECT belnr
                 fipos
                 kostl
                 PSPNR
                 geber
                 saknr
                 fkber
                 grant_nbr
                 gsber
                 FROM kblp
                 inTO corresponding fields of wa_kblp
                 WHERE belnr = lv_bseg-kblnr and
                      saknr = lv_bseg-saknr.
            ENDSELECT.
    move: wa_kblp-belnr to wa_bseg-kblnr,
    wa_kblp-fipos to wa_bseg-fipos,
    wa_kblp-kostl to wa_bseg-kostl,
    wa_kblp-pspnr to wa_bseg-projk,
    wa_kblp-geber to wa_bseg-geber,
    wa_kblp-saknr to wa_bseg-saknr,
    wa_kblp-fkber to wa_bseg-fkber,
    wa_kblp-grant_nbr to wa_bseg-grant_nbr,
    wa_kblp-gsber to wa_bseg-gsber,
    lv_bseg-dmbtr to wa_bseg-dmbtr.
    append wa_bseg to lt_bseg.
    lo_nd_edit_property = wd_context->path_get_node( path = `ZPRELIMINARY_POSTING.CHANGING.T_BSEG.EDIT_PROPERTY` ).
          get element via lead selection
          lo_el_edit_property = lo_nd_edit_property->get_element( ).
          lo_el_edit_property->set_attribute(
            name =  `EDIT_FIELD`
            value = 'ABAP_TRUE' ).
          lo_el_edit_property->set_attribute(
            name =  `EDIT_WBS`
            value = 'ABAP_TRUE' ).
    endif.
    endloop.
    o_nd_t_bseg = wd_context->path_get_node( path = `ZPRELIMINARY_POSTING.CHANGING.T_BSEG` ).
    get element via lead selection
            lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
      CALL METHOD lo_nd_t_bseg->bind_table
        EXPORTING
          new_items            = lt_bseg.
    Can you please see what I am doing it wrong here....

  • Fetch the values from internal table inside an internal table (urgent!!)

    data : BEGIN OF PITB2_ZLINFO occurs 0,
             BEGDA LIKE SY-DATUM,
             ENDDA LIKE SY-DATUM,
             PABRJ(4) TYPE N,                       "Payroll Year
             PABRP(2) TYPE N,                       "Pay. Period
             ZL LIKE PC2BF OCCURS 0,
           END OF PITB2_ZLINFO.
    I have a internal table like this,
    How to Fetch the values from internal table inside an internal table.
    Kindly Help me on this..
    Regards,
    Ram.

    Hi,
    Try this....
    Loop at PITB2_ZLINF0.
    Loop at PITB2_ZLINF0-ZL.
    endloop.
    Endloop.
    Thanks...
    Preetham S

  • How do I set the value of a dynamic row text field

    I have a repeated row form which contains a button and multiple text fields.  There is a text field (Input Data Field) further up with some information I want to place in the table and multiple buttons that I want to read the value of and set to the table.  I apologize there are multiple questions I have and I am using pseudocode to describe it.
    Top form looks like
    InputField
    | ButtonX1 | ButtonY1 | DescriptionX1 (read only Text Field)
    | ButtonXn | ButtonY1 | DescriptionXn
    OutputRow looks like
    | ButtonOutput | OutputField1 | OutputField2 | OutputField3 |
    So I would like it to do
    ButtonX1.click
    OutputTable.OutputRow.addInstance(true)  //this works - everything else I have questions on
    OutputTable.OutputRow.OutputField1.rawValue = DescriptionX1.rawValue
    Question 1
    How do I address the location in each table to set a value
    Question 2
    How do I get the value of the description field in the same table and row as the button
    I would like to say something to the effect of  OutputTable.OutputRow[??].OutputField1.rawValue = this.parent.DescriptionX
    OutputTable.OutputRow.OutputField2 = InputField.rawValue
      Same question as above - how do I specify a dynamic row - is this the proper syntax for getting the value from the input field?
    OutputTable.OutputRow.OutputField3 = this.ButtonLabel
    Question 3
      How can I get the value of the button's label to set in the field
      There should be very many of these buttons and buttons will be added - I would prefer to set the value based on the button's label to make the value easier - not requiring changing the code
    Question 4 - unrelated to those above.
    Is it possible to build the first table
    | ButtonX | ButtonY | Description |
    from an XML File.  I have seen examples of how to build if it is just data, but can the XML be pushed into a form with code to do the above actions?

    Each object in a form must have a unique name. I doing so it is not neccessarily the name but the path or SomExpression associated with that object that must be unique. In your case you have a Table.Row.object configuration. The Row is the part that is repeating so to give each object a unique name an instance number is placed on the repeating part. So objects in the 1st row woudl be Table.Row[0].object...objects in the second row woudl be Table.Row[1].object etc .....You can see this by adding a debug instruction on the Enter event of the description field. Put the code app.alert(this.somExpression) and when you enter the field you will see what the somExpression is. Do this for a few rows and you will see the pattern (don't forget to remove the debug code from the enter event). Now you know what you have to use to address the fields. If no instance is given it is assumed to be 0 ..that is why only the 1st row is being affected.
    So now to answer your questions:
    Question1: The square bracket notation is an issue for javascript (this is the notation for an array) so we have to use a different means of addressing the field to include the instance number. So to address the Description in the 3rd row we woudl use:
    xfa.resolveNode("Table.Row[2].Description").rawValue = "This is my new description";
    Note that the instance number is 2 for the 3rd row because the instance numbers are 0 based.
    Question2. The resolveNode notation allows you to pass a string so you can also concatinate expressions to make the string. If you are writing code on a button in the same row you can get the instance that you are on by using the expression this.parent.index. The "this" portion refers to the current object (the button) and the parent.index gets you th eindex of the Buttons parent. If the button is embedded deeper in a hierarchy then you can continue to add parent indicators until you get back to the node that you want. So rewriting your expression from Q1 it woudl be:
    xfa.resolveNode("Table.Row[" + this.parent.index + "].Description").rawValue = "This is my new description";
    Question3: The buttons caption can be retrieved by using ButtonName.caption.value.text.value
    Question4: When you say build from an XML file. What are you expecting to come from the XML file? The caption that goes on the button? Typically the XML file carries data (not to say that it cannot carry other things). Just need a bit of clarification on this one first.
    Hope that helps
    Paul

  • Not able to set the value in marketing context node for BP_HEAD

    Hi,
    I am trying to set the value in marketing node of BP_HEAD from bp_addr component. i am calling the set_property method but it is not changing the value, when i debugg the code, it actually changing the value in bol structure but it is not calling the get/set method of bp head.
    i am working on BP corporate person  creation i.e. in bp_head component and account details view. I added the marketing attributes in UI configuration and also the address attributes.
    this is what i coded in get method of country in standardaddress context node of BP_ADDR
    lv_entity ?= current.
        IF lv_entity IS BOUND.
          lv_parent = lv_entity->get_parent( ).
          IF lv_parent IS BOUND.
            lv_entity_mkt = lv_parent->get_related_entity( iv_relation_name = 'BuilMarketingRel' ).
            IF lv_entity_mkt IS BOUND.
              CALL METHOD lv_entity_mkt->set_property
                EXPORTING
                  iv_attr_name = 'ATTRIBUTE'
                  iv_value     = attribute1.
    Can anyone please guide me on how to set the value cross component and can we call the get/set method of that attribute which is not in same component?
    Regards,
    Kamesh Bathla

    Sorry, what I said was rubbish, because the LSMW and the session run in different external sessions.
    I have searched forum for these terms: "company BUK parameter BDC background"
    These threads Is it possible to set default company code in SM35? and Release BDC in SM35 in background, How to set defaul company code? seem promising, but I'm not sure they really solve.
    In case these threads don't help you, I think you can create your own Z transaction which sets the BUK parameter id and then does a LEAVE TO TRANSACTION 'ABAON'. Then create again the recording on the Z transaction.
    If you are using ECC6, then you may also enhance the standard to reset BUK parameter id at the very beginning of ABAON, in case it's run in batch input (sy-binpt = 'X'). Be careful as sometimes SAP does batch input on some transactions, so that could make the standard fail.
    Last thing, you can contact SAP support, though it might probably be considered as consulting.

  • HOW to set the value attribute of FORM INPUT data to a variable in a JSP

    eg. Registration.jsp
    The data is accessed from an hidden field called course
    for example, if I have "Java programming" in the field course, and I use
    an expression to access the value from the hidden field.
    **My problem is that the data gets truncated to "Java" , I need "Java Programming"to display. The code looks like this
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <INPUT TYPE="text" SIZE=12 NAME="course"
    VALUE=<%=getParameter("course") %>
    IS there ANY OTHER WAY to set the value of VALUE to a variable?

    Instead of value=<%=request.getParameter("course")%>
    Use double codes
    value="<%=request.getParameter("course")%>"

  • How to prevent numericstepper from setting the value to the defined Maximum when a number greater than maximum is entered in by keyboard and user hits the "Enter" key.

    I need to set the Maximum so that the use can use the mouse to change the value of numericstepper (and not go over a certain number), but at the same time I have to allow the user to enter their value by typing in the text field. When the user enters a number greater than the Maximum, I disable the "Ok" button of the dialog and show a red warning(error message). The issue is that the user can hit "Enter" and numeric stepper would set the value to the Maximum and the dialog box would close and the rest of code would run. I want the numericstepper not to change the value and keep showing the warning even if the user hits the "Enter".
    Note: Setting maxChar does not help since my maximum is 1000, and user might enter 5555
    I would appreciate the help.

    Thanks for trying to help, But
    The issue is that if I set the maximum value of stepper 1 greater than the max value that I want, then the user can select an invalid value(of myMax + 1) when he clicks on the UP arrow of the numeric stepper(which is not acceptable for what I am working on).
    I need to preserve the users invalid number, while not letting the user to select an invalid number by clicking UP key.
    I noticed that when the user enters a number greater than the Maximum, and then click on the down arrow, it would set the value to 1 less than the maximum. This is not acceptable either.

  • Setting the value of a textbox from another page

    Hi Everyone,
    I have a multi paged application (multiple xib, multiple controllers)
    In my selection view, the view that holds the UIViewPicker control, I need to populate the page that called the selector page...
    I have the code to identify what page called the selector, and when the page is dismissed, I need to fill in the field from the calling page.
    I have included the header of the calling view in my selector view, and now I need to be able to fill in a readonly textbox in the calling view....
    Do I need to setup a property for each of the textboxes in the calling view, or can I populate them directly??
    thanks
    tony

    alt-088 wrote:
    I am sorry, but I am lost in this implementation....
    How exactly do I tell the self.parentViewController what control will receive the new text value??
    Ooooops!! I'm the one who needs to be sorry, Tony:
    // from previous post
    - (void)setTextInParent:(NSString* textValue) {
    // assume that every possible parent controller has a "textbox" object
    // which is a member of some class that has a writable 'text' property
    [previousViewController setValue:textValue forKey:@"text"]; // <-- * Idiot alert *
    Looks like another one of my senior moments. As you pointed out, we need the value of the 'textBox' property before we can set the value of the 'text' property.
    To your question on how I am displaying the second view, it is called via
    [self presentModelViewController:screen animated:YES]
    from a button click event
    Cool. That means we already have the address of vc1 in the 'parentViewController' ivar of vc2, so we don't need to add the 'previousViewController' ivar shown in my example.
    So here's a corrected and maybe more relevant example--this one has been tested (Duh!), btw:
    - (IBAction)done {
    // get the currently selected string
    NSInteger row = [pickerView selectedRowInComponent:0];
    NSString *selection = [dataArray objectAtIndex:row];
    NSLog(@"%s: selection=%@", _func_, selection);
    // set text in textBox property of parent controller
    [self.parentViewController setValue:selection forKeyPath:@"textBox.text"];
    [self dismissModalViewControllerAnimated:YES];
    I have tried to implement this code
    [self.parentViewController setValue:21 forKey:@"test"];
    but it is generating an error stating
    passing argument 1 of 'setValue:forKey:' makes pointer from integer without a cast
    Yeah, referring to the doc, [setValue:forKey:|http://developer.apple.com/iphone/library/documentation/Cocoa /Reference/Foundation/Protocols/NSKeyValueCodingProtocol/Reference/Reference.html#//appleref/occ/instm/NSObject/setValue:forKey:] wants an id type (pointer to an object of any Obj-C class) for the first arg. Since 21 is an int, i.e. a scalar value, the compiler doesn't like it (and the runtime system would like it even less).
    However when you want to use KVC to set a scalar property, the methods are actually smart enough to extract an int if you provide a NSNumber object (see "Setting Attribute Values Using Key-Value Coding" under [Key-Value Coding Fundamentals|http://developer.apple.com/iphone/library/documentation/Cocoa/Conc eptual/KeyValueCoding/Concepts/BasicPrinciples.html#//apple_ref/doc/uid/20002170 ] in the Key-Value Coding Programming Guide). So if 'test' is an int ivar of the parent controller, something like this should work:
    [self.parentViewController setValue:[NSNumber numberWithInt:21] forKey:@"test"];
    Does that cover your questions? Sorry again for the bad code. Most of the examples I post are pasted directly from working, tested code, and I usually add a disclaimer if it's just something I keyed into the forum. But when I"m having a senior moment all bets are off.
    - Ray

  • Setting the value of dropdown according tio 1st dropdown values

    Hi All,
    I have a requiremnt.
    My code is like this.
    DATA: LV_GROUP               TYPE QCODEGRP,
              LV_CODE                TYPE QCODE,
              LV_GROUP_FIELDNAME(30) TYPE C,
              LV_CODE_FIELDNAME(30)  TYPE C.
    § 4.The event DOUBLE_CLICK provides parameters for row and column
      of the click. Use row parameter to select a line of the
      corresponding internal table.
        "  break-point.
        FIELD-SYMBOLS  TYPE LVC_T_MODI.
        DATA: LS_MODI TYPE LVC_S_MODI.
        CASE E_FIELDNAME.
          WHEN 'PART_CODE'     OR 'PART_GROUP'.
            PERFORM F4_GET_CATALOG_SELECTION USING    TQ80-OTKAT
                                             CHANGING LV_CODE
                                                      LV_GROUP.
            LV_GROUP_FIELDNAME = 'PART_GROUP'.
            LV_CODE_FIELDNAME  = 'PART_CODE'.
          WHEN 'JOB_CODE'      OR 'JOB_GROUP'.
            PERFORM F4_GET_CATALOG_SELECTION USING    TQ80-FEKAT
                                            CHANGING  LV_CODE
                                                      LV_GROUP.
            LV_GROUP_FIELDNAME = 'JOB_GROUP'.
            LV_CODE_FIELDNAME  = 'JOB_CODE'.
          WHEN 'ACTIVITY_CODE' OR 'ACTIVITY_GROUP'.
            PERFORM F4_GET_CATALOG_SELECTION USING    TQ80-MFKAT
                                             CHANGING LV_CODE
                                                      LV_GROUP.
            LV_GROUP_FIELDNAME = 'ACTIVITY_GROUP'.
            LV_CODE_FIELDNAME  = 'ACTIVITY_CODE'.
          WHEN OTHERS.
            EXIT.
        ENDCASE.
    FORM F4_GET_CATALOG_SELECTION USING     P_CATALOG
                                  CHANGING  P_CODE
                                            P_GROUP.
      DATA:
        LV_CATALOG                     LIKE QKAT-KATALOGART,
        LV_H_CODE                      LIKE VIQMFE-FECOD,
        LV_PICK                        TYPE C,
        LV_RETN                        TYPE C,
        LV_DISP                        TYPE C,
        W_NOTIF_CATALOG                LIKE LINE OF G_NOTIF_CATALOG,
        I_CODEGRP                      LIKE QPK1CODEGRP OCCURS 0 WITH HEADER LINE.
      DATA: BEGIN OF I_QPK1CD OCCURS 10.
              INCLUDE STRUCTURE QPK1CD.
      DATA: END   OF I_QPK1CD.
      LV_CATALOG = P_CATALOG.
      LV_H_CODE  = '*'.
    LV_PICK    = 'X'.
    LOOP AT G_NOTIF_CATALOG INTO W_NOTIF_CATALOG WHERE QKATART = LV_CATALOG.
        MOVE W_NOTIF_CATALOG-QCODEGRP TO I_CODEGRP-CODEGRUPPE.
        APPEND I_CODEGRP.
      ENDLOOP.
      CALL FUNCTION 'QPK1_GP_CODE_SELECTION'
        EXPORTING
          I_KATALOGART           = LV_CATALOG
         I_CODEGRUPPE           = CDGRP
          I_CODE                 = LV_H_CODE
          I_SPRACHE              = SY-LANGU
          I_PICKUP_MODE          = LV_PICK
          I_DISPLAY_MODE         = LV_DISP
          I_RETURN_IF_ONE        = LV_RETN
        TABLES
          T_QPK1CDTAB            = I_QPK1CD
          T_CODEGRPTAB           = I_CODEGRP
        EXCEPTIONS
          NO_MATCH_IN_RANGE      = 01
          NO_USER_SELECTION      = 02
          NO_AUTHORIZATION       = 03
          NO_SELECTION_SPECIFIED = 04
          OBJECT_LOCKED          = 05
          LOCK_ERROR             = 06
          OBJECT_MISSING         = 07.
      CHECK SY-SUBRC = 0.
      READ TABLE I_QPK1CD INDEX 1.
      P_CODE  = I_QPK1CD-CODE.
      P_GROUP = I_QPK1CD-CODEGRUPPE.
    My requirement is that I want to set the values of job_group and activity_group equal to values of part group drop down. I want to just select the value of part_group from the f4 option  and other values should auto populate with same values.
    Please help.
    Thanks in Advance,
    Hariom.

    Hi Hari,
    Check the below thread
    populate drop down menu based on entry in another field
    Cheerz
    Ram

  • Can I set the value of a list binding in my managed bean?

    Dear All,
    This is just an exercise for me and I just wanted to experiment on the bindings of ADF for me to understand it further.
    I wanted to create a custom Model Driven LOV with my data control listed below
    Countries
         -CountryId
         -CountryName..but I wanted to display the label similar to this
    1 - USA
    2 - England
    n - France..so I thought of manipulating the select items in a bean
    <af:selectOneChoice id="soc1" value="#{bindings.Countries.inputValue}">
      <f:selectItems value="#{pageFlowScope.MyBean.countries}" id="si1" valuePassThru="true"/>
    </af:selectOneChoice>..and the code similar to this
    public class MyBean{
         public List<SelectItem> getCountries(){
              //countryMap points to accessing the iterator binding
              //BindingsHelper is a utility class that sets the value
              for(...){
                   SelectItem item = new SelectItem();
                   item.setLabel(countryMap.get("CountryId") + " - " + countryMap.get("CountryName"));
                   item.setValue(countryMap.get("CountryId"));
                   list.add(item);
              //set the item to the first row
              BindingsHelper.setExpressionValue("#{bindings.Countries.inputValue}",
                                     list.get(0).getValue());
              return list;
    }...on the last part I wanted to set the value to the first item but I am encountering numberformatexception when setting the list binding.
    I know I can do this declaratively also by removing the unselected item but as I have said I am experimenting on the bindings.
    Is this not possible?
    Thanks.
    JDev 11G PS5

    Hi ,
    I understand that , you want to show select one choice (dropdown) with label (countyid - country name) and value is (countryid).
    and these informnation is coming from ADf Model ( may be a VO).
    in the UI page you used this list is coming from MyBean
    <af:selectOneChoice id="soc1" value="#{bindings.Countries.inputValue}">
    <f:selectItems value="#{pageFlowScope.MyBean.countries}" id="si1" valuePassThru="true"/>
    </af:selectOneChoice>
    so ,
    The Managed Bean code should be ,
    private List<SelectItem> countries;
    ///setter method
    public void setCountries(List<SelectItem> countries) {
    this.countries= countries;
    // getter method
    public List<SelectItem> getQuoteStatusList() {
    quoteStatusList =
    selectItemsForIterator("countriesVOIterator",
    "countryId", "countryName");
    return quoteStatusList;
    public static List<SelectItem> selectItemsForIterator(String iteratorName, String valueAttrName, String displayAttrName) {
    return selectItemsForIterator(findIterator(iteratorName), valueAttrName, displayAttrName);
    public static DCIteratorBinding findIterator(String name) {
    DCIteratorBinding iter = getDCBindingContainer().findIteratorBinding(name);
    if (iter == null) {
    throw new RuntimeException("Iterator '" + name + "' not found");
    return iter;
    public static List<SelectItem> selectItemsForIterator(DCIteratorBinding iter, String valueAttrName, String displayAttrName) {
    List<SelectItem> selectItems = new ArrayList<SelectItem>();
    for (Row r : iter.getAllRowsInRange()) {
    string labelValue = (String)r.getAttribute(valueAttrName) +"-"+ (String)r.getAttribute(displayAttrName);
    selectItems.add(new SelectItem(r.getAttribute(valueAttrName),labelValue ));
    return selectItems;
    this will give you what you except in the ui
    when you try to get the value form that seclecOneChoice value in MyBean what user selects , you can simply get the value of this selectOneChoice.

Maybe you are looking for