Method Binding to JSF 1.0 validate-Method error

Hi there,
Iam impressed, changing from Beta to 1.0 wasn't that much work at all, I just got one problem left:
<h:inputText value="#{methodsBean.orderNumber}" validator="#{methodsBean.checkOrderNumber}"/>
This is my method:
     public void checkOrderNumber(FacesContext context, UIInput input, Object value) throws ValidatorException
          String orderNumber = (String)input.getValue();
          if (orderNumber.startsWith("100-") && orderNumber.length() == 8)
               //ok
               input.setValid(true);
          else
               FacesMessage message =
                    new FacesMessage(
                         resources.getString("order_number_wrong"),
                         resources.getString("order_number_wrong_detail"));
               throw new ValidatorException(message);               
It does not work, but what's wrong? I
any ideas?!
Thanx!

hi,
perhaps you must use UIComponent instead of UIInput
the signature of Validator.validate() changed.
Object was added (you have it)
and UIComponent instead of UIInput.
here a method of me:
public static void validateEmail(
          FacesContext context,
          UIComponent component,
          Object value)
          throws ValidatorException {
          if ((context == null) || (component == null)) {
               throw new NullPointerException();
          if (!(component instanceof UIOutput)) {
               return;
          String inhalt = value.toString();
                 //GenericValidator aus Commons-Validator-Projekt
          if (!GenericValidator.isEmail(inhalt)) {
               FacesMessage fehler =
                    MessageFactory.getMessage(
                         context,
                         "EMAIL_UNGUELTIG",
                         new Object[] { "[email protected]" });
               throw new ValidatorException(fehler);
     }cheers,

Similar Messages

  • No such method error when launching the Interactive form

    Hi Experts,
    I have developed a simeple Java Webdynpro application and added an Interactive form without any controls in it. Created the context with one value node and a binary value attribute.
    I have assigned  value node to datasource and binary attribute to pdfSource. When I launch the application I am getting the following no such method error.
    java.lang.NoSuchMethodError: com/sap/tc/webdynpro/clientserver/uielib/adobe/api/IWDInteractiveForm.setTemplateSource(Ljava/lang/String;)V
    The currently executed application, or one of the components it depends on, has been compiled against class file versions that are different from the ones that are available at runtime.
    If the exception message indicates, that the modified class is part of the Web Dynpro Runtime (package com.sap.tc.webdynpro.*) then the running Web Dynpro Runtime is of a version that is not compatible with the Web Dynpro Designtime (Developer Studio or Component Build Server) which has been used to build + compile the application.
    My NWDS is of Version 7.0.06
    and J2EE Engine is of Version 6.40.
    any guess why I am getting this error.
    Thanks
    Chinna.

    Issue solved. Compatablility issue NWDS 2.0 Version should use for NW 2004.

  • Abstract Method Error and XML Parsing

    I am using wl6sp1. I am parsing an XML file from within the
    servlet using jaxp1.1 and crimson.
    Following is code:
    1- SAXParserFactory spf = SAXParserFactory.newInstance();
    2- sp = spf.newSAXParser();
    3- xr = sp.getXMLReader();
    4- xr.setContentHandler(new ParseXML());
    5- xr.parse( new InputSource("Example3.xml"));
    This program works fine when execute from command line but in servlet on line
    3 it says:
    "Abstract Method Error"
    I have created XML Registry to use Crimson as XML parser rather than default.
    I think somehow wl is still using jaxp1.0 which is built in
    support in wlsp1.
    Whats wrong with the code...or what configuration i am missing???

    I'm assuming you have already put crimson.jar first in the classpath for the java
    command you use to start WebLogic. If so, have you tried putting the servlet in
    a .war file with the crimson.jar in its' WEB-INF/lib directory?
    Regards,
    Mike Wooten
    "anyz" <[email protected]> wrote:
    >
    I am using wl6sp1. I am parsing an XML file from within the
    servlet using jaxp1.1 and crimson.
    Following is code:
    1- SAXParserFactory spf = SAXParserFactory.newInstance();
    2- sp = spf.newSAXParser();
    3- xr = sp.getXMLReader();
    4- xr.setContentHandler(new ParseXML());
    5- xr.parse( new InputSource("Example3.xml"));
    This program works fine when execute from command line but in servlet
    on line
    3 it says:
    "Abstract Method Error"
    I have created XML Registry to use Crimson as XML parser rather than
    default.
    I think somehow wl is still using jaxp1.0 which is built in
    support in wlsp1.
    Whats wrong with the code...or what configuration i am missing???

  • Abstract Method Error in retrieving Blob

    Hi!
    while (rs.next())
    Blob blob=rs.getBlob(1);
    throws Abstract Method Error
    why?
    Thanxs in advance

    You'll probably find that the JDBC driver that you are using doesn't support blobs. Check the documentation that comes with your driver, it should tell you what parts of the JDBC specification it supports.
    Col

  • Server error: Class: UCF Acroform Method error Message: Could not send mess

    Hi Gurus,
    I'm having a problem with displaying PDF file in the portal. I tried reinstalling Adobe 9. Tick and untick the option Display PDF in browser. But still encountering the error. Is it something to do with IE version? Please Help. Thanks in advance.
    Server error: Class: UCF Acroform Method error Message: Could not send message

    Hi,
        Please speify the system information so that I can help you
    Regards
    Sharanya.R

  • HTTP GET method error

    I've created a simple web page that contains a text box in which the user enters an URL. And also have a servlet to take this address and do something "useful" with it. The Servlet has a doPost method to get this address, and the web page also has the corresponding method
    (<FORM method="POST" ACTION="../fyp/AddressServlet" >).
    I'm using a j2ee server, which runs fine, as does the deploytool.
    However, when I attempt to open the web page in my browser, I get the following error,
    "HTTP Status 405-HTTP method GET is not supported by this URL"
    I don't know why I'm getting a GET method error, when it's a POST method I'm using.
    Any help would be appreciated,
    thanks,
    ahhfor

    Hi !
    You're using the POST method to call the servlet when you submit the HTML page. However, when you try to load your HTML page into the browser, this is done with GET !
    Check your server.xml file in the /conf directory and see if your application context is correctly defined. And then check the web.xml file in your application's WEB-INF directory. Finally, check your path to the servlet in your HTML file.

  • Organization Payment method Error

    Dear All,
    When I trying to attach a bank account in cash management Tab im getting following error.
    APP-PAY-34070:the bank account does not uniquely map to cash management account
    If anybody faced similar issue please let me know the solution you have implemented.
    Regards,
    Jithin dev

    962274 wrote:
    Dear All,
    When I trying to attach a bank account in cash management Tab im getting following error.
    APP-PAY-34070:the bank account does not uniquely map to cash management account
    If anybody faced similar issue please let me know the solution you have implemented.
    Regards,
    Jithin devPlease see these docs.
    Defining Organizational Payment Method, Errors: APP-PAY-34070: The Bank Account Does not Uniquely map to Cash Management Account. [ID 1106723.1]
    Costing of Payment : Can We Populate Control Account With Multiple Liability Accounts ? [ID 1266020.1]
    Thanks,
    Hussein

  • Disk image Restore returns "Could not validate source - error 254"

    I had backed up an older G4 with a disk image of the boot disk. I was having severe problems so I reformatted the boot drive and started a restore (using disk utility from startup disk). The restore started fine and ran a while but then "stalled." The "progress" bar stopped and the system just kept "hitting" the Utility DVD install disk non-stop (as shown by disk access light).
    Now when I try again, I immediately get a "Restore Failure - Could not validate source - error 254"
    The disk image being restored is on a hard drive. I copied it to another drive and tried again with the same result.
    This is being done on an old G4 Tower, dual 1 GHz PPC under 10.5.8
    Comments?
    (This won't kill me as all my data files are also on my MBP, I just don't want to have to reinstall all my apps, setups, etc.)

    Yes, for my "real" machine (my Intel MBP) I have images, clones, and Time Machine Backups not to mention my data files written to DVD. I've got at least triplicate backup. This was a old machine I was setting up for a specific purpose. I'm not losing any data but I just didn't want to have to reload apps and such. But guess I have no alternative. Thanks for the tip. I had never used the "scan for restore option" before so I learned something. Usually I just trust my multiple backup method so if one source is bad, no big deal. Thanks baltwo!

  • BINDING.JCA-12510 JCA Resource Adapter location error in SOA 11g Suite

    Hi,
    I am just testing one simple SOA Application in SOA 11g Suite. Created a SOA Composite Application with one DB Adapter at designtime all worked fine with DB Adapter. But when I deploy the Application on the server I get the following error:
    The JCA Binding Component was unable to establish an outbound JCA CCI connection due to the following issue: BINDING.JCA-12510 JCA Resource Adapter location error. Unable to locate the JCA Resource Adapter via .jca binding file element <connection-factory/> The JCA Binding Component is unable to startup the Resource Adapter specified in the <connection-factory/> element: location='eis/DB/soademoDatabase'. The reason for this is most likely that either 1) the Resource Adapters RAR file has not been deployed successfully to the WebLogic Application server or 2) the '<jndi-name>' element in weblogic-ra.xml has not been set to eis/DB/soademoDatabase. In the last case you will have to add a new WebLogic JCA connection factory (deploy a RAR). Please correct this and then restart the Application Server ".Do I need to jndi-name in weblogic-ra.xml if so what is the exact location. Any help is appreciated.
    Thanks

    I did but still not able to connect now getting the following error. I went to the Weblogic Console, clicked on deployments, selected DBAdapter, clicked on configuration ,
    and then I don't see outbound configurations instead it shows Outbound Connection Pools, Under Outbound Connection Pools tab I clicked on New and it asked to select Outbound Connection Group I selected the one that was already there (with JNDI eis/DB/SOADemo) and then created my JNDI which was added to the default Outbound Connection Group and in the end it asked to save the Plan.xml which I saved it under a new directory created under soa directory. But still am not able to connect.
    How do I create my own Connection Group as don't want to use the defualt one out there.
    After creating the JNDI Name it asks for saving the Plan.xml file. Where exactly we save this file. Are there any standards.
    Why can't I update any properties when I click on the new JNDI name it takes to Settings for javax.resource.cci.ConnectionFactory --> Outbound Connection Properties but there I see a save buttn but I can't make any changes.
    BINDING.JCA-12563 Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'getCreditValidationSelect' failed due to: Could not create/access the TopLink Session. This session is used to connect to the datastore. Caused by javax.resource.spi.InvalidPropertyException: Missing Property Exception. Missing Property: [DBManagedConnectionFactory.userName]. You may have set a property (in _db.jca) which requires another property to be set also. Make sure the property is set in the interaction (activation) spec by editing its definition in _db.jca. . ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. Is there any documentation that lists all these steps as I couldn't find it anywhere. The guide only talks abou DBAdapter but how to configure etc can't find any info. Any help is appreciated.
    Thanks.

  • Validate failed error - help wih script

    Hi,
    First off, i don't know much javascript basically none and i am new to formcalc so please bear with me.
    So here is what i am trying to do, i have a table on a form where a user can fill in the cells if they want to change a contribution amount for their investment options. The column of the table must equal 100 otherwise they haven't specified the correct values and the contributions are wrong.
    So far i have added script on each cell to validate if the number is between 0 - 100
    (this.rawValue >= 0 && this.rawValue < 101);
    this is working ok, where it is going wrong is here:
    the last cell in the column is a total field and what i want it to do is:
    a) add up the total, again this is working
    SUM(Row1[*].exist + Row2[*].exist)
    b) check to see if the total is equal to 100, if it is not change the font color to red, or if it is equal to 100 the font color is black. What i have in the script is:
    if (Row3[*].total ne 100) then
    total.fontColor = "255,0,0"
    elseif (Row3[*].total eq 100) then
    total.fontColor = "0,0,0"
    endif
    this works if the total is not 100 the font is red, but where it is going wrong is if it does equal 100, i am getting an error message saying "total validate failed" but the strange thing is the total is showing 100 and in black.
    What am i doing wrong? Is there a better way of doing this in Javascript?
    I am not using the finished form, i am just testing that is why the field names are basic as well.
    Thanks in advance

    Hi,
    I've placed a sample form on the web that can be founf at
    http://www.users.on.net/~cbprescott/ValidateFailedTest.pdf
    This form demonstrates the 'Validate failed' error that I am getting using both FormCalc and JavaScript.
    The calculations in both are correct but the warning label is not being displayed when it should be.
    Anyway have a look at the form and PLEASE let me know where I am going wrong. I've spent hours and hours trying to solve this but have failed miserabley.
    Thanks for any help,
    Chris

  • No Signature of Method Error when trying to set Bind Variable Groovy Expr

    I am trying to set a Bind variable on my view object to equal the output of a function defined in the the EntityImpl.java that corresponds to that bind variable.
    I set the value of my bind variable to be = adf.object.getMyServiceType()
    Where the name of the view object I am currently in is called GridSwSoftwareServiceView.xml and the Entity object is called GridSwSoftwareService.java and the EntityImpl file is called GridSwSoftwareService.java.
    I am seeing this error:
    No signature of method: oracle.jbo.common.VariableImpl$VariableExprValueSupplier.getMyServiceType() is applicable for argument types: () values: []
    Does anyone know what this error means?
    I was trying to follow an example from this doc: http://www.oracle.com/technology/products/jdev/11/how-tos/groovy/introduction_to_groovy.pdf
    Edited by: user10791986 on May 21, 2010 2:50 PM

    Looks like a bug... :(
    It works fine as a View Object attribute expression but it fails miserably once added as an expression to the bind variable. In this case, here is a work-around:
    Define the method as static in your EntityImpl.java :
    public static String getMyServiceType() {
    return "EBSO R12";
    Then access it by fully qualifying it with the package and class :
    com.yourpackage.EntityImpl.getMyServiceType()
    Edited:
    On a second thought, I am wondering if the expression is valid since the Entity hasn't yet constructed at that point.... That explains why it works when made static.
    Nick
    Edited by: Nick Haralabidis on May 21, 2010 5:16 PM

  • Backing Bean Validation Method error

    Hi all,
    I've an ADF JSF User Registration Form and I want to set my server-side validation to confirm passwords entered by the user using the validator attribute bound to customized validation logic sitting in a method my backing bean. I've tried quite a few cracks at this but I still seem to get a java.lang.NullPointerException error when the method is invoked.
    The relevant method in my Backing Bean looks like this:
    public void comparePassword(FacesContext facesContext, UIComponent uiComponent, Object newValue) {
    //Get the new value that is passed passed from the Confirm Password field
    String confirmPassword = (String)newValue;
    //Get the password that has already been entered
    String password = (String)getLoginPasswordText().getValue();
    //Compare passwords and raise validation error message
    if (!password.equals(confirmPassword)){
    throw new ValidatorException(new FacesMessage
    (FacesMessage.SEVERITY_ERROR,
    "Passwords need to be the same",
    "Password values should be the same"));
    The getters and setters for the components are also in the bean and the gettLoginPasswordText() returns the original password input text field (the one that I want to compare it to).
    Is there something that I've missed here?
    Cheers

    Thanks Frank.
    I now understand a bit more about value binding. But unfortunately I need a little more help (from anyone) on this one. I've tried quite a few things and I think the problem stems from the fact that the validation code doesn't seem to pickup the value entered in the comparison field - at least in the way that I've coded it. Here's a more complete example of what I'm trying to overcome:
    I've got two input text components:
    <af:inputText required="true" simple="true"
    id="loginPasswordText"
    immediate="true"
    value="#{backing_UserRegistration.password1}">
    </af:inputText>
    <af:inputText required="true" simple="true"
    id="loginConfirmPasswordText"
    immediate="true"
    validator="#{backing_UserRegistration.comparePassword}"
    value="#{backing_UserRegistration.password2}">
    </af:inputText>
    I've setup the relevant accessors as in the following:
    String password1 = "";
    public String getPassword1(){
    return password1;
    String password2 = "";
    public String getPassword2(){
    return password2;
    And my validation now code looks like this:
    public void comparePassword(FacesContext context, UIComponent toValidate, Object value) {
    if (!Password2.equals(Password1)) {
    FacesMessage msg = new FacesMessage("summary message", " detailed message");
    msg.setSeverity(FacesMessage.SEVERITY_INFO);
    ValidatorException e = new ValidatorException(msg);
    throw e;
    I've tested the validation code on a standalone basis ie passing in a new variable as part of the method ie.
    String word = (String) value;
    if (word.equals("tom"))....
    The validator and message fires OK, so I know the problem lies with picking up the entered values for password1 and password2. I know the values are there because I can "see" them on screen and they are recognized by standalone validators and the bean has a session scope.
    Ideas anyone?
    Thanks

  • Is not abstract and does not override abstract method ERROR

    Hello. I'm new at all this, and am attempting to recreate a sample code out of my book (Teach Yourself XML in 24 Hours), and I keep getting an error. I appriciate any help.
    This is the Error that I get:
    DocumentPrinter is not abstract and does not override abstract method skippedEntity(java.lang.String) in org.xml.sax.ContentHandler
    public class DocumentPrinter implements  ContentHandler, ErrorHandler
            ^This is the sourcecode:
    import org.xml.sax.Attributes;
    import org.xml.sax.ContentHandler;
    import org.xml.sax.ErrorHandler;
    import org.xml.sax.Locator;
    import org.xml.sax.SAXParseException;
    import org.xml.sax.XMLReader;
    public class DocumentPrinter implements  ContentHandler, ErrorHandler
    // A Constant containing the name of the SAX parser to use.
    private static final String PARSER_NAME = "org.apache.xerces.parsers.SAXParser";
    public static void main(String[] args)
       // Check to see whether the user supplied any command line arguments.  If not, print an error and exit.
       if (args.length == 0)
         System.out.println("No XML document path specified.");
         System.exit(1);
       // Create a new instance of the DocumentPrinter class.
       DocumentPrinter dp = new DocumentPrinter();
       try
         // Create a new instance of the XML Parser.
         XMLReader parser = (XMLReader)Class.forName(PARSER_NAME).newInstance();
         // Set the parser's content handler
        // parser.setContentHandler(dp);
         // Set the parsers error handler
         parser.setErrorHandler(dp);
         // Parse the file named in the argument
         parser.parse(args[0]);
       catch (Exception ex)
         System.out.println(ex.getMessage());
         ex.printStackTrace();
    public void characters(char[] ch, int start, int length)
       String chars ="";
       for (int i = start; i < start + length; i++)
         chars = chars + ch;
    System.out.println("Recieved characters: " + chars);
    public void startDocument()
    System.out.println("Start Document.");
    public void endDocument()
    System.out.println("End of Document.");
    public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
    System.out.println("Start element: " + localName);
    for (int i = 0; i < atts.getLength(); i++)
    System.out.println(" Attribute: " + atts.getLocalName(i));
    System.out.println(" Value: " + atts.getValue(i));
    public void endElement(String namespaceURI, String localName, String qName)
    System.out.println("End of element: " + localName);
    public void startPrefixMapping(String prefix, String uri)
    System.out.println("Prefix mapping: " + prefix);
    System.out.println("URI: " + uri);
    public void endPrefixMapping(String prefix)
    System.out.println("End of prefix mapping: " + prefix);
    public void ignorableWhitespace(char[] ch, int start, int length)
    System.out.println("Recieved whitespace.");
    public void processingInstruction(String target, String data)
    System.out.println("Recieved processing instruction:");
    System.out.println("Target: " + target);
    System.out.println("Data: " + data);
    public void setDocumentLocation(Locator locator)
    // Nada
    public void error(SAXParseException exception)
    System.out.println("Parsing error on line " + exception.getLineNumber());
    public void fatalError(SAXParseException exception)
    System.out.println("Fatal parsing error on line " + exception.getLineNumber());
    public void warning(SAXParseException exception)
    System.out.println("Warning on line " + exception.getLineNumber());

    Check to make sure that the arguments are consistent with your ContentHandler class. Probably the wrong type.
    I think you forgot to include the skippedEntity method, it seems to be missing. Even if an implemented class has a method that you are not using, you still have to include the method in your code even if it doesn't do anything.
    Message was edited by:
    ChargersTule1

  • "Your payment method was declined. Please enter another payment method" Error

    Hello,
    I've been trying to download an app for about two hours now. I recently got a new Macbook and iPad, my iPhone is a bit older and has been used frequently. I have only bought paid apps with my iPhone (and other iPad -- not usable currently). I have been trying to download a game which is $4.99 on my account, I have tried with my Mac, iPad, and iPhone, no luck. Every time I get a error saying "Your payment method was declined. Please enter another payment method". I know for a fact I have more than enough money to pay for this app. All the details have been checked and checked again. What is the problem?
    I also get an error when first buying the game (or attemting to) and it says something along the lines of "You've recently used a new device or computer to access this apple id, please sign in to confirm your purchase". That then leads to my confirmation of my security code on my card, which is triggering the first mentioned error.
    Apple Support has not yet given me a response, can any of you help?

    I think that for some international copyright issue, Apple is now blocking purchases from your store if they detect that your IP is outside the frontiers. I've been using my Canadian Visa Card for two years to purchase from France on ITune Store Canada and I never had a problem until today. Impossible to buy RunKeeper Pro. I get the same message you get. The only option seems to swithch back to IStore France and modify the account details with a french address and a french credit card.
    Are you in a similar situation?

  • No such method error

    Hi, I'm getting a message that reads: exception occured during event dispatching: java.lang.nosuchmethod error.
    Here's some of my code for a game of blackjack when I press the start game button everything works fine the textfield displays 2 cards and it gives me a total for the 2 cards.
    But when I press the hit button that's when I get the nosuchmethod error.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*; // added for event handling
    public class Blackjack_Frame
            final JFrame aFrame = new JFrame("MMSD 3610 Blackjack");
            Container contentPane = aFrame.getContentPane();
            aFrame.setSize(450, 200);
         // We don't need to set the layout manager for
         // a JFrame's content pane - it is automatically a
         // BorderLayout by default!
         // Technique for centering a frame on the screen.
         Dimension frameSize = aFrame.getSize();
         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
         aFrame.setLocation((screenSize.width - frameSize.width)/2,
                     (screenSize.height - frameSize.height)/2);
         aFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         // Let's create the leftmost panel.  Note that we use names
         // for our components that are somewhat self-documenting.
         JPanel leftPanel = new JPanel();
         // We'll assign the panel a GridLayout (it would otherwise
         // default to FlowLayout).
         leftPanel.setLayout(new GridLayout(3, 1));
         // We'll create two labels on the fly and hand them
         // to the panel; there's no need to bother maintaining
         // a named handle on any of these labels.
         leftPanel.add(new JLabel("BLACKJACK ! :"));
         leftPanel.add(new JLabel("Your hand:"));
         leftPanel.add(new JLabel("Dealers hand:"));
         // Now, we'll attach the panel to the frame.
         contentPane.add(leftPanel, BorderLayout.WEST);
         // Repeat the process with the center panel.
         JPanel centerPanel = new JPanel();
         centerPanel.setLayout(new GridLayout(3, 1));
         // Here we make the TextField un-editable to the users
         // but it is enabled so we can display the cards
            // to the user.
           final JTextField input1TextField = new JTextField(30);
         input1TextField.setEditable(false);
         input1TextField.setEnabled(true);
         JTextField input2TextField = new JTextField(30);
         input2TextField.setEditable(false);
         input2TextField.setEnabled(true);
         JTextField input3TextField = new JTextField(30);
         input3TextField.setEditable(false);
         input3TextField.setEnabled(true);
         centerPanel.add(input1TextField);
         centerPanel.add(input2TextField);
         centerPanel.add(input3TextField);
         contentPane.add(centerPanel, BorderLayout.CENTER);
         // This panel displays all the buttons.
         JPanel buttonPanel = new JPanel();
         buttonPanel.setLayout(new GridLayout(1, 4));
         JButton hitButton = new JButton("HIT");
         JButton stayButton = new JButton("STAY");
         JButton endGameButton = new JButton("END GAME");
         JButton startGameButton = new JButton("START GAME");
         buttonPanel.add(hitButton);
         buttonPanel.add(stayButton);
         buttonPanel.add(endGameButton);
         buttonPanel.add(startGameButton);
         contentPane.add(buttonPanel, BorderLayout.SOUTH);
         // I tried using named inner classes first but didn't have much
         // luck so I had better success with anonymous inner classes.
         // First, we create a listener object to respond to
         // the "START GAME" button.
               ActionListener listen = new ActionListener()
           public void actionPerformed(ActionEvent e)
             CardDeck deck = new CardDeck();
                  deck.shuffle();
                  Hand myHand = deck.dealHand(2);
                  Hand yourHand = deck.dealHand(2);
                 input1TextField.setText(" " + (myHand) +
                     ("  Dealer's hand has " + myHand.getBlackjackHandValue()));
         };  // After doing some research I found I had to use this weird };
                // syntax because I needed to terminate the single statement
                // " ActionListener listen = new ActionListener() "
             // ... and then we register this listener with the appropriate
             // component.
             startGameButton.addActionListener(listen);     
         // We do the same for the "HIT" button.
         listen = new ActionListener()
              public void actionPerformed(ActionEvent e)
               CardDeck deck = new CardDeck();
               deck.shuffle();
               Hand myHand1 = deck.dealHand(1);
                  Card newCard = myHand1.getCard();
    // I seem to be getting the error right here.
                  Hand myHand = newCard.addCardBackInHand();
                  input1TextField.setText(" " + (myHand) +
                     ("  Dealer's hand has " + myHand.getBlackjackHandValue()));
              hitButton.addActionListener(listen);
         // We do the same for the "END GAME" button.
         listen = new ActionListener()
              public void actionPerformed(ActionEvent e)
               aFrame.dispose();
               System.exit(0);
              endGameButton.addActionListener(listen);
           aFrame.setVisible(true);
    // Class defining a hand of cards and we use the ever so helpful Stack to store the hand.
    import java.util.*;
    // The compiler provides us with a default constructor and creates a hand object, which
    // contains a empty Stack or empty hand. We then add a card object by pushing it into
    // our Stack or hand.
    class Hand
      private Stack hand = new Stack();   // Stores the cards in the hand
      public void add(Card card)
        hand.push(card);
    // This method pulls a single card from the Hand.
      public Card getCard()
        return (Card)hand.pop();
    // This method returns the number of cards that are in the hand.
      public int getCardCount()
        return hand.size();
    // This method pushes the hit card back into the hand for display purposes.
       public Hand addCardBackInHand()
         return (Card)hand.push();
      // We need a way to display our hand so we use the toString() method again to display
      // a string representation of our hand object. Here I found another helpful little
      // item called the Iterator it allows me to deal one card at a time and store it in
      // my Stack hand. We also use a buffered stream because transferring data in a buffer
      // is a lot more efficient because it stores chunks of data in memory before
      // transferring the data to or from an external device.
      public String toString()
        Iterator cards = hand.iterator();
        StringBuffer str = new StringBuffer();
        while(cards.hasNext())
          str.append(" "+ (Card)cards.next());
        return str.toString();
      public int getBlackjackHandValue()
        int val;       // Value of the hand.
        boolean ace;   // This will be set to true if we have an ace in our hand.
        int cards;     // Number of cards in the hand.
    // Here we initalize our variables with a value.
        val = 0;
        ace = false;
        cards = getCardCount();
    // Here we use a for loop to loop thru the cards in the hand and then
    // determine a value for those cards.
        for (int i = 0; i < cards; i++)
          int cardVal;                // The value of the card.
          Card card;
          card = getCard();           // Get a card from the hand.
          cardVal = card.getValue();  // Get the value of the card which should
                                      // be between 1 to 13.
          if (cardVal > 10)
            cardVal = 10;  // This assigns a value of 10 to the face cards
          if (cardVal == 1)
            ace = true;   // We have an ace in our Blackjack hand.
            val = val + cardVal;
    // Since an ace can either be a 1 or 11 in blackjack we have to make
    // allowances for that so, if we have an ace and the value of the hand
    // is less than or equal to 21 we do that by adding an extra 10 points
    // to val.
          if (ace == true && val + 10 <= 21)
             val = val + 10;
          return val;  // the value of our blackjack hand.
    }Thanks...........gee mann

    Its hard to say without seeing the Classes CardDeck and Card... stilll let me guess
         listen = new ActionListener()
    public void actionPerformed(ActionEvent e)
         CardDeck deck = new CardDeck();
         deck.shuffle();
         Hand myHand1 = deck.dealHand(1);
    Card newCard = myHand1.getCard();
    // I seem to be getting the error right here.
    Hand myHand = newCard.addCardBackInHand();Are u sure the method addCardBackInHand() is in the class "Card"... I saw a method by that name in the class Hand.... Am i right?

Maybe you are looking for

  • I have bought a new laptop and I want sync and back-up my iPhone4 to the iTunes installed on my new laptop. How do I do it?

    Hi all, I have recently bought a new laptop. My old desktop PC has been used to sync and back-up my iPhone4. However, when I installed itunes on the new laptop and tried to sync the iphone I got the message "iPhone can only be synced with one iTunes

  • TS3074 iTunes not not installed correctly, Error 7, 998 -  but only sometimes

    I am using Windows 7.  Sometimes iTunes will not launch.  I get a message that says iTune was not installed properly - Error 7, 998.  I have deleted Apple programs (including iTunes) and reloaded them. I have added the net framework files that the he

  • KM Documnet Server

    Hi Frnds, I need small Help, i hope every one knows about this, I Want maintain KM in separate system, The Issue is I have to keep lots of PDF files @ production portal to get download for the End users, so this access links(to download) am using KM

  • Codec used in Live streaming

    Dear all I work with live streaming for a few weeks, using flash.media.Camera and flash.net.NetStream class. I have not found any place where the codec is specified, that is used to encode the live stream. Anyone knows which codec is used and if ther

  • Using iweb without Mac Me ?

    Hi, im new to all this and trying to use iweb to create a new site for myself. i cannot publish because Mac Me is no longer available and i dont have a previous subscription. i would like to use Mac to publish my site without going external is this s