You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beehive.apache.org by Timothy Brown <tb...@earthlink.net> on 2005/01/11 01:50:38 UTC

netui:textbox

Hello,
 I am getting the following error while trying to use the netui:texbox tag.
 Any ideas?

 Thanks,

 Tim

 Please enter your user name and password:
 [Tag Error:1, Found in tag TextBox]

 
----------------------------------------------------------------------------
 ----
      Page Errors
      Error Number Tag Type Error
      1 TextBox Message The expression "{{actionForm.username}}" is an
 invalid expression for a dataSource. Expressions in a dataSource must bind
 to a single property.


 JSP Code:

 <%@ page language="java" contentType="text/html;charset=UTF-8"%>
 <%@ taglib uri="/WEB-INF/beehive-netui-tags-html.tld" prefix="netui"%>

 <netui:html>
 <head>
     <title>Login page</title>
     <netui:base/>
 </head>
 <netui:body>
         <h2>Please enter your user name and password:</h2>
         <netui:form action="processLogin">
        <netui:textBox dataSource="{actionForm.username}"/>
            </netui:form>
 </netui:body>
 </netui:html>

 Controller Code:

 import javax.servlet.http.HttpSession;

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

 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;

 @Jpf.Controller
 public class Controller extends PageFlowController
 {
    @Jpf.Action(
        forwards={
           @Jpf.Forward(name="success", path="index.jsp")
        }
    )
    protected Forward begin()
    {
        return new Forward("success");
    }

    /**
     * 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){}

    @Jpf.Action(
        forwards={
           @Jpf.Forward(name="success", path="login.jsp")
        }
    )
    public Forward login()
    {
     return new Forward( "success" );
    }
    @Jpf.Action(
        forwards={
           @Jpf.Forward(name="authenticated", path="mypage.jsp"),
           @Jpf.Forward(name="not_authenticated", path="login.jsp")
        }
    )
    public Forward mypage()
    {
     HttpServletRequest request = getRequest();
     HttpSession session = request.getSession();

     if ( session.getAttribute( "authenticated_user ") != null )
     {
      return new Forward( "authenticated" );
     }
     return new Forward( "not_authenticated" );
    }

    @Jpf.Action(
        forwards={
           @Jpf.Forward(name="authenticated", path="mypage.jsp"),
           @Jpf.Forward(name="not_authenticated", path="login.jsp")
        }
    )
    public Forward processLogin( LoginForm form )
    {
     if ( form.getUsername().equalsIgnoreCase( "tibrown") )
     {
      return new Forward( "authenticated" );
     }
     return new Forward( "not_authenticated" );
    }
 public static class LoginForm extends FormData
 {
      private String username;

      public void setUsername(String username) {
           this.username = username;
      }

      public String getUsername() {
           return username;
      }

 }
 

}


Re: netui:textbox

Posted by Eddie O'Neil <ek...@bea.com>.
Tim--

   Looks like you've got a NetUI tag like:

   <netui:textBox dataSource="{actionForm.username}"/>

For Beehive/NetUI tags, this should look like:

   <netui:textBox dataSource="actionForm.username"/>

   For the sake of clarity and not confusing "{...}" with JSP 2.0 EL 
expressions as "${...}", NetUI tag dataSource attributes should not 
include curly braces.

   Hopefully, we'll get some documentation on the basics of databinding 
online soon.  In the meantime, hope this helps!

Eddie


Timothy Brown wrote:
> Hello,
>  I am getting the following error while trying to use the netui:texbox tag.
>  Any ideas?
> 
>  Thanks,
> 
>  Tim
> 
>  Please enter your user name and password:
>  [Tag Error:1, Found in tag TextBox]
> 
>  
> ----------------------------------------------------------------------------
>  ----
>       Page Errors
>       Error Number Tag Type Error
>       1 TextBox Message The expression "{{actionForm.username}}" is an
>  invalid expression for a dataSource. Expressions in a dataSource must bind
>  to a single property.
> 
> 
>  JSP Code:
> 
>  <%@ page language="java" contentType="text/html;charset=UTF-8"%>
>  <%@ taglib uri="/WEB-INF/beehive-netui-tags-html.tld" prefix="netui"%>
> 
>  <netui:html>
>  <head>
>      <title>Login page</title>
>      <netui:base/>
>  </head>
>  <netui:body>
>          <h2>Please enter your user name and password:</h2>
>          <netui:form action="processLogin">
>         <netui:textBox dataSource="{actionForm.username}"/>
>             </netui:form>
>  </netui:body>
>  </netui:html>
> 
>  Controller Code:
> 
>  import javax.servlet.http.HttpSession;
> 
>  import org.apache.beehive.netui.pageflow.Forward;
>  import org.apache.beehive.netui.pageflow.FormData;
>  import org.apache.beehive.netui.pageflow.PageFlowController;
>  import org.apache.beehive.netui.pageflow.annotations.Jpf;
> 
>  import javax.servlet.http.HttpServletRequest;
>  import javax.servlet.http.HttpSession;
> 
>  @Jpf.Controller
>  public class Controller extends PageFlowController
>  {
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="success", path="index.jsp")
>         }
>     )
>     protected Forward begin()
>     {
>         return new Forward("success");
>     }
> 
>     /**
>      * 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){}
> 
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="success", path="login.jsp")
>         }
>     )
>     public Forward login()
>     {
>      return new Forward( "success" );
>     }
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="authenticated", path="mypage.jsp"),
>            @Jpf.Forward(name="not_authenticated", path="login.jsp")
>         }
>     )
>     public Forward mypage()
>     {
>      HttpServletRequest request = getRequest();
>      HttpSession session = request.getSession();
> 
>      if ( session.getAttribute( "authenticated_user ") != null )
>      {
>       return new Forward( "authenticated" );
>      }
>      return new Forward( "not_authenticated" );
>     }
> 
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="authenticated", path="mypage.jsp"),
>            @Jpf.Forward(name="not_authenticated", path="login.jsp")
>         }
>     )
>     public Forward processLogin( LoginForm form )
>     {
>      if ( form.getUsername().equalsIgnoreCase( "tibrown") )
>      {
>       return new Forward( "authenticated" );
>      }
>      return new Forward( "not_authenticated" );
>     }
>  public static class LoginForm extends FormData
>  {
>       private String username;
> 
>       public void setUsername(String username) {
>            this.username = username;
>       }
> 
>       public String getUsername() {
>            return username;
>       }
> 
>  }
>  
> 
> }
> 
> 

Re: netui:textbox

Posted by Carlin Rogers <ca...@bea.com>.
Hi Tim,

try removing the braces from the datasource attribute in the JSP.
I.E.
     <netui:textBox dataSource="actionForm.username"/>

rather than

     <netui:textBox dataSource="{actionForm.username}"/>


Hope that helps. Regards,
Carlin

Timothy Brown wrote:

> Hello,
>  I am getting the following error while trying to use the netui:texbox tag.
>  Any ideas?
> 
>  Thanks,
> 
>  Tim
> 
>  Please enter your user name and password:
>  [Tag Error:1, Found in tag TextBox]
> 
>  
> ----------------------------------------------------------------------------
>  ----
>       Page Errors
>       Error Number Tag Type Error
>       1 TextBox Message The expression "{{actionForm.username}}" is an
>  invalid expression for a dataSource. Expressions in a dataSource must bind
>  to a single property.
> 
> 
>  JSP Code:
> 
>  <%@ page language="java" contentType="text/html;charset=UTF-8"%>
>  <%@ taglib uri="/WEB-INF/beehive-netui-tags-html.tld" prefix="netui"%>
> 
>  <netui:html>
>  <head>
>      <title>Login page</title>
>      <netui:base/>
>  </head>
>  <netui:body>
>          <h2>Please enter your user name and password:</h2>
>          <netui:form action="processLogin">
>         <netui:textBox dataSource="{actionForm.username}"/>
>             </netui:form>
>  </netui:body>
>  </netui:html>
> 
>  Controller Code:
> 
>  import javax.servlet.http.HttpSession;
> 
>  import org.apache.beehive.netui.pageflow.Forward;
>  import org.apache.beehive.netui.pageflow.FormData;
>  import org.apache.beehive.netui.pageflow.PageFlowController;
>  import org.apache.beehive.netui.pageflow.annotations.Jpf;
> 
>  import javax.servlet.http.HttpServletRequest;
>  import javax.servlet.http.HttpSession;
> 
>  @Jpf.Controller
>  public class Controller extends PageFlowController
>  {
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="success", path="index.jsp")
>         }
>     )
>     protected Forward begin()
>     {
>         return new Forward("success");
>     }
> 
>     /**
>      * 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){}
> 
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="success", path="login.jsp")
>         }
>     )
>     public Forward login()
>     {
>      return new Forward( "success" );
>     }
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="authenticated", path="mypage.jsp"),
>            @Jpf.Forward(name="not_authenticated", path="login.jsp")
>         }
>     )
>     public Forward mypage()
>     {
>      HttpServletRequest request = getRequest();
>      HttpSession session = request.getSession();
> 
>      if ( session.getAttribute( "authenticated_user ") != null )
>      {
>       return new Forward( "authenticated" );
>      }
>      return new Forward( "not_authenticated" );
>     }
> 
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="authenticated", path="mypage.jsp"),
>            @Jpf.Forward(name="not_authenticated", path="login.jsp")
>         }
>     )
>     public Forward processLogin( LoginForm form )
>     {
>      if ( form.getUsername().equalsIgnoreCase( "tibrown") )
>      {
>       return new Forward( "authenticated" );
>      }
>      return new Forward( "not_authenticated" );
>     }
>  public static class LoginForm extends FormData
>  {
>       private String username;
> 
>       public void setUsername(String username) {
>            this.username = username;
>       }
> 
>       public String getUsername() {
>            return username;
>       }
> 
>  }
>  
> 
> }
> 
> 


Re: netui:textbox

Posted by Daryl Olander <do...@gmail.com>.
In Beehive, we have dropped the '{' and '}' from all dataSource
attributes for expressions.  All other attributes on the tags take the
standard JSP 2.0 format ${xxxx}.  We dropped the braces because we
felt it confusing to have the dataSource and JSP expressions being so
similar.  We are in fact, much closer to Struts now.


On Mon, 10 Jan 2005 19:50:38 -0500, Timothy Brown
<tb...@earthlink.net> wrote:
> Hello,
>  I am getting the following error while trying to use the netui:texbox tag.
>  Any ideas?
> 
>  Thanks,
> 
>  Tim
> 
>  Please enter your user name and password:
>  [Tag Error:1, Found in tag TextBox]
> 
> ----------------------------------------------------------------------------
>  ----
>       Page Errors
>       Error Number Tag Type Error
>       1 TextBox Message The expression "{{actionForm.username}}" is an
>  invalid expression for a dataSource. Expressions in a dataSource must bind
>  to a single property.
> 
>  JSP Code:
> 
>  <%@ page language="java" contentType="text/html;charset=UTF-8"%>
>  <%@ taglib uri="/WEB-INF/beehive-netui-tags-html.tld" prefix="netui"%>
> 
>  <netui:html>
>  <head>
>      <title>Login page</title>
>      <netui:base/>
>  </head>
>  <netui:body>
>          <h2>Please enter your user name and password:</h2>
>          <netui:form action="processLogin">
>         <netui:textBox dataSource="{actionForm.username}"/>
>             </netui:form>
>  </netui:body>
>  </netui:html>
> 
>  Controller Code:
> 
>  import javax.servlet.http.HttpSession;
> 
>  import org.apache.beehive.netui.pageflow.Forward;
>  import org.apache.beehive.netui.pageflow.FormData;
>  import org.apache.beehive.netui.pageflow.PageFlowController;
>  import org.apache.beehive.netui.pageflow.annotations.Jpf;
> 
>  import javax.servlet.http.HttpServletRequest;
>  import javax.servlet.http.HttpSession;
> 
>  @Jpf.Controller
>  public class Controller extends PageFlowController
>  {
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="success", path="index.jsp")
>         }
>     )
>     protected Forward begin()
>     {
>         return new Forward("success");
>     }
> 
>     /**
>      * 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){}
> 
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="success", path="login.jsp")
>         }
>     )
>     public Forward login()
>     {
>      return new Forward( "success" );
>     }
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="authenticated", path="mypage.jsp"),
>            @Jpf.Forward(name="not_authenticated", path="login.jsp")
>         }
>     )
>     public Forward mypage()
>     {
>      HttpServletRequest request = getRequest();
>      HttpSession session = request.getSession();
> 
>      if ( session.getAttribute( "authenticated_user ") != null )
>      {
>       return new Forward( "authenticated" );
>      }
>      return new Forward( "not_authenticated" );
>     }
> 
>     @Jpf.Action(
>         forwards={
>            @Jpf.Forward(name="authenticated", path="mypage.jsp"),
>            @Jpf.Forward(name="not_authenticated", path="login.jsp")
>         }
>     )
>     public Forward processLogin( LoginForm form )
>     {
>      if ( form.getUsername().equalsIgnoreCase( "tibrown") )
>      {
>       return new Forward( "authenticated" );
>      }
>      return new Forward( "not_authenticated" );
>     }
>  public static class LoginForm extends FormData
>  {
>       private String username;
> 
>       public void setUsername(String username) {
>            this.username = username;
>       }
> 
>       public String getUsername() {
>            return username;
>       }
> 
>  }
> 
> }
> 
>