Custom iterator problem - The method createChildIterator() is undefined for

Hi there, this is my first post here, still quite new to Java. I'm having trouble with a custom iterator when trying to test it with JUnit. The reason to write a custom iterator is this: I want to get the object in the array, then for each item I want to get it's child items with a new iterator call.
It's quite complicated because naturally I'm trying to hide the implementation from the "user". The iterator holds a list of classes called StandardSortElement. Each of these classes holds a class called AvailableResouce
which in turn holds an AbstractResource, and it's AbstractResource that I want the iterator to return. My JUnit testing shows that this part works correctly.
For the child items, they are also held inside the StandardSortElement as an array list. Here is the error I get
"The method createChildIterator() is undefined for the type Iterator<AbstractResource>"
First here is an interface for the custom iterator:
public interface SortIteratorInterface extends Iterator<AbstractResource>{
     public abstract Iterator<BookingInterface> createChildIterator();
}Here is the iterator class:
public class StandardSortIterator implements SortIteratorInterface {
     ArrayList<StandardSortElement> items;
     Integer position = 0;
     * a constructor that passes in a sorted list of StandardSortElement
     public StandardSortIterator(ArrayList<StandardSortElement> items) {
          this.items = items;
     * Return bookings associated with the currently iterated StandardSortElement
     public Iterator<BookingInterface> createChildIterator() {
          return items.get(position).createBookingIterator();
     * Determine if there is another item in the list
     public boolean hasNext() {
          if (position >= items.size()) {
               return false;
          } else {
               return true;
     * Return the next resource in the list. We have a list of StandardSortElement but
     * we want to return the resource within.
     public AbstractResource next() {
          StandardSortElement ssa = items.get(position);                                             // Get a handle on the StandardSortElement     
          AbstractResource ar = ssa.getResource();                                                  // Now get the resource that's packaged up inside
          position++;                                                                                          // Increment the position
          return ar;                                                                                          // return the resource
     * Do not implement - mandatory interface implementation but not required here.
     public void remove() {
          // TODO Auto-generated method stub
}This is the code taken from the JUnit test class
     * This iterator also has an interal child iterator. Check this works as expected
     @Test
     public void testChildIterator() {
          Iterator<AbstractResource> iterator = new StandardSortIterator(items);
          Integer i = 0;
          while (iterator.hasNext()) {
               AbstractResource abstractResource = (AbstractResource)iterator.next();
                if (i.equals(0)) {
                     // The first element should contain children - check it works
                     Iterator<BookingInterface> childIterator = iterator.createChildIterator(); // ERROR OCCURS HERE
               i++;               
          assertTrue(i.equals(items.size()));
     /************************************************************************************/Thank you in advance for any help you can provide!
Paul

Your unit test is coded against the Iterator interface, not your SortIteratorInterface, which is where the createChildIterator method is defined. You need to use a reference to a SortIteratorInterface, not an Iterator. Incidentally, when defining an interface, it's unnecessary to declare the methods as public and abstract. They're implicitly that anyway

Similar Messages

  • Error: The method ReadLine() is undefined for the typ of Objectkey.

    I'm new at Java. Can anyone help??? Much appreciated.
    public class readfilesAppd {
    //     /define string newline for line.seperator
       private static final String nl = System.getProperty("line.separator");
          private static final String userpath = System.getProperty("C:/Documents and Settings/GheeL/My Documents/My Data/835 ERA files/");
          // public static void main(String[] args, Object fr) {
         public static void main(String [] args) {
                     try {
                          ObjectKey br = null;
         //struct stat request_stat_path(char C:/Documents and Settings/GheeL/My Documents/My Data/835 ERA files/, Request *rq);
                // Create file
                //FileReader fr = new FileReader("C:/Documents and Settings/GheeL/My Documents/My Data/835 ERA files/");               
                //String FILENAME = "";
                 String FILENAME = userpath;
                String record = new String();
                         int recCount = 0; 
                        while ((record = br.ObjectKey())) != null)
                               recCount++;
                                FILENAME = record.substring(780, 792);
                              FileWriter fstream = new FileWriter("ERA Loads.txt", true);
                               BufferedWriter out = new BufferedWriter(fstream);
                               out.write(FILENAME+" "+recCount);
                               out.close();
                               System.out.println(FILENAME);
                               System.out.println(recCount);
                          catch (Exception e){//Catch exception if any
                              System.err.println("Error: " + e.getMessage());           
                        finally {
                     System.out.println("Is that something to cheer about?");
                             }

    You haven't posted the correct code. The error is telling you that you're trying to call a method "ReadLine()" on an object that doesn't have a method by that name. The code you posted doesn't call anything called ReadLine(). Find the code where that happens and post it.

  • The method logout() is undefined for the type HttpSession

    I am now trying to invalidate all the sessions by calling HttpSession.logout() in doPost(). I can see this API in a famous servlet book (Coreservlet and Javaserver pages by MartyHall) but in Eclipse it is not able to find out even with the latest JDK 1.7.

    Tolls wrote:
    Is it?
    I can't find any logout() method on the HttpSession interface defined in 3.0.
    Got a javadoc link?? I quote and emphasize:
    That's in Servlet 3.0, and it is in HttpServletRequest
    Here you go:
    http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#logout%28%29

  • Iteration problem in method...

    Hi everyone,
    I'm having a little problem here... I have this loop in a method that should iterate Xml Paths and in the loop it uses that Xml Path to do several things like get information from it. Now, the XML Path is being used correctly (meaning, it uses different values) to get information from it, but when it is passed in a method that is being started by an action (a press on a button), it seems to pick the last xmlPath variable that the loop gave. Hope this makes sence!
    Here's the code:
    populateObjectList();
            int objectNr = 0;
            int row = 0;
            for(Object o : objectList)
                objectNr++;
                xmlPath = o.toString();
                System.out.println(xmlPath);
                ConfigList iconObject = new ConfigList(xmlPath);
                int iconX = objectPanel.x + 20;
                int iconY = objectPanel.y + 20;
                if (objectNr == 2)
                    iconX = iconX + 48;
                if (objectNr == 3)
                    row++;
                    objectNr = 0;
                    iconY = iconY + 36 * row;
                // Image
                iconFrame = iconObject.icon.get(objectDirection).toString();
                iconImg = new GUIImage(iconFrame, iconX + 2, iconY + 2, objectPanel);               
                objectPanel.add(iconImg);
                // Icon
                iconBtn = new GUIButton(iconX, iconY,48,36,objectPanel,new ButtonListener(){
                public void buttonPressed()
                    //System.out.println("XML Path: " + xmlPath);
                    setPlaceObject(xmlPath);
                iconBtn.setImage("border");
                iconBtn.setToggle(true);
                objectPanel.add(iconBtn);
            }And the method that puts the xml paths in:
    public void populateObjectList()
            objectList.add("src\\xmls\\object1.xml");
            objectList.add("src\\xmls\\object2.xml");
        }So the xmlPath in the "buttonPressed" function is always "src\\xmls\\object2.xml".
    Hope you folks understand my problem! If not, tell me what you don't understand :)
    Thanks ahead!
    Jens

    Sorry for the double posts, but I have another problem... Again with the iteration! The iconFrame string should change if the objectDirection string changes. However, it doesn't... The objectDirection changes when I click a button, so I figured I would just put the loop in the method and call that method when that button is clicked, but that doesn't overwrite the icons, it just adds more (as that method with the loop in it is also called by default when the button is not clicked...
    Here's the changed code:
    Default call in the constructor method:
    populateObjectList();Method that changes the objectDirection variable:
    public void rotateAnimation(int nr)
            if (nr == -1)
                rotateNr--;
            if ((nr == -1) && (rotateNr == -4))
               rotateNr = 0;
            switch(rotateNr)
                case 0:
                    objectDirection = "South";  
                    break;
                case -1:
                    objectDirection = "East";
                    break;
                case -2:
                    objectDirection = "North";
                    break;
                case -3:
                    objectDirection = "West";
                    break;
            populateObjectList();
        }The old method with the loop added in:
    public void populateObjectList()
            objectList.add("src\\xmls\\object1.xml");
            objectList.add("src\\xmls\\object2.xml");
            int objectNr = 0;
            int row = 0;
            for(Object o : objectList)
                objectNr++;
                final String xmlPath = o.toString();
                System.out.println(xmlPath);
                ConfigList iconObject = new ConfigList(xmlPath);
                int iconX = objectPanel.x + 20;
                int iconY = objectPanel.y + 20;
                if (objectNr == 2)
                    iconX = iconX + 48;
                if (objectNr == 3)
                    row++;
                    objectNr = 0;
                    iconY = iconY + 36 * row;
                // Image
                iconFrame = iconObject.icon.get(objectDirection).toString();
                iconImg = new GUIImage(iconFrame, iconX + 2, iconY + 2, objectPanel);               
                objectPanel.add(iconImg);
                // Icon Button
                iconBtn = new GUIButton(iconX, iconY,48,36,objectPanel,new ButtonListener(){
                public void buttonPressed()
                    //System.out.println("XML Path: " + xmlPath);
                    setPlaceObject(xmlPath);
                iconBtn.setImage("border");
                iconBtn.setToggle(true);
                objectPanel.add(iconBtn);
        }Does this make sence? Does anyone have a solution for this? Again, if you don't understand, please tell me!
    Thanks ahead!
    Jens

  • Can someone explain me the error "The method xyz is ambiguous for the type"

    I get this compiler-error "The method compareTo(java.lang.Object) is ambiguous for the type MyClass" everytime when I want to access the method "compareTo(Object)", which is overwritten in MyClass and in the superclass of MyClass.
    What does it mean?
    Thank you for your help!
    Ciao

    it means you are using a method declared in two of your class declared packages...
    the package paradigm was created to provide a way to distinguish the method with the same signature but from different projects..
    many Java API methods has the same signature but comes from diferent packages.. if you declare theese packages using '*', you should declare it variables with its full signature...
    look this:
    http://java.sun.com/docs/books/tutorial/java/interpack/packages.html

  • Custom IAC applications the best way to go for putting R/3 screens on web?

    Hi all,
    I am trying to figure out whether a Custom IAC would be a best way to go for putting custom developed R/3 transaction on the web. We want to put the R/3 transactions on the web but want to completely customize the look and feel of it. Is IAC the best way to go for it? will this work with any kind of transactions?
    cheer,
    i028982

    Hello,
    The ITS might not be the "best" way, but it sure would be an easy way.  If the transaction and screens are already created in the R/3 then you could just go to SE80 and create HTML templates to see if it will do what you want.  Steps:
    1. Transaction SE80
    2. Choose "Internet Service"
    3. Type in a custom developed z* name
    4. Right-click on the z* name and choose Create > Theme
    5. Create theme 99 (standard theme)
    6. Right-click on the z* name again and choose Create > Template
    7. Type in all information, theme number, program name and screen number.  Play with the "Generation Style" to see which one would better fit your transaction.
    After creating the screens you can publish to your ITS and give it a test.  Maybe this is all you need, if so, it would be fast and readily available.
    Best regards,
    Edgar Chuang

  • Method getWorkflowEngineJMS() is undefined for the type IJWFPortalService

    Hi @ll,
    In my web dynpro project, Iu2019m trying to create collaboration task using CreateTask API as described in the following SAP help link:
    http://help.sap.com/saphelp_nw70/Helpdata/en/46/94b9b2b321581ce10000000a1553f7/frameset.htm
    I've added the following JARs:
    com.sap.portal.usermapping_api.jar
    com.sap.security.api.jar
    com.sap.workflow_api.jar
    prtapi.jar
    And, also added the following sharing references:
    PORTAL:sap.com/com.sap.portal.usermapping
    PORTAL:sap.com/com.sap.workflow.apps
    But in the coding time Iu2019m unable to find getWorkflowEngineJMS() method of  IJWFPortalService. Please suggest shorting out this issue.
    Currently Iu2019m working on EP 7.0, SPS 14.
    Thank in advance
    Gautam Singh.

    issue resloved by adding "ejb.jar".

  • SSIS: Merge Problem: the input is not sorted (for use in exporting a multi-record format file)

    I am using the following useful article regarding exporting a multi-record file:
    http://vsteamsystemcentral.com/cs21/blogs/steve_fibich/archive/2007/09/25/multi-record-formated-flat-file-with-ssis.aspx
    I have created the 2 datasources, ordering each on a field commmon to both.
    I have created the two derived columns headers and am now moving on to the merge.
    It is failing with the following error:
    "the input is not sorted"
    And whilst I definitely have an order by on the query, when I look at the metadata between the datasource and the derived column, the Sort Key Position items displays "0" for all my fields, I was expecting the sort field to have a "1" in this column.  What am I missing?
    Any help would be most appreciated!

    The thing to remember here is that the SSIS designer gets its metadata from the RDBMS - metadata like the column names, data types and sizes that describe the data being returned.
    But the RDBMS metadata does not include anything about the sort order of the data.
    If you have an ORDER BY clause in your source query, you need to accurately and appropriately set the IsSorted and SortKeyPosition properties in the Advanced Editor for your data source component. It is your responsibility as the package developer to ensure that you're giving SSIS the correct information. If you're not, you'll get the same errors you've posted here.

  • TS3694 my iphone wont get out of recovery mode? ive been having service problems " the phone would say searching for numerous hours of the day" i connected to itunes and started to update and restore the phone  now it will not restore

    The Iphone will not get out of recoverymode

    Google is your friend.
    http://support.apple.com/kb/ts3694#error3004
    Network connection or download errors
    Error 1479: This error occurs when trying to contact Apple for an update or restore.
    Quit iTunes
    Disconnect from USB and restart the iOS device.
    Reconnect the device to the computer.
    Launch iTunes and attempt to update or restore again.
    Error 1639: Follow these steps.Errors 3000-3999 (3004, 3013, 3018, 3164, 3194, and so on): Error codes in the 3000 range generally mean that iTunes can't contact the update server (gs.apple.com) on ports 80 or 443.
    Update to the latest version of iTunes.
    Verify the computer's date and time are accurate.
    Check that your security or firewall software isn't interfering with ports 80 or 443 or with the server gs.apple.com.
    Follow these steps to troubleshoot security software. Often, uninstalling third-party security software will resolve these errors.
    An entry in your hosts file may be redirecting requests to gs.apple.com (go to "Unable to contact the iOS software update server gs.apple.com" above).
    Internet proxy settings can cause this issue. If you're using a proxy, try again without using a proxy.
    Test restoring while connected to a known-good network.
    Error 3002: If you experience this error while updating an iPod touch (2nd generation) or iPhone 3G, please use the standard update or restore process in iTunes (click Update or Restore).Error 3194: You may not have the latest version of iTunes installed. Update to the latest version of iTunes. If the issue persists, follow the steps above in "Unable to contact the iOS software update server gs.apple.com."Error 3004: If you're using a Mac, you may be able to resolve an error 3004 by quitting iTunes and using the following command in the command line: dscacheutil -flushcache.The device couldn't be restored. An internal error occurred or Error 3200: This indicates a network-connectivity or traffic issue. If you see this error, wait an hour or more and try again.Error 9807: Verify the computer's date and time.If unresolved, open access to the following VeriSign servers:
    evintl-ocsp.verisign.com
    evsecure-ocsp.verisign.com
    Access to these servers may be blocked by security software, content filtering software, a misconfigured router, or anti-spyware software. For iTunes for Windows, follow these steps to troubleshoot security software issues.
    Error 9808 (or -9808): Follow the steps for an unknown alert message when connecting to resolve the issue. If those steps don't resolve the issue, or if the settings revert to their original values after the restart, then follow the steps to troubleshoot security software issues.
    Error 9844: This is typically caused by incorrect firewall settings. Go to "Open the proper ports and allow access to Apple servers" in the "Advanced steps" section below.

  • The method is undefined for the type

    HI I have a javabean class:
    package database;
    import java.util.*;
    import java.io.*;
    public class CompanyFormBean implements Serializable{
      private String companyparentid;          
      private String companyname;               
      private Hashtable errors;
      //private String notify;
    public boolean validate() {
        boolean allOk=true;
        if (companyname.equals("")) {
          errors.put("companyname","Please enter your Company Name.");
          companyname="";
          allOk=false;
        return allOk;
      public String getErrorMsg(String s) {
        String errorMsg =(String)errors.get(s.trim());
        return (errorMsg == null) ? "":errorMsg;
    // public CompanyFormBean(){}
      public CompanyFormBean() {
        companyparentid          = "";
        companyname               = "";
        errors = new Hashtable();
      public String getCompanyparentid() {
        return companyparentid;
      public String getCompanyname() {
        return companyname;
      public void setCompanyparentid(String fcompanyparentid) {
        companyparentid = fcompanyparentid;
      public void setCompanyname(String fcompanyname) {
        companyname = fcompanyname;
      public void setErrors(String key, String msg) {
        errors.put(key,msg);
    }after the form is submitted I try to display the values
    <%@ page import="database.CompanyFormBean" %>
    <jsp:useBean id="formHandler" class="database.CompanyFormBean" scope="session"/>
    <html>
    <head>
    <title></title>
    <meta name="Generator" content="EditPlus">
    <meta name="Author: Irene Nessa" content="">
    <meta name="Keywords" content="">
    <meta name="Description: creates a new member account" content="">
    </head>
    <body>
    <form name="reg" method="post" action="ProcessMemberRegistration.jsp" onsubmit='return formValidator()'>
    <table>
         <tr>
         <td>Create A New Account</td>
         </tr>
         <tr>
              <td>Existing Company</td>
              <td>
                   <input type="text" name="companyparentid" value='<%=formHandler.getCompanyparentid()%>'>
                   <!-- <select name="campanyparentid" onchange="setcompany(this)">
                        <option>Better Homes</option>
                        <option>Emaar</option>
                   </select>
                   <font size="" color="#FF0033"><b><i>OR</i></b></font>-->
              </td>
         </tr>
         <tr>
              <td>Company Name *</td>
              <td><input type="text" name="companyname" value='<%=formHandler.getCompanyname()%>'>
              </td>
         </tr>
    </table>
    <br>
         <br>
         <input type="reset">  <input type="submit" value='Check Form' />
    </form>
    </body>
    </html>But I keep getting the following errors:*The method getCompanyparentid() is undefined for the type CompanyFormBean* But it defind and the bean class complies. Any idea what am doing wrong.
    thanks.

    I actually got the same error in the same situation the following is my error and Stacktrace. I was trying to using AJAX to retrieve the message from DB and display it in a text area when user click a radio button. It works well untill I add a new method getMessage(String), please help!
    Mar 2, 2009 10:01:03 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    An error occurred at line: 22 in the jsp file: /getmessage.jsp
    The method getMessage(String) is undefined for the type Item
    19: <jsp:setProperty name="items" property="categoryId" value="<%=catid%>" />
    20: <jsp:setProperty name="items" property="effectiveIndicator" value="C" />
    21: <%
    22: String msg = items.getMessage(id);
    23: String decodedmsg = new String(msg.getBytes("iso-8859-1"), "Big5");
    24: System.out.print("MSG: " + msg);
    25: System.out.print("Deco-MSG: " + decodedmsg);
    An error occurred at line: 26 in the jsp file: /getmessage.jsp
    The method write(String) is undefined for the type HttpServletResponse
    23: String decodedmsg = new String(msg.getBytes("iso-8859-1"), "Big5");
    24: System.out.print("MSG: " + msg);
    25: System.out.print("Deco-MSG: " + decodedmsg);
    26: response.write(decodedmsg);
    27: %>
    Stacktrace:
    at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
    at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:517)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
    at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
    at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:686)
    at java.lang.Thread.run(Thread.java:619)

  • Multiple annotations found at this line, the method  ......

    There,
    I got an error when I used sql tag lib.
    Error Message:
    Multiple annotations found at this line, the method getStartdate() is undefined for the type map.
    Before, I used JSTL 1.0, it worked fine, after I upgraded it to 1.1, I got the problem.
    Any help and idea are appreciated.
    Wolf
    <%@ page session="true" language="java" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <sql:query var="monthlyList" dataSource="jdbc/Booking" scope="request">
    select date as d, count(d_code) as c, (sum(seconds)) as t
    from inservicehistory where date>='<c:out value="${param.startdate}" />'  and date <='<c:out value="${param.enddate}" />'
    group by d
    </sql:query>
    <jsp:forward page="list_daily.jsp" />

    Very strange.
    What server are you using?
    You realise that JSTL1.1 requires a JSP2.0 container (eg Tomcat 5?)
    Does your web.xml declare itself as version 2.4?
    Is there any more to the error message?
    Also I would write the query like this:
    <sql:query var="monthlyList" dataSource="jdbc/Booking" scope="request">
    select date as d, count(d_code) as c, (sum(seconds)) as t
    from inservicehistory where date>= ?
    and date <= ?
    group by d
    <c:param value="${param.startdate}" />
    <c:param value="${param.enddate}" />
    </sql:query>

  • PreparedStatement.getGeneratedKeys():  undefined for the type PreparedState

    All,
    I'm getting this exception:
    "The method getGeneratedKeys() is undefined for the type PreparedStatement" When I try to run this code:
    Connection con = (Connection)getConnection();
    PreparedStatement stmt = null;
    stmt = con.prepareStatement("INSERT INTO article (title, description, creationDate, createdBy) VALUES (?,?,?,?)");
    stmt.setString(1, title);
    stmt.setString(2, description);
    stmt.setDate(3, creationDate);
    stmt.setInt(4, createdBy);
    stmt.executeUpdate();
    ResultSet rs = stmt.getGeneratedKeys();Javadoc says PreparedStatement inherits getGeneratedKeys() from Statement. Then why does it go wrong?
    Thanks alot!

    No sorry, it is a compile time error.
    But I've solved the problem.
    I'm using WSAD and it was pointing to the wrong rt.jar (the one that comes with WSAD). I've changed it to the sun rt.jar and now it works fine!
    Thanks anyway!

  • Generated servlet error: method is undefined for type

    Hi,
    I keep getting the following error when I attempt to run my JSP:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 12 in the jsp file: /jsp-examples/JSPandMySQL/loginuser.jsp
    Generated servlet error:
    The method getValidUser() is undefined for the type LoginDetails
    In my JSP file I have the code:
    <%
    boolean validName = login.getValidUser();
    if(validName == false) {
    out.println("Invalid Username");
    } else {
    out.println("Valid Username");
    %>
    and the method getValidUser(); is in a Java Bean that I have created and the code for that method is just :
    public boolean getValidUser() {
    return valid;
    I've tried searching the net for some answers but none of the solutions given work for mine, I would be grateful for any advice on how to solve this program.

    DId you import the class at the top of the jSP? Does the method exist? Is the class compiled properly?
    - Saish

  • The method If(boolean) is undefined

    "The method If(boolean) is undefined "
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         The method If(boolean) is undefined for the type TestCalculator
         Syntax error, insert ";" to complete Statement
    I'm having some trouble using conditional statements in my code for some reason. I've recently had a lot of problems with my JRE's in eclipse and I thought I was finally past them. Could this error be related to something like that?
    Do I have to make any special declarations at the beginning of my code invoking the boolean method?
    Thanks

    Thanks for the help. Here's the code...
    import java.util.Scanner; // importing the scanner to be able to accept user input
    public class BensCalculator { // declaring the public class, make sure it matches the filename
         public static void main(String[] args) { // mandatory command used to cue the program's start
              Scanner scannerObject = new Scanner(System.in);
    String operator;
              int firstNumber, secondNumber;
    System.out.println("Type two single digit integers separated by spaces and one legal operator.");
    firstNumber = scannerObject.nextInt();
    If (firstNumber > 10)
    System.out.print("Error! --> Please enter an integer between 1 and 9.");
    ___________________________________________________________________________________

  • Execute method is undefined for Request_ZBpProjectGetlist2.

    I created a webservice for a BAPI and imported to Web Dynpro DC using Web Service Model.
    But I am getting an error in wdContext.currentRequest_ZBpProjectGetlist2Element().modelObject().execute();
    It says Method execute() is undefined for Request_ZBpProjectGetlist2.
    Can anyone help me why the execute method is not available for webservice model...

    Hi Sridhar,
    Please check execute method available for Request_ZBpProjectGetlist2 or not.
    Organize your import and check Request_ZBpProjectGetlist2 is imported or not.
    BR
    Arun

Maybe you are looking for

  • Can i redownload an app i bought on another computer?

    I wanna buy Logic Pro on the app store but i might get a new faster Mac soon and i just wanna know before i get it if i can download it on both computers or just wait to get the new one and download it then.

  • [CS3][JS] How to get the file type of current document

    Hi, How to get the file type of current opening document (e.g., tif, jpeg, png) using JavaScript with Photoshop CS3. I am using file object the open the files one by one in the folder (the files sometimes don't have the extensions). If the current do

  • "part of this item already downloaded" error when attempting to purchase movie bundle

    I rented "The Fast and the Furious" through AppleTV. (https://itunes.apple.com/us/movie/the-fast-and-the-furious/id279653553) I then saw there was a Fast and Furious 6 movie Bundle I could BUY (https://itunes.apple.com/us/movie-collection/fast-furiou

  • Need Java API for Adobe interactive forms

    Hi Gurus, Anybody help me to write JAVA code for Validation, interact to BAPI or RFC of R/3, mail system and etc... respective of Adobe elements. Is there any possible to write ABAP code in NetWeaver Development Studio instead of JAVA. Because I am Q

  • View defination privileges on Procedures for any user

    Hello, I was looking for some query where i can view the defination or select the procedures of any schema for example we have procedures owned by ML schema, other users such as fft, fft_read etc wants to view the defination of the procedures or sele