Hello, I am new to XMLFORM. I followed the howto instructions. I use Jbuilder tool. I beleive, the userbean and WizardAction has to compiled. While compiling I get tht following error:
************************************ "WizardAction.java": Error #: 300 : class UserBean1 not found in class rertn_frontapp.WizardAction at line 172, column 5 "WizardAction.java": Error #: 300 : class UserBean1 not found in class rertn_frontapp.WizardAction at line 172, column 25 ************************************ The WizardAction is not able to access the userbean. and the compilation fails. Is there something I am missing? Please excuse my naievty to XMLFORM. The code is below , basicaly i modified and remarked the cocoon's sample code: ************************************** /* * $Header: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/samples/xmlform/WizardActio n.java,v 1.5 2002/07/04 20:57:47 ivelin Exp $ * $Revision: 1.5 $ * $Date: 2002/07/04 20:57:47 $ * * ==================================================================== * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation and was * originally based on software copyright (c) 2001, Plotnix, Inc, * <http://www.plotnix.com/>. * For more information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ //package org.apache.cocoon.samples.xmlform; package rertn_frontapp; // Java classes import java.util.Map; // Framework classes import org.apache.excalibur.source.Source; // Cocoon Form import org.apache.cocoon.acting.AbstractXMLFormAction; import org.apache.cocoon.components.xmlform.Form; import org.apache.cocoon.components.xmlform.FormListener; //import rertn_frontapp.xmlform.UserBean1; /** * This action demonstrates * a relatively complex form handling scenario. * * @author Ivelin Ivanov <[EMAIL PROTECTED]> */ public class WizardAction extends AbstractXMLFormAction implements FormListener { // different form views // participating in the wizard final String VIEW_START = "start"; final String VIEW_USERID = "userIdentity"; // final String VIEW_DEPLOYMENT = "deployment"; // final String VIEW_SYSTEM = "system"; final String VIEW_CONFIRM = "confirm"; final String VIEW_END = "end"; // action commands used in the wizard final String CMD_START = "start"; final String CMD_NEXT = "next"; final String CMD_PREV = "prev"; /** * The first callback method which is called * when an action is invoked. * * It is called before population. * * * @return null if the Action is prepared to continue. * an objectModel map which will be immediately returned by the action. * * This method is a good place to handle buttons with Cancel * kind of semantics. For example * <pre>if getCommand().equals("Cancel") return page("input");</pre> * */ protected Map prepare() { if ( getCommand() == null ) { // initial link return page( VIEW_START ); } else if ( getCommand().equals( CMD_START ) ) { // reset state by removing old form // if one exists Form.remove( getObjectModel(), getFormId() ); getForm().addFormListener( this ); return page( VIEW_USERID ); } else if ( Form.lookup ( getObjectModel(), getFormId() ) == null) { // session expired return page( VIEW_START ); } // get ready for action // if not ready return page("whereNext"); return null; } /** * Invoked after form population * * Semanticly similar to Struts Action.perform() * * Take appropriate action based on the command * */ public Map perform () { // get the actual model which this Form encapsulates // and apply additional buziness logic to the model UserBean jBean = (UserBean) getForm().getModel(); jBean.incrementCount(); // set the page control flow parameter // according to the validation result if ( getCommand().equals( CMD_NEXT ) && getForm().getViolations () != null ) { // errors, back to the same page return page( getFormView() ); } else { // validation passed // continue with control flow // clear validation left overs in case the user // did not press the Next button getForm().clearViolations(); // get the user submitted command (through a submit button) String command = getCommand(); // get the form view which was submitted String formView = getFormView(); // apply control flow rules if ( formView.equals ( VIEW_USERID ) ) { if ( command.equals( CMD_NEXT ) ) { return page( VIEW_CONFIRM ); // return page( VIEW_DEPLOYMENT ); } } /* else if ( formView.equals ( VIEW_DEPLOYMENT ) ) { if ( command.equals( CMD_NEXT ) ) { return page( VIEW_SYSTEM ); } else if( command.equals( CMD_PREV ) ) return page( VIEW_USERID ); } else if ( formView.equals ( VIEW_SYSTEM ) ) { if ( command.equals( CMD_NEXT ) ) { return page( VIEW_CONFIRM ); } else if( command.equals( CMD_PREV ) ) return page( VIEW_DEPLOYMENT ); } */ else if ( formView.equals ( VIEW_CONFIRM ) ) { if ( command.equals( CMD_NEXT ) ) { Form.remove( getObjectModel(), getFormId() ); return page( VIEW_END ); } else if( command.equals( CMD_PREV ) ) return page( VIEW_USERID ); } } // should never reach this statement return page( VIEW_START ); } /** * * FormListener callback * called in the beginning Form.populate() * before population starts. * * This is the place to handle unchecked checkboxes. * */ public void reset( Form form ) { // based on the current form view // make some decisions regarding checkboxes, etc. String formView = getFormView(); /* if ( formView.equals ( VIEW_DEPLOYMENT ) ) { // deal with the publish checkbox form.setValue( "/publish", Boolean.FALSE ); } else if ( formView.equals ( VIEW_USERID ) ) { // deal with the publish checkbox UserBean ub = (UserBean) form.getModel(); ub.initRoles (); } */ } /** * FormListener callback * * Invoked during Form.populate(); * * It is invoked before a request parameter is mapped to * an attribute of the form model. * * It is appropriate to use this method for filtering * custom request parameters which do not reference * the model. * * Another appropriate use of this method is for graceful filtering of invalid * values, in case that knowledge of the system state or * other circumstainces make the standard validation * insufficient. For example if a registering user choses a username which * is already taken - the check requires database transaction, which is * beyond the scope of document validating schemas. * Of course customized Validators can be implemented to do * this kind of domain specific validation * instead of using this method. * * * @return false if the request parameter should not be filtered. * true otherwise. */ public boolean filterRequestParameter (Form form, String parameterName) { // TBD return false; } public String getFile( String FileName ) { Source source = null; try { source = getSourceResolver().resolveURI(FileName); final String FILE_PREFIX = "file:"; String path = source.getSystemId(); if(path.startsWith(FILE_PREFIX)) path = path.substring(FILE_PREFIX.length()); return path; } catch(Exception e) { getLogger().error("could not read mapping file",e); return null; } finally { this.getSourceResolver().release( source ); } } } ************************************** and this is the userbean1 which compiles fine without any error: *************************************** //package org.apache.cocoon.samples.xmlform; package rertn_frontapp; import java.util.Set; import java.util.HashSet; import java.util.List; import java.util.ArrayList; import org.w3c.dom.*; import javax.xml.parsers.*; import javax.xml.transform.*; /** * * A sample domain object used as a Form model. * Notice that it has mixed content: * JavaBean properties and * DOM Nodes, which are handled correctly by the * framework when referenced via XPath. * */ public class UserBean1 { private String city = "MUMBAI"; private String propTypeCat = "RESIDENTIAL"; private String propType = ""; /* private String email = "[EMAIL PROTECTED]"; private int age = 5; private int count = 1; private short numInstalls = 1; private String liveUrl = "http://"; private boolean publish = true; private List favorites = new ArrayList(); private List roles = new ArrayList(); private String hobbies[]; */ private boolean hidden = false; private Node system; public UserBean1 () { // initDomNode(); // initRoles(); // initFavorites(); // initHobbies(); } public String getCity() { return city; } public void setCity(String vcity) { city = vcity; } public String getPropTypeCat() { return propTypeCat; } public void setPropTypeCat(String vpropTypeCat) { propTypeCat = vpropTypeCat; } public String getPropType() { return propType; } public void setPropType(String vpropType ) { propType = vpropType; } /* public boolean getPublish() { return publish; } public void setPublish( boolean newPublish ) { publish = newPublish; } public Node getSystem() { return system; } public void setSystem( Node newSystem ) { system = newSystem; } */ public boolean getHidden() { return hidden; } public void setHidden( boolean newHidden ) { hidden = newHidden; } /* public int getCount() { return count; } public void incrementCount() { count++; } */ /* public void initDomNode() { DOMImplementation impl; try { // Find the implementation DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(false); factory.setValidating ( false ); DocumentBuilder builder = factory.newDocumentBuilder(); impl = builder.getDOMImplementation(); } catch (Exception ex) { throw new RuntimeException("Failed to initialize DOM factory. Root cause: \n" + ex); } // initialize system as dom node Document doc = impl.createDocument( null, "XMLForm_Wizard_System_Node", null); Node rootElement = doc.getDocumentElement(); Node os = doc.createElement ( "os" ); Text text = doc.createTextNode( "Linux" ); os.appendChild(text); rootElement.appendChild( os ); Node processor = doc.createElement ( "processor" ); text = doc.createTextNode( "p4" ); processor.appendChild(text); rootElement.appendChild( processor ); Attr ram = doc.createAttribute ( "ram" ); ram.setValue ( "512" ); NamedNodeMap nmap = rootElement.getAttributes(); nmap.setNamedItem ( ram ); Node servletEngine = doc.createElement ( "servletEngine" ); text = doc.createTextNode( "Tomcat" ); servletEngine.appendChild(text); rootElement.appendChild( servletEngine ); Node javaVersion = doc.createElement ( "javaVersion" ); text = doc.createTextNode( "1.3" ); javaVersion.appendChild(text); rootElement.appendChild( javaVersion ); system = rootElement; } */ /* public List getRole() { return roles; } public void setRole( List newRoles ) { roles = newRoles; } public String[] getHobby() { return hobbies; } public void setHobby( String[] newHobbies ) { hobbies = newHobbies; } public List getFavorite() { return favorites; } public void setFavorite( List newFavorites ) { favorites = newFavorites; } public void initRoles() { roles = new ArrayList(); } public void initHobbies() { hobbies = new String[] {"swim", "movies", "ski", "gym", "soccer"}; } public void initFavorites() { favorites.add( "http://xml.apache.org/cocoon" ); favorites.add( "http://jakarta.apache.org" ); favorites.add( "http://www.google.com" ); favorites.add( "http://www.slashdot.org" ); favorites.add( "http://www.yahoo.com" ); } */ } *********************************************** Thankyou in advance. -Apurva Zaveri __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]