You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beehive.apache.org by Adam Jenkins <ma...@adamjenkins.net> on 2005/06/04 22:59:03 UTC

login example returning odd error?

Hi All,

I'm trying to do a simple login example with beehive and pollinate.  I'm
getting the following error:

The type of a button must be one of submit, button or reset, found
'POST'.

My controller is very simple:

package Server;

import javax.servlet.http.HttpSession;

import org.apache.beehive.netui.pageflow.Forward;
import org.apache.beehive.netui.pageflow.PageFlowController;
import org.apache.beehive.netui.pageflow.annotations.Jpf;

@Jpf.Controller
public class Controller 
    extends PageFlowController
{
    /**
     * Callback that is invoked when this controller instance is
created.
     */
    protected void onCreate()
    {
    }

    /**
     * Callback that is invoked when this controller instance is
destroyed.
     */
    protected void onDestroy(HttpSession session)
    {
    }
    
    /**
	 * Performs the login action.
	 * 
	 * @since	2.0
	 * @param	form		The login form.
	 * @return	The forward.
	 */
    @Jpf.Action(
			forwards={
					@Jpf.Forward(name="login_sucess", path="main.jsp"),
					@Jpf.Forward(name="login_failure", path="index.jsp")
			}
			
    )
    public Forward processLogin(final LoginForm form){
		if(form.getPassword().equals("password")) return new
Forward("login_success");
		return new Forward("login_failure");
    }
    
    /**
	 * Standard begin method.
	 *
	 * @since	2.0
	 * @return	The forward (always 'success').
	 */
    @Jpf.Action(forwards = { @Jpf.Forward(name = "success", path =
"index.jsp") })
	public Forward begin() {
		return new Forward("success");
	}

	//-----------BEGIN INNER CLASSES-----------------//
    /**
	 * Form to represent the login information.
	 *
	 * @author	<a href="mailto:ajenkins@infocomp.com">Adam Jenkins</a>
	 * @since	2.0
	 */
    /**
     * @author adam
     *
     */
    public static final class LoginForm implements java.io.Serializable{
		
		/**
 		 * The password.
		 */
		private String password;
		
		/**
		 * Gets the password.
		 *
		 * @since	2.0
		 * @return	The password
		 */
		public String getPassword() {
			return password;
		}
		
		/**
		 * Sets the password.
		 *
		 * @since	2.0
		 * @param	password	The password.
		 */
		public void setPassword(String password) {
			this.password = password;
		}			
		
    }   
	//------------END INNER CLASSES-----------------//    
}

And the index.jsp is even simpler:

<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0"
prefix="netui-data"%>
<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0"
prefix="netui"%>
<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0"
prefix="netui-template"%>
<netui:html>
  <head>
    <title>Login</title>
    <netui:base/>
  </head>
  <netui:body>
	<netui:form action="processLogin" method="POST">
	  <netui:textBox dataSource="actionForm.password" size="20"
password="true"/>
	  <netui:button  type="submit" value="Login"/>
	</netui:form>
  </netui:body>
</netui:html>


Those are the only two pages (apart from main.jsp which only has
<p>Logged In</p>)

Does anyone have any ideas?

Cheers
Adam