Set methods aren't called

For some of my managed beans, the set methods are not being called for the properties. Instead, it appears that the get methods are being called, and it modifies the reference in order to modify the stored property. I am using Facelets 1.1.12, MyFaces 1.1.4, and tomcat 5.5.17 (the one bundled with netbeans). The bean is a Spring managed being, which JSF accesses through Spring's DelegatingVariableResolver.

I have a Java object which has a field which references another object. On my jsf page, I have:
<h:inputText value="#{myBean.innerObj.val}" />When the form is submitted, the setVal method in innerObj is called, but the setInnerObj method in myBean is not called. Instead, it calls getInnerObj and probably uses the reference to modify the object.

Similar Messages

  • My methods aren't called!!!!!!

    Hi!
    Some of my methods aren't called by my other classes. here are some piece of my codes and my different classes. I don't know the reason of my faults. can u help me?
    my first class:
    public class dbManager
      public dbManager()
    public Vector PatentBilgi  = new Vector();
    private Vector Countryname = new Vector() ;
    private Vector Cityname = new Vector();
    public Vector getFromPatentTableRegisterDate(String year)
    int result = 0;
    String sql ="select PTAPPNO,APPLICATIONTYPE,PATENTTYPE,REGISTERDATE,PATENTDATE from patent.patent "+
    "where to_char(registerdate,'yyyy')='" + year + " ' order by PTAPPNO";
      Connection conn = getConnection();
      Statement stmt = null;
      ResultSet rs = null;
      System.out.println(sql);
    try
        stmt = conn.createStatement();
        rs = stmt.executeQuery(sql);
         while(rs.next())
        Patent patent = new Patent();
        patent.setBa�vuruNo(rs.getString("ptappno"));
        patent.setBasvuruBicimi(rs.getString("applicationtype"));
        patent.setKorumaTipi(rs.getString("patenttype"));
        patent.setBasvuruTarihi(rs.getString("registerdate"));
        patent.setTescilTarihi(rs.getString("patentdate"));
        patent.setUlke(getFromAddressTableCountry(patent.getBasvuruNo(),conn));
        patent.setSehir(getFromAddressTableCity(patent.getBasvuruNo(),conn));
        patent.setIPCID(getFromPtpatentclassificationTable(patent.getBasvuruNo(),conn));
        PatentBilgi.add(patent);
        result = rs.getInt(1);
    return  PatentBilgi;  
    public String getFromAddressTableCountry(String no,Connection conn)
    String result = "";
    String sql ="SELECT PATENT.ADDRESS.countrycode "+
    " FROM PATENT.V_PTHOLDERS,PATENT.ADDRESS "+
    " WHERE PATENT.V_PTHOLDERS.ADDRESSNO = PATENT.ADDRESS.ADDRESSNO"+
    " AND PATENT.V_PTHOLDERS.ptappno = '"+no+"'";
      Statement stmt = null;
      ResultSet rs = null;
    try
        stmt = conn.createStatement();
        rs = stmt.executeQuery(sql);
        if(rs.next())
         result = rs.getString(1);
    return result;  
    }my second class:
    public class PatentHesaplamalar
      public PatentHesaplamalar()
      public void YerliTPEPatentBasvuruSayisi(Vector v)
      int sayac1=0;
      System.out.println("hesap");
        for (int j = 0; j < v.size(); j++)
      Patent obj = (Patent) v.get(j);
      String ulke=obj.getUlke();
      String basvuruBicimi=obj.getBasvuruBicimi();
      String korumaTipi=obj.getKorumaTipi();
      if(ulke.equalsIgnoreCase("TR"))
             sayac1++;
    System.out.println(sayac1);
      }my frame:
    public class PatentFrame extends JFrame
      dbManager manager = new dbManager();
      PatentHesaplamalar ph=new PatentHesaplamalar();
      Vector Countries = manager.getFromCountryTable();
    jButton1.addActionListener(new ActionListener()
            public void actionPerformed(ActionEvent e)
              jButton1_actionPerformed(e);
    private void jButton1_actionPerformed(ActionEvent e)
    setSelectedYear((String)ComboBoxSelectionYear.getSelectedItem());
    manager.getFromPatentTableRegisterDate(getSelectedYear());
    System.out.println(getSelectedYear()+" y�l�"+" Yerli TPE Patent Basvuru Sayisi");
    ph.YerliTPEPatentBasvuruSayisi(manager.PatentBilgi);
    ..........my output:
    select PTAPPNO,APPLICATIONTYPE,PATENTTYPE,REGISTERDATE,PATENTDATE from patent.patent where to_char(registerdate,'yyyy')='2006 ' order by PTAPPNO
    2006 yili Yerli TPE Patent Basvuru Sayisi
    hesap
    0
    the methods
    manager.getFromPatentTableRegisterDate(getSelectedYear());and
    ph.YerliTPEPatentBasvuruSay�s�(manager.PatentBilgi);aren't called and counter sayac1 can't be calculated.
    I hope my explanations are quite clear:)))
    thank u for your help:))
    Message was edited by:
    a5x

    Firstly, I took some elements from database and put in a vector PatentBilgi.
    public Vector getFromPatentTableRegisterDate(String year)
    int result = 0;
    String sql ="select PTAPPNO,APPLICATIONTYPE,PATENTTYPE,REGISTERDATE,PATENTDATE from patent.patent "+
    "where to_char(registerdate,'yyyy')='" + year + " ' order by PTAPPNO";
      Connection conn = getConnection();
      Statement stmt = null;
      ResultSet rs = null;
      System.out.println(sql);
    try
        stmt = conn.createStatement();
        rs = stmt.executeQuery(sql);
         while(rs.next())
        Patent patent = new Patent();
        patent.setBa�vuruNo(rs.getString("ptappno"));
        patent.setBasvuruBicimi(rs.getString("applicationtype"));
        patent.setKorumaTipi(rs.getString("patenttype"));
        patent.setBasvuruTarihi(rs.getString("registerdate"));
        patent.setTescilTarihi(rs.getString("patentdate"));
        patent.setUlke(getFromAddressTableCountry(patent.getBasvuruNo(),conn));
        patent.setSehir(getFromAddressTableCity(patent.getBasvuruNo(),conn));
        patent.setIPCID(getFromPtpatentclassificationTable(patent.getBasvuruNo(),conn));
        PatentBilgi.add(patent);
        result = rs.getInt(1);
    return  PatentBilgi;  ---------------------------------------------------------------------
    then I created one of the methods:
    public void YerliTPEPatentBasvuruSay&#305;s&#305;(Vector v)
      int sayac1=0;
      System.out.println("sepetim :"+v.size());
      System.out.println("hesap");
        for (int j = 0; j < v.size(); j++)
      Patent obj = (Patent) v.get(j);
      String ulke=obj.getUlke();
      String basvuruBicimi=obj.getBasvuruBicimi();
      String korumaTipi=obj.getKorumaTipi();
      System.out.println("ph if d�ng�");
      if(ulke.equalsIgnoreCase("TR"))
             sayac1++;
    System.out.println(sayac1);
    And I called these methods:
    private void jButton1_actionPerformed(ActionEvent e)
    setSelectedYear((String)ComboBoxSelectionYear.getSelectedItem());
    manager.getFromPatentTableRegisterDate(getSelectedYear());
    System.out.println(getSelectedYear()+" y&#305;l&#305;"+" Yerli TPE Patent Basvuru Say&#305;s&#305;");
    ph.YerliTPEPatentBasvuruSay&#305;s&#305;(manager.PatentBilgi);
      }Message was edited by:
    a5x

  • Setter method not getitng called in the custom tag

    Hi,
    I have written a custom tag and I have declared an attribute in the tld file and have specified the setter method for the same in the java tag file but that setter method is not getting called...for rest of the attributes, the methods are getting called and not just for one!! any idea what could be the problem....
    Regards
    Deepak Saini

    Do you have a getter method to match that property?
    Post some example code - what does your tld define for this property, and what get/set methods have you defined for it?

  • Getter & Setter Method not getting called for a field enhanced through AET

    Hello,
    I am new to SAP CRM 7.0 and working on a requirement.
    A Z-field was added by our functional guy in CRM 7.0 WebGui through AET in the 'Create Opportunity' transaction (Header data).
    Now the requirement is, as soon as the opportunity is created through the WebGui, I should post a document in R/3 and paste that document number back to the enhanced Z-field in opportunity.
    Work done by me:
    I pressed F2 on the enhanced Z-field in the WebGui screen and took the details of view, component name etc. After this I went to normal SAP CRM system and open tcode "BSP_WD_CMPWB", located the corresponding view "BT111H_OPPT/Details" and right clicked & enhanced the same.
    Then I opened the structure of this view, expanded context node, located context "BTOPPORTH" and inside this, located my Z-attribute. Now right clicked on the Z-attribute & selected the option "Generate SETTER & GETTER Methods" and these were generated successfully.
    Problem:
    The problem is even after putting external break points in these methods, these methods are not getting called while creating, modifying & displaying the Opportunity in WebGui.
    I hope that for the requirements that I have, I have to do the coding in "Getter & Setter" methods. But since these are not getting called, I am unable to proceed.
    Please help/suggest how to achieve this.
    Thanks in anticipation.
    Best Regards,
    Rahul Malani

    Hi,
    If you can see the field in UI and still get_ method is not being triggered then try to regenerate these methods. If it still doesn't work then please look for SAP notes or raise an OSS.
    There should be some note for the issue you faced.
    please refer:
    Help Needed immediately - AET getter setter methods not getting triggered
    Regards,
    BJ

  • How to call setter Method of ActionScript class with in a Flex Application

    Hi
    I have Action class as shown :
    public class MyClass
    private var name:String 
    public function get name():String {
        return _initialCount;
    public function set name(name:String):void {
        name = name;
    Now please let me know how can i access this Action class under my Flex Application and call the setter Method of it to set the value for the name .
    For example on entering some data in a TextInput and  click of a submit Button , on to the Event Listener , i want to call the set name method of my ActionScript class .
    Please share your ideas on this .

    Thanks  Gordon for your resonse .
    Say for example my Action class is like this :
    public class MyClass
    private var name:String 
    public function get name():String {
        return name;
    public function set name(name:String):void {
        name = name;
    This is inside the MXML
    I know this way we can do it
    public var myclass:MyClass = new MyClass();
    myclass.name="Kiran";
    Now my query is can we do in this way also ??
    myclass.set name(SomeTextInput.text);
    Please share your views on this , waiting for your replies .
    Thanks in advance .

  • How to call a set method from within a constructor

    Hello,
    I want to be able to call a set method from within a Scanner, to be used as the argument to pass to the Scanner (from a source file). Here's what i tried:
    private void openFiles()
            input = new Scanner( setSource );              
        and here is the set method:
    public String setSource( String in )
            source = in;
            return source;
        }obviously there will be more code in this method but i'm trying to tackle one problem at a time. Thanks in advance..

    The "String in" declaration says: "Nobody may ever invoke setSource() without specifying a certain String. The content of the String is known at run-time only."
    In no place in your code you say the compiler: "I want the 'in' variable (actually, parameter) of method setSource() to contain the first arg which is passed to the application".
    This is exactly the same mechanism allowing you to write "new Scanner" with something inside the two parentheses.

  • A way to set a flag in java layer when native method has been called?

    Hi,
    I'm calling a native method from the java layer through to a native c function. Is there a way I can set a flag in the java layer when this native method has been called?
    Thanks!

    1. Create a wrapper method. The wrapper method is the only exposed method. It calls the native method. It sets the flag.
    2. Set the flag in the native method itself.
    3. You might be able to use the debugging API to do this however it is going to require quite a bit of work. And it injects itself at runtime.
    Is there a reason for this request? There might be other solutions if a general problem was posed.

  • How to call  set method

    hi i have a set method which i what to call from another class how can i do that
    Edited by: ADF007 on 2012/09/13 2:08 PM
    Edited by: ADF007 on 2012/09/13 2:08 PM
    Edited by: ADF007 on 2012/09/13 3:14 PM

    Where are these methods written? What technologies/versions are you using?
    From the looks of it, I'm assuming assignRolesToUser seems to be a method in some ADFbc component (AM?)
    and RowButtonListener seems to be a managed bean method.
    You need to first read and understand how to expose ADFbc service operations (such as AM methods) in a client interface and call from your UI layer (such as bean method or similar UI action).
    Here's something: https://blogs.oracle.com/jdevotnharvest/entry/best_practice_invoking_business_services

  • [svn:fx-trunk] 12432: Added Capabilities. hasAccessibility check before calling Accessibility.updateProperties() in setter methods.

    Revision: 12432
    Revision: 12432
    Author:   [email protected]
    Date:     2009-12-03 06:59:10 -0800 (Thu, 03 Dec 2009)
    Log Message:
    Added Capabilities.hasAccessibility check before calling Accessibility.updateProperties() in setter methods.  This prevents an error on systems that do not support accessibility.
    QE notes: none
    Doc notes: none
    Bugs: (24454
    Reviewer: Gordon
    Tests run: checkintests
    Is noteworthy for integration: no
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as

  • Set Methods are not running

    I am writing my first jsp. I have a bean that I am wanting to use and my understanding is that if I put the following commands in, that all the set methods for my properties will run in the bean automatically as long as the names of the properties are the same as those on the form.
    <jsp:useBean id="MedicalBean" class="Project5.MedicalReimbursementRecord" scope="session"/>
    <jsp:setProperty name="MedicalBean" property="*"/>
    The form has a number of textboxes, each text box has a name of one of the properties in my bean. I put display in my bean and I know that it is never running any of the "set" methods for any of the properties. I know that it is indeed getting into my bean, as I have displayed which indicate that methods that I request are indeed running.
    I have not "ACTION" parameter on the FORM, but I have looked at the examples in Tomcat and they have forms which do not have an "Action". I don't think this is a problem, but maybe I am wrong about that. If I put in the statement of:
    <jsp:setProperty name="MedicalBean" property="GrpAcctNbr"/>
    Then I get the error "Cannot find any information on property 'GrpAcctMbr' in a bean of type 'Project5.MedicalReimbursementRecord'"
    So there must be something wrong with my setProperty statement, but what is it?
    Thanks in advance for your assistance.

    Can you show the relevant JSP code and set/get methods in the bean?
    Sometimes this error is caused by capitalization. e.g. a request param of "myName" calls setMyName(). Also, your bean must have a no arguments constructor.
    Also, if you don't specify an action,the form submits to the current URL so you should be ok. Are you sure that the JSP runs when the user submits the form?

  • Confusion about get/set method not working

    Hi
    Hopefully someone can point out the elementary mistake I have made in my code. I have created a get/set method to hold a value"total" so that I can then get it to display it further down my code in an HTML page. I am setting the value as I can check this by printing it out (line 102) but when I try to use it again it displays 0.0. What have I done wrong?
    class ReportListener implements ActionListener
         Context context;
         ResultSet resultAll;
         ResultSet resultTotal;
         JFrame frame;
         int daysInMonth;
         int i;
         DisplayCurrencyOnBills d;
         DateFormatSymbols symbols;
         String[] newWeekday;
         Date theDate;
         String date;
         ReportListener (Context theContext)
              context = theContext;
         public void actionPerformed(ActionEvent e)
           try
              printWeeklyReport();
              //countDaysInMonth();
              getReportMoneyTotal();
         catch (SQLException s)
                   s.printStackTrace();
         public void countDaysInMonth()
         public void getReportMoneyTotal() throws SQLException
              Calendar todayTotal =Calendar.getInstance() ;
               SimpleDateFormat reportDateFormat = new SimpleDateFormat("dd MM yyyy");
              PreparedStatement preparedT =context.getConnection().prepareStatement(
                   "SELECT Sum(tblSession.Fee) AS Total, Count(tblBooking.BookingID) AS CountOfBookingID FROM tblSession INNER JOIN "+
                   "(tblBooking INNER JOIN tblCustomer_Booking ON tblBooking.BookingID = tblCustomer_Booking.BookingID) ON tblSession.SessionID = tblBooking.SessionID "+
                   "WHERE (((tblBooking.EventDate)>DateAdd('m',-1,#"+reportDateFormat.format(todayTotal.getTime())+"#)) AND ((tblSession.Session)='Morning' Or (tblSession.Session)='Evening')) OR (((tblSession.Session)='Afternoon') AND ((tblBooking.Extension)=Yes))"
              ResultSet resultTotal =preparedT.executeQuery();
              resultTotal.next();
              double total =resultTotal.getDouble("Total");     
              context.setReportIncomeTotal(total);
              System.out.println("Line 102 "+context.getReportIncomeTotal());
              preparedT.close();
         public void printWeeklyReport() throws SQLException
              Calendar today =Calendar.getInstance() ;
               SimpleDateFormat reportDateFormat = new SimpleDateFormat("dd MM yyyy");
              PreparedStatement prepared =context.getConnection().prepareStatement(
                   "SELECT tblBooking.EventDate, tblSession.Session, tblBooking.Extension, tblSession.Fee, Count(tblBooking.BookingID) AS CountOfBookingID "+
                   "FROM tblSession INNER JOIN (tblBooking INNER JOIN tblCustomer_Booking ON tblBooking.BookingID = tblCustomer_Booking.BookingID) ON "+
                   "tblSession.SessionID = tblBooking.SessionID GROUP BY tblBooking.EventDate, tblSession.Session, tblBooking.Extension, tblSession.Fee "+
                   "HAVING (((tblBooking.EventDate)>DateAdd('m',-1,#"+reportDateFormat.format(today.getTime())+"#)) AND ((tblSession.Session)='Morning' Or "+
                   "(tblSession.Session)='Evening')) OR (((tblSession.Session)='Afternoon') AND ((tblBooking.Extension)=Yes))"
              ResultSet resultAll =prepared.executeQuery();
              resultAll.next();
              System.out.println("Line 123 "+context.getReportIncomeTotal());
                        PrintWriter printWriter;
                        try
                             JFileChooser fc=new JFileChooser();
                             int returnVal = fc.showSaveDialog(frame);
                             if (returnVal != JFileChooser.APPROVE_OPTION)
                                  return;
                             FileOutputStream outputStream=
                                  new FileOutputStream(fc.getSelectedFile());
                             OutputStreamWriter writer=
                                  new OutputStreamWriter(outputStream,"UTF-8");
                             printWriter=new PrintWriter(writer);     
                           printWriter.println("<html><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><body><h1>Monthly Usage Statistics</h1>");
                           printWriter.println("<table width='100%' border='1'><tr><td width='100%' colspan='8'><h2 align='center'>Monthly Summary</h2></td></tr>");
                         System.out.println("Line 152 "+context.getReportIncomeTotal());
                         int count = 0;
                             while ( resultAll.next() )
                              count++;
                              String session = resultAll.getString("Session");
                              Double fee= resultAll.getDouble("Fee");
                           // display currency correctly
                         //double d=Double.parseDouble(fee);
                         Locale locale = new Locale("GBP");
                         NumberFormat gbpFormat = NumberFormat.getCurrencyInstance(locale);
                             symbols = new DateFormatSymbols(new Locale("en"));
                         newWeekday =symbols.getWeekdays();
                             SimpleDateFormat formatter = new SimpleDateFormat("EEEE",symbols);
                             Date theEventDate = new Date();
                             theEventDate=resultAll.getDate("EventDate");
                             date = formatter.format(theEventDate);
                             // set date for Usage Report
                             Calendar reportDate = Calendar.getInstance();
                             Calendar reportToday =Calendar.getInstance();
                             reportDate.add(Calendar.MONTH,-1);
                             SimpleDateFormat reportFormat = new SimpleDateFormat("EEEE ,dd MMM yyy");     
                             //setDecimalFormat for report total
                             DecimalFormat decFormat = new DecimalFormat(".##");
                             printWriter.println(
                             "<tr><td width='100%' colspan='8'>For month from "+reportFormat.format(reportDate.getTime())+" to "+reportFormat.format(reportToday.getTime())+"</td></tr><tr><td width='100%' colspan='8'>Total amount of income from occasional bookings "+decFormat.format(context.getReportIncomeTotal())+"</td>"+
                               "</tr><tr><td width='100%' colspan='8'>Percentage use for all bookings</td></tr><tr><td width='8%'></td><td width='8%'>MON</td><td width='9%'>TUES</td>"+
                            "<td width='9%'>WEDS</td><td width='9%'>THURS</td><td width='9%'>FRI</td><td width='9%'>SAT</td><td width='9%'>SUN</td></tr><tr><td width='8%'>AM</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr><tr><td width='8%'>PM</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr><tr><td width='8%'>EVE</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr>"
                             System.out.println(count);
                             printWriter.println("</table>");
                             printWriter.println("</body></html>");
                             printWriter.close();
                             prepared.close();
                             JDialog reportDialog=new JDialog(frame);
                             reportDialog.setSize(800,600);
                             JEditorPane editorPane=new JEditorPane(fc.getSelectedFile().toURL());
                             editorPane.setContentType("text/html; charset=UTF-8");
                             reportDialog.getContentPane().add(editorPane);
                             reportDialog.setVisible(true);
                        catch (IOException exception)
                             exception.printStackTrace();
         This code finds data from a database(this works as it also prints a report). Here is the extraxt of my get/set method which is located in a "context" class.
    public void setReportIncomeTotal(double total)
              this.total=total;
         public double getReportIncomeTotal()
              return total;
         }I'd be grateful for any help.

    but when I try to use it again it displays 0.0This seems to mean that either the value has been reset or you are calling the method on another (new) ReportListener.
    It's hard to say, as you didn't provide us with the code sample that illustrate the corresponding scenario (did you?.)
    Note that I didn't get into details, but I just noticed that your actionPerformed method first print weekly report, and then get the money total. (Shouldn't it be the opposite order?)

  • How to know that a method has been called and returning value of a method

    Hi, everyone! I have two questions. One is about making judgment about whether a method has been called or not; another one is about how to return "String value+newline character+String value" with a return statement.
    Here are the two original problems that I tried to solve.
    Write a class definition of a class named 'Value' with the following:
    a boolean instance variable named 'modified', initialized to false
    an integer instance variable named 'val'
    a constructor accepting a single paramter whose value is assigned to the instance variable 'val'
    a method 'getVal' that returns the current value of the instance variable 'val'
    a method 'setVal' that accepts a single parameter, assigns its value to 'val', and sets the 'modified' instance variable to true, and
    a boolean method, 'wasModified' that returns true if setVal was ever called.
    And I wrote my code this way:
    public class Value
    boolean modified=false;
    int val;
    public Value(int x)
    {val=x;}
      public int getVal()
      {return val;}
       public void setVal(int y)
        val = y;
        modified = true;
         public boolean wasModified()
          if(val==y&&modified==true)
          return true;
    }I tried to let the "wasModified" method know that the "setVal" has been called by writing:
    if(val==y&&modified==true)
    or
    if(x.setVal(y))
    I supposed that only when the "setVal" is called, the "modified" variable will be true(it's false by default) and val=y, don't either of this two conditions can prove that the method "setVal" has been called?
    I also have some questions about the feedback I got
    class Value is public, should be declared in a file named Value.java
    public class Value
    cannot find symbol
    symbol  : variable y
    location: class Value
    if(val==y&&modified==true)
    *^*
    *2 errors*
    I gave the class a name Value, doesn't that mean the class has been declared in a file named Value.java*?
    I have declared the variable y, why the compiler cann't find it? is it because y has been out of scale?
    The other problem is:
    Write a class named  Book containing:
    Two instance variables named  title and  author of type String.
    A constructor that accepts two String parameters. The value of the first is used to initialize the value of  title and the value of the second is used to initialize  author .
    A method named  toString that accepts no parameters.  toString returns a String consisting of the value of  title , followed by a newline character, followed by the value of  author .
    And this is my response:
    public class Book
    String title;
    String author;
      public Book(String x, String y)
       { title=x; author=y; }
       public String toString()
       {return title;
        return author;
    }I want to know that is it ok to have two return statements in a single method? Because when I add the return author; to the method toString, the compiler returns a complain which says it's an unreachable statement.
    Thank you very much!

    Lets take this slow and easy. First of all, you need to learn how to format your code for readability. Read and take to heart
    {color:0000ff}http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html{color}
    Now as to your first exercise, most of it is OK but not this:   public boolean wasModified()
          if (val == y && modified == true)
                return true;
    y being a parmeter to the setValue method exists only within the scope of that method. And why would you want to test that anyways? If modified evaluates to true, that's all you need to know that the value has been modified. So you could have   public boolean wasModified()
          if (modified == true)
                return true;
       }But even that is unnecessarily verbose, as the if condition evaluates to true, and the same is returned. So in the final analysis, all you need is   public boolean wasModified()
          return modified;
       }And a public class has to be declared in a file named for the class, yes.
    As for your second assignment, NO you cannot "return" two variables fom a method. return means just that: when the return statement is encountered, control returns to the calling routine. That's why the compiler is complaining that the statement following the (first) return statement is unreachable.
    Do you know how to string Strings together? (it's called concatenation.) And how to represent a newline in a String literal?
    db

  • GET_V Method is not called for custom field

    Hi,
    We are using CRM 7.0
    I have enhanced component BT120H_CPL and added custom fields into view Details with AET. I am trying to implement search help which depends on another field. I have created V-GETTER for my field and tried to implement search help in this method. However, this method is not called in the program scope.
    I have debugged the application and result is :
    V_GETTER method GET_V_ZZAFLD00000D is created in class ZL_BT120H_C_DETAILS_CN00. It should be called from GET_V_S_EXT method but this method is called in class CL_BT120H_C_DETAILS_CN00 and exception occurs since GET_V_ZZAFLD00000D doesnu2019t exist in class CL_BT120H_C_DETAILS_CN00.
    I tried similar scenario : add search help to existing field of another component. However I couldnu2019t able to run GET_V method again.
    ( It works when I write search help id in the AET but in this way I cannot pass import parameter to it )
    Is there anything I am missing ? Thanks in advance for helps.
    Regards
    Abdul.

    Hi,
        Then, the next possible thing is checking the "enhancement set". Press F2 keeping the cursor on any field and check if the view is showing up as enhanced. Find this information under "Active Enhancement set" in the popup details. If this does not happen, then your enhanced view is not being used. You may want to check the COMPONENT_LOADING BADI if you are using more than one assignment set. You may also want to look at this WIKI.
    [http://wiki.sdn.sap.com/wiki/display/CRM/HowToEnhanceaWebUIComponentinSAP+CRM]
    Regards,
    Arun Prakash

  • Should "rv_value = 'submit'." force processing of the Setter method?.

    When new values are entered into the field 'Country' for the Account screen the code associated with this field does not seem to be run unless I press ENTER after the field is populated from the list of values.
    I have a method with the appropriate code to force it to process:
    method GET_P_COUNTRY.
    case iv_property.
    when if_bsp_wd_model_setter_getter=>fp_server_event.
      rv_value = 'submit'.
    endcase.
    endmethod
    I was under the illusion that this should force the Setter code to be executed, as though I had manually hit ENTER within the field.
    I have just placed a break point in the GET_P_COUNTRY method and can see that the rv_value field is never being set. The iv_property is never matching the value from  if_bsp_wd_model_setter_getter=>fp_server_event.
    The method is being called multiple times with the iv_property being equal to:
    'fieldType'
    'onclick'
    'tooltip'
    'DetailLink'
    'focus'
    'disableSVH'
    and if_bsp_wd_model_setter_getter=>fp_server_event having a value of 'ServerEvent'.
    What might be the best way of detecting that a value has been chosen from the pull-down list and then trigger the SET_COUNTRY method?.
    Jason

    Ah, It's not a manual input and is indeed a drop-down. The Country field is one of the SAP standard fields which, via config, displays a drop-down list of values to choose from. Once chosen it then updates the Country description.
    Within the SET_COUNTRY method I detect if the country value has been changed, and if so set a boolean variable called ZCountry_flag to 'X'. This attribite is created against the class for the context node of the Country attribute.
    Then, within the controller impl class I have entered code against the do_prepare_output method to detect whether the ZCountry_flag field is set, and then if so get data from ERP and post it into a Z-field, which is actually in a different context node, but for the same controller class. The ZCountry_flag attribute is then cleared.
    This process works fine after I have selected a country code from the drop-down and then hit ENTER, but I need a way to emulate hitting ENTER after a value is selected from the list.
    I hope that makes sense.
    I could just moved the code from the do_prepare_output of the controller class to one of the Save related methods, but then this will only update the other fields when saving.

  • Reflection and the field.set method

    OK, I've made 2 classes, a ClearParent and ClearChild (which extends ClearParent). I'd like to have a "clear" method on the parent which dynamically sets all the fields to null. I'd like to be able to have any child that inherits from the parent be able to call clear and dynamically have all it's fields set to null.
    Part of the restriction that I'm facing is that the fields are Objects (Integer) but the getter and setter methods take and return types (int). So I can't just loop through the Methods and call the setters with null.
    I'd like to be able to loop through the fields and call set for all the fields with the parent class.
    I'm inserting the code that I have for the parent and child classes at the end. Basically, the problem that I'm seeing is that if I do a
    this.getClass().getName()
    from the parent (when clear is called from the child) it shows me the child name ("ClearChild"). But when I try to do the
    field.set(this, null)
    it tells me this:
    Class ClearParent can not access a member of class
    ClearChild with modifiers "private"
    How come when I get the name it tells me that it's the child but when I pass "this" to the set method, it says that it's the parent?
    Any one know what's going on here? Is there anyway that I can have the parent set all the fields to null?
    Thanks in advance.
    Here's the code:
    ClearParent
    import java.lang.reflect.*;
    public class ClearParent {
        public boolean clear() {
            try {
                System.out.println(this.getClass().getName());
                Field[] fields = this.getClass().getDeclaredFields();
                Field   field;
                for (int i = 0; i < fields.length; i++) {
                    field = fields;
    field.set(this, null);
    } catch (Exception e) {
    e.printStackTrace();
    return true;
    ClearChild
    public class ClearChild extends ClearParent {
    private Float f;
    public ClearChild() {
    super();
    public float getF() {
    if (f == null) {
    return 0;
    return f.floatValue();
    public void setF(float f) {
    this.f = new Float(f);
    public static void main (String[] args) throws Exception {
    ClearChild cc = new ClearChild();
    cc.setF(23);
    cc.clear();
    System.out.println("cc.getF: " + cc.getF());

    It is an instance of ClearChild that is being used so
    that class name is ClearChild. However, the method
    exists in the parent class and thus cannot act upon a
    private field of another class (even if it happens to
    be a subclass).Ahh...makes sense.
    Why don't you just override clear in the child?We were trying to avoid this because we run into problems in the past of people adding fields to the class, but not adding to the clear, and things not being cleared properly.
    I talked it over with the guys here and they have no problem making the fields protected instead of private. If it's protected, then the parent has access to it and my sample code works.
    Thanks for your help KPSeal!
    Jes

Maybe you are looking for

  • U410 touch WiFi issues after upgrading to windows 8.1

    Hi all, I have a U410 touch and yesterday I upgraded to windows 8.1 I have major WiFi issues. connection drops after a few minutes giving limited. troblesshooting resets the adapter saying ''the default gateway is not accessible '' is fixed. But afte

  • Duplicate catalog item; price editable

    Hi All, I have a client running SRM server 550; they have an issue that when a user creates a shopping cart and adds a catalog item, the price is not editable (as it should be). However, if the user then creates a copy that item, using the "duplicate

  • Another problem with 8520 Curve

    I try to download something from BB App World with the computer and the device connected on usb cable but its saying this "Device Radio Off , BB App World requiers that your device radio is turned on to continue" , what i must do? Solved! Go to Solut

  • JTable how to set cell ediatble false

    - Can teach me JTable how to set cell ediatble false? - And I'm not so understand about following method and sentence... addRowSelectionInterval(int index0, int index1) Adds the rows from index0 to index1, inclusive, to the current selection. - Then

  • Firefox 4 android quits when i press the prosperty button

    everytime i touch the property button, firrfox quit