Method access

I am creating a jsp web page to display the items to add to a shopping cart
I am getting the following error message error message when i try
to run may jsp display page i dont know what I have to do to get this working
I am running Tomcat 5, Any help would be appreciated.
The method addProduct(Product) in the type ShoppingCart is not applicable for the arguments (Product)
Jsp page code snippet
<jsp:useBean id="sCart" type="ShoppingCart" scope="session"/>
<%@ page import="be.Product" %>
<%@ page import="be.ShoppingCart" %>
<% String featureTitle = request.getParameter("FeatureTitle");
   if(featureTitle!=null)
          String featureID = request.getParameter("FeatureID");
          String date = request.getParameter("Date");          
          String featureDescription = request.getParameter("FeatureDescription");
          String author = request.getParameter("Author");
          double price = Double.parseDouble(request.getParameter("Price"));
          Product newProduct = new Product(featureID, date, featureTitle, featureDescription, author, price);
          sCart.addProduct(newProduct);
%>shopping cart class code snippet
Vector products = new Vector();
     public void addProduct(Product i)
          boolean productFound = false;
          Enumeration productEnum = getProducts();
          while(productEnum.hasMoreElements())
               Product product = (Product)productEnum.nextElement();
               if(product.getId().equals(i.featureID))
                    productFound = true;
                    product.quantity += 1;
                    break;
          if (!productFound)
               products.addElement(i);
     }product class code snippet
public class Product
     String featureID, featureTitle, featureDescription, author, date;
     int quantity = 1;
     double price, total;
     public Product(){}
     public Product(String newid, String newdate, String newtitle, String newdescription, String newauthor, double newprice)
          this.featureID = newid;
          this.date = newdate;
          this.featureTitle = newtitle;
          this.featureDescription = newdescription;
          this.author = newauthor;
          this.price = newprice;
     }

access$ methods are widely used to access private
members of enclosing class from its inner class and
vice-versa. These methods are generated by Java
compiler, not by JVM runtime.
See
http://java.sun.com/docs/books/jvms/second_edition/htm
l/ClassFile.doc.html#80128 for more details about
synthetic class members.
Other questions need more clarification.I will check that link, Regarding the other two questions:
2. What I meant in my interfaces question is that... Say I have a class X that Extends Y and implements A,B
Then if I want to display all the methods and fields of these classes and interfaces in a recursive way, till I reach the Object class, by going to superclass every time, then I understand I can get to class Y simple by
using x.getSuperClass()
but how can I get the interface methods?? and go upwards in that hierarchy??
3. Sub class question is like this - Say I have 3 classes all user defined in the same directory Class A,B,C where A is the superclass of B and C. My class browser is displaying the hierarchy details of A, then is there any way to put in the details of B and C in the same hierarchical display or just display a separate list of subclass that this class has. I am not sure whether I have made it clear still.
(I didnot understnad your reply on changing the class path, can you please explain it in a bit more detail, provided it holds for this question.)
Regards,
Sirish

Similar Messages

  • Configuring Method Accessing

    How do you turn Method Accessing on for all Entities using Java?
    I came across this thread which mentions <uses-method-accessing> in an XML file:
    Re: An interesting TOPLINK-6044
    However, is it possible to do this via an annotation or some configuration in the persistence.xml. I want to use Method Accessing at all times for all entities. Is this possible and is it possible to configure this via annotations or in persistence.xml.

    Thanks for the reply. I tried that and it seems to work. But if I have a transient field in my entity bean and specify method level annotations, TopLink tries to map even the transient field to a table column which is undesirable.
    I also tried annotating the getter methods for the fields I wanted Method Access on and leaving the fields I didn't care about at field-level annotations. But even that resulted in the transient field getting mapped to a database column.
    Any ideas?

  • Method accessing by reflection

    Hi guys,
    I am using ValueHolder Indirection, but my attributes must be private and I don't know what should be the signature of the accessor methods that toplink will try to find by reflection.
    Does TopLink try to guess the method signature based on the attribute name and type?
    Example: private ValueHolderInterface userType;
    -> public void setUserType(ValueHolderInterface) and public ValueHolderInterface getUserType()
    I looked at http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/mapcfg003.htm#CEGDDEEA but I couldn't find out if I would be obliged to specify what would be the accessor methods.

    TopLink uses reflection to access private variable. Since TopLink is not really creating new objects as the application does, but really resorting the state of previously existing objects similar to Java serialization it normally makes sense for it to be using direct variable access, as this typically avoids undesired side effects that get/set method may contain.
    However, using variable versus method access is completely up to you, TopLink supports both. To use method access you must supply the get/set method names to the mapping, TopLink does not guess these, although the Mapping Workbench will fill these in for you if you select method access for the project default. For mappings using ValueHolder indirection you must provide get/set methods that return/set the ValueHolderInterface, not its value. Or you can use direct variable access for these.

  • Method access question

    I have a object which has been declared and created via another class. Is it possible to access another object and its methods in the "parent" class?
    Looking at the java API i thought maybe getClass().getDeclaringClass().myMethod() might work, but getClass().getDeclaringClass() returns null. I havent been able to find anything on the internet regarding this. I wouldnt think it would be an uncommon thing to want to do?...Any ideas? Cheers in advance...Nick

    Thanks for the suggestion. I actually tried this method (passing a reference to the constructor) in a previous project, but i thought maybe there was an easier way (Is this the usual way to tackle this kind of problem?). However, trying to use it in this one leads to more troubles. My instance of class1 is created when a button is clicked, through a buttonListener inner class in my MainWindow class. So what happes is that when i try to use
    Class1 = new Class1(this);instead of passing a reference to MainWindow, it passes a reference to buttonListener instead. This may be where i was on the right track because i then tried
    Class1 = newClass1(getClass().getEnclosingClass());i think i tried using getDeclaringClass() aswell and both would return null. Am i doing this right?

  • Method access problem

    I am creating a jsp web page to display the items to add to a shopping cart
    I am getting the following error message error message when i try
    to run may jsp display page i dont know what I have to do to get this working
    I am running Tomcat 5, Any help would be appreciated.
    The method addProduct(Product) in the type ShoppingCart is not applicable for the arguments (Product)
    Jsp page code snippet
    <jsp:useBean id="sCart" type="ShoppingCart" scope="session"/>
    <%@ page import="be.Product" %>
    <%@ page import="be.ShoppingCart" %>
    <% String featureTitle = request.getParameter("FeatureTitle");
       if(featureTitle!=null)
              String featureID = request.getParameter("FeatureID");
              String date = request.getParameter("Date");          
              String featureDescription = request.getParameter("FeatureDescription");
              String author = request.getParameter("Author");
              double price = Double.parseDouble(request.getParameter("Price"));
              Product newProduct = new Product(featureID, date, featureTitle, featureDescription, author, price);
              sCart.addProduct(newProduct);
    %>shopping cart class code snippet
    Vector products = new Vector();
         public void addProduct(Product i)
              boolean productFound = false;
              Enumeration productEnum = getProducts();
              while(productEnum.hasMoreElements())
                   Product product = (Product)productEnum.nextElement();
                   if(product.getId().equals(i.featureID))
                        productFound = true;
                        product.quantity += 1;
                        break;
              if (!productFound)
                   products.addElement(i);
         }product class code snippet
    public class Product
         String featureID, featureTitle, featureDescription, author, date;
         int quantity = 1;
         double price, total;
         public Product(){}
         public Product(String newid, String newdate, String newtitle, String newdescription, String newauthor, double newprice)
              this.featureID = newid;
              this.date = newdate;
              this.featureTitle = newtitle;
              this.featureDescription = newdescription;
              this.author = newauthor;
              this.price = newprice;
         }

    Hi,
    Well there are several notes on the service marketplace addressing problems with access method "G" like note 821519, 841175, 868913 and 901244.
    However regardless of the problem it is always recommended to use the newest sap kernel (Backend), be on the highest support package level (Backend), and off curse on newest patch level of the SAP GUI (Frontend).
    So try check the notes, and the notes related to them, check the kernel level of your backend, and the patchlevel of you GUI.
    Regards
    Rolf

  • Method accessibility design issues

    I have an application with many classes in different packages that have get/set methods for proprieties. I need to make other classes in different packages to have access to both get and set methods and other classes in one package (loaded with the class loader) to have access only to the get methods.
    What would be a good design for restricting access only to the setters for any class from that package but still provide the get method ? Right now there are some intermediary classes used and I think it's a bad design.
    Any suggestions ? Is there an utility to hide a public method from classes in a certain package ? I have a few ideas but they don't appeal to me more than the current design.

    I have an application with many classes in different
    packages that have get/set methods for proprieties. I
    need to make other classes in different packages to
    have access to both get and set methods and other
    classes in one package (loaded with the class loader)
    to have access only to the get methods.
    What would be a good design for restricting access
    only to the setters for any class from that package
    but still provide the get method ? Right now there
    are some intermediary classes used and I think it's a
    bad design. The bad design is that there are "many" getters and setters. Excluding DTO usage excessive exposure of data suggests both of the following
    - Code does not actually represent objects
    - Very tight coupling.
    Other than that then the use of intermediate classes (presumably nothing more than proxies) would be exactly the correct approach. Now if they aren't really proxies then that could be a problem.

  • Method access$0() and Interfaces doubts

    Hello All,
    I am working on a class browser, I have created one and it works successfully to a certain extent. But The class which I am having a Demo for a Tree Implementation in GUI, has a method called access$0() which I guess is automatically created on runtime by the super classes or somewhere, please let me know how and where can I get more details about this method.
    Also If my class under inspection is implementing one or more interfaces, how can I access its method names and variables.
    Also One more question, does Java maintain a list of sub-class information for each class somewhere.. just like Small Talk or it doesn't?? Please explain.
    Thanks,
    Sirish

    access$ methods are widely used to access private
    members of enclosing class from its inner class and
    vice-versa. These methods are generated by Java
    compiler, not by JVM runtime.
    See
    http://java.sun.com/docs/books/jvms/second_edition/htm
    l/ClassFile.doc.html#80128 for more details about
    synthetic class members.
    Other questions need more clarification.I will check that link, Regarding the other two questions:
    2. What I meant in my interfaces question is that... Say I have a class X that Extends Y and implements A,B
    Then if I want to display all the methods and fields of these classes and interfaces in a recursive way, till I reach the Object class, by going to superclass every time, then I understand I can get to class Y simple by
    using x.getSuperClass()
    but how can I get the interface methods?? and go upwards in that hierarchy??
    3. Sub class question is like this - Say I have 3 classes all user defined in the same directory Class A,B,C where A is the superclass of B and C. My class browser is displaying the hierarchy details of A, then is there any way to put in the details of B and C in the same hierarchical display or just display a separate list of subclass that this class has. I am not sure whether I have made it clear still.
    (I didnot understnad your reply on changing the class path, can you please explain it in a bit more detail, provided it holds for this question.)
    Regards,
    Sirish

  • Extensions/Method Access

    right. i have a class "1" which extends an abstract class "2" which extends an abstract class "3." hence, class "1" implements all methods in classes "2" and "3" along with a few of its own. the constructor in a fourth class, is parsed a new instance of class "1" (of type "class 3"), how can i access all the methods in class "1" using this fourth class? i have tried using for example:
    instancename.but the only methods i can access are the ones in the super class (i.e. class "3"

    chris,
    All humans are mammals.
    Are all mammals human?
    mouse.think keeps returning IHateCatsException.
    keith.

  • Methods Accessing quesstion

    Hi all ,
    my application can work with several db back-ends (MySQL,ORacle ...)
    so the structure at high level has the following 3 layers:
    GUI - Intermediate DB class - MySQL DB classes, Oracle DB classes ...
    My Intermediate DB class , depending on a .ini variable, selects the appropiate MYSQL or Oracle method
    How can I avoid accessing to MySQL/Oracle methods directly from the GUI without passing through the intermediate class?
    MySQL and Oracle methods are in different .java...
    Thanks!

    So, if I well understood, the intermediate layer
    should be an interface and MySQL_DB_methods and
    ORacle_DB_methods should implement these methods isnt
    it?
    E.g. MySQL_DB_methods.createNewUser(UserBean user)
    Oracle_DB_methods.createNewUser(UserBean user)
    but this method createNewUser should be public isnit?
    so I can access also from GUI which is the situation
    i want to avoid ....
    Thanks!No. Why bother with these RDBMS-specific methods at all? JDBC doesn't do that, so why do you? The point Rene is making is, your UI layer should not be aware of the underlying data access technology, this is the essence of the DAO pattern. You seem to be going to some lengths to couple your app. to a particular database, whereas everyone else in the world goes in the other direction

  • Method access vs variable access

    Why would one use a private variable and have get and set methods that change its value instead of simply allowing direct access by making the variable public?

    Ok I've semi-sobered up and here's a better example
    suppose you've developed a client-server application and for some reason the contractor that did the server class hardcoded the port number as public int portnumber =6667; and was subsequently fired for tap dancing on the CIO's desk.
    In theory I can write something like this
    setportNumber(myServerObj obj)
    obj.portnumber = 80;
    }which if your application is supporting large amounts of users then you'll either be paid over time to fix it or fired for allowing the contractor to do it in the first place..

  • Using ValueHolder Indirection With Method Accessing

    I am trying to use method getters/setters with value indirection member as described in the documentation
    (http://download-east.oracle.com/docs/cd/B31017_01/web.1013/b28218/mapcfg.htm#CEGFHCJF).
    My code modifies the mapping with the following lines:
    SessionFactory sf= LocatorLocator.getPersistence().getSessionFactory();
    Session s= sf.acquireUnitOfWork();
    ClassDescriptor d= (ClassDescriptor)s.getDescriptors().get(CharterBusTripLeg.class);
    DatabaseMapping m= d.getMappingForAttributeName("scheduledStartingLocation");
    m.setGetMethodName("getScheduledStartingLocationHolder");
    m.setSetMethodName("setScheduledStartingLocationHolder(oracle.toplink.indirection.ValueHolderInterface)");
    The CharterBusTripLeg class has the following members:
    private ValueHolderInterface scheduledStartingLocation;
    public Location getScheduledStartingLocation();
    public void setScheduledStartingLocation(Location scheduledStartingLocation);
    public ValueHolderInterface getScheduledStartingLocationHolder();
    public void getScheduledStartingLocationHolder(ValueHolderInterface scheduledStartingLocationHolder);
    When I try to restore an instance of CharterBusTripLeg, I get the following Exception:
    java.lang.NullPointerException
         at oracle.toplink.internal.security.PrivilegedAccessController.getMethodParameterTypes(PrivilegedAccessController.java:394)
         at oracle.toplink.internal.descriptors.MethodAttributeAccessor.getSetMethodParameterType(MethodAttributeAccessor.java:86)
         at oracle.toplink.internal.descriptors.MethodAttributeAccessor.setAttributeValueInObject(MethodAttributeAccessor.java:152)
         at oracle.toplink.mappings.DatabaseMapping.setAttributeValueInObject(DatabaseMapping.java:1119)
         at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1022)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:244)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:525)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:381)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:677)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.buildObjectsFromRows(DatabaseQueryMechanism.java:142)
         at oracle.toplink.queryframework.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:483)
         at oracle.toplink.queryframework.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:811)
         at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:620)
         at oracle.toplink.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:779)
         at oracle.toplink.queryframework.ReadAllQuery.execute(ReadAllQuery.java:451)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:2073)
         at oracle.toplink.publicinterface.Session.executeQuery(Session.java:988)
         at oracle.toplink.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:62)
         at oracle.toplink.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:55)
         at oracle.toplink.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:61)
         at oracle.toplink.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:148)
         at oracle.toplink.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:217)
         at oracle.toplink.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:61)
         at oracle.toplink.indirection.IndirectList.buildDelegate(IndirectList.java:202)
         at oracle.toplink.indirection.IndirectList.getDelegate(IndirectList.java:359)
         at oracle.toplink.indirection.IndirectList.size(IndirectList.java:703)
         at test.com.laidlaw.les.charter.charter.DeleteBusTest.checkLegs(DeleteBusTest.java:55)
         at test.com.laidlaw.les.charter.charter.DeleteBusTest.testAddBus(DeleteBusTest.java:79)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    Any suggestions as to what I am doing wrong?
    thanks,
    chas

    Chas,
    You only need to set the method name without parameters.
    m.setSetMethodName("setScheduledStartingLocationHolder");Since these methods will typically only be used by TopLink you can make them protected or private.
    Doug

  • Checkout view  method- access denied error

    It works fine, When tried to get the user view and can print the values. When tried to checkout view it throws error
    com.waveset.util.WSAuthorizationException: View access denied to Subject unit1manager1 on User: unit1user1.
    com.waveset.util.WSAuthorizationException: Modify access denied to Subject unit1manager1 on User: unit1user1.
    <Action id='1' name='checkoutView' application='com.waveset.session.WorkflowServices'>
      <Argument name='op' value='checkoutView'/>
      <Argument name='type' value='User'/>
      <Argument name='id'>
        <ref>selectedCCEmp</ref>
      </Argument>
      <Argument name='authorized' value='true'/>
      <Return from='view' to='employee'/>
    </Action>
    Also tried with and with "authorized" argument
    I tried giving all the capabilities to the manager via admin role still same error. All the users are in the top level of the firm. The controlled organization rule (edit org) and user member rules (edit admin role) dictates the organization structure and members with then the org.
    Thanks in advance
    Sasanka

    I think you want to add the subject argument. Example set subject to Configurator and it should work.

  • Php5 static class method access syntax error

    Dreamweaver is complaining about this syntax
    $class = 'ClassName';
    $class::method(); // static method
    Is there a way to omit these error warnings?

    Thanks for pointing out the reference to the change in PHP syntax.
    To the best of my knowledge, there is no way to turn off the syntax checking. You can turn off code hints, but that doesn't have any effect on the syntax checker.
    I suggest that you file a bug report to Adobe using the form at https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform. Include the reference to the syntax change with your report.

  • Conn Method Access - Calling from method

    Hi I am trying to create a method in another class to call another method that checks for userid in DB? What is the best way to set this up? I.e. calling method?
    //calling method below line
    private boolean setuserExist(String username) {
         else return false;
    public String getserExist() {
              return userexist;
    // Method being called below this line
    public boolean userExist(String username){
              boolean exist = false;
              System.out.println("in LoginDBAccess: username is " + username);
              try{
    Connection conn = dbc.getConnection();
    Statement statement = conn.createStatement();
    String query =      "SELECT User.UserID " +
                        "FROM User " +
                        "WHERE User.UserID = '" + username + "'";
    ResultSet resultSet = statement.executeQuery(query);
    System.out.println("1.1");
    ArrayList result = new ArrayList();
    while(resultSet.next()){
         //System.out.println("In While:");
    ArrayList item = new ArrayList();
    item.add(resultSet.getString("UserID"));
    result.add(item);
    System.out.println("LoginDBAccess Count: " + result.size());
    conn.close();
    if (result.size() == 1){
         exist = true;
              }catch(Exception e){
         e.printStackTrace();
              return exist;
         }

    http://forum.java.sun.com/thread.jspa?threadID=603496
    Cross-post.

  • Direct methods access of interfaced object

    Hi, gurus!
    My situation like this:
    IHost.as:
    Code:
    public interface IHost {
        function doSomething() : void;
    Host.as:
    Code:
    import IHost;
    public class Host implements IHost {
        public function doSomething() : void { trace("doSomething"); }
        public function doAnotherThing() : void { trace("doAnotherThing"); }
        public function loadChild() : void {
            var loader : Loader = new Loader();
            with (loader.contentLoaderInfo) {
                    addEventListener(SecurityErrorEvent.SECURITY_ERROR, onChild);
                    addEventListener(IOErrorEvent.IO_ERROR, onChild);
                    addEventListener(Event.COMPLETE, onChild);
            var context : LoaderContext = new LoaderContext();
            context.applicationDomain = ApplicationDomain.currentDomain;
            context.securityDomain = SecurityDomain.currentDomain;
            loader.load(new URLRequest("Child.swf"), context);
        public function onChild(event : Event) : void {
            event.target.content.testIt(this);
    Child.as:
    Code:
    import IHost;
    public class Child extends Sprite {
        public function testIt(host : IHost) : void {
            // call method 1
            host.doSomething(); // It works...
            // call method 2
            Object(host).doAnotherThing(); // It also works!!!
    And the question is - how I can allow "call method 1", but deny "call method 2" from loaded objects? I cant declare doAnotherThing method as private - i need it in other chasses (not loaded) to be public...

    just what are you asking?
    if you pass a host instance (and the testIt() method in the Child class should be passed a Host instance not an IHost instance), all the public methods of the Host class will be available to that instance.
    i'm not sure what role casting that instance as an object is supposed to have.

Maybe you are looking for