In fact the link I have sent you tells you, what you should add in the property
attribute :
<html:text property="value(username)"/>
<html:password property="value(password)"/>

try now.

Ovidiu


----- Original Message ----- 
From: "Agashivala, Vishal" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, November 20, 2003 11:55 AM
Subject: RE: Map Backed Action Form


> As you have suggested I have updated my jsp as shown below-
> BUT NOW it gives me error "No getter method for property username of bean
> org.apache.struts.taglib.html.BEAN".. i think it tries to find the
> getUsername and getPassword.. And in my ActionForm bean has only getValue
> and setValue functions...How do i deal with this now?
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
> <HTML>
> <HEAD>
> <TITLE>Login Page</TITLE>
> </HEAD>
> <BODY>
> Login
> <BR>
> <logic:equal name="GenForm" property="action"
> scope="request">
> <html:form method="post" action="/button">
> Username:<html:text property="username"/>
> Password:<html:password property="password"/>
> </logic:equal>
>
> <INPUT TYPE="submit" value="SignIn">
> </html:form>
> </BODY>
> </HTML>
>
> Regards,
> Vishal Agashivala
> Atos Origin India
> O: +91-22-5691 3870
>
>
> -----Original Message-----
> From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 20, 2003 3:46 PM
> To: Struts Users Mailing List
> Subject: Re: Map Backed Action Form
>
>
> The jsp you're using for this example should contain the struts
> taglibs and
> should look like this
>
> <html:form action="/login">
>   Login  <html:text property="login"/>
>    Password: <html:password property="password"/>
> </html:form>
>
> Ovidiu
> ----- Original Message ----- 
> From: "Agashivala, Vishal" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Thursday, November 20, 2003 11:14 AM
> Subject: RE: Map Backed Action Form
>
>
> > See basically currently I am just testing so I know what
> key/value are there
> > in that HASHMAP. So i am just directly querring the username
> and password
> > but it did not show up the value which i v inserted in those
> field of JSPs
> > rather it prints 'null' for both. So i dont know where I am
> wrong and is
> > there any other setting / procedure i v to make. Is anything wrong in
> > struts-config????
> >
> > Regards,
> > Vishal Agashivala
> > Atos Origin India
> > O: +91-22-5691 3870
> >
> >
> > -----Original Message-----
> > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, November 20, 2003 3:13 PM
> > To: Struts Users Mailing List
> > Subject: Re: Map Backed Action Form
> >
> >
> > In your Action, CommonEventHandler , you'll decide, based on
> > tha value of a
> > certain field, which should be present in all your jsp and
> > let's call it op,
> > what you should do . So for example
> > in your CommonEventHandler you'll have
> >   public ActionForward execute(ActionMapping mapping, ActionForm form,
> > HttpServletRequest request, HttpServletResponse response)
> > throws Exception
> >      {
> >         GenForm gform = (GenForm)form;
> >         String op = (String)gform.getValue("op");
> >         if(op.equals("Signin")){
> >                 String login = (String)gform.getValue("login");
> >                 String password = (String)gform.getValue("password");
> >                 //do your stuff here
> >         }else if(op.equals("Signout")){
> > ......................................
> >         }
> > }
> > So based on your op parameter you'll know what you have in your
> > GenForm each
> > time you're executing CommonEventHandler.
> > That's a way to do it, but you could also have your
> > CommonEventHandler extends
> > DispatchAction and implement this in a more clean way
> >
> > Ovidiu
> >
> >
> >
> > ----- Original Message ----- 
> > From: "Agashivala, Vishal" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Thursday, November 20, 2003 10:09 AM
> > Subject: RE: Map Backed Action Form
> >
> >
> > > Hi
> > > I have checked the URL which you have suggested but there I
> > did not find the
> > > example of accessing a field value of form in Action class.
> > It only gives to
> > > use it JSP via <html:text property="property(1)"/>.
> > > Can you give me some more information on the same?????
> > >
> > > Thanks and Regards,
> > > Vishal Agashivala
> > > Atos Origin India
> > > O: +91-22-5691 3870
> > >
> > >
> > > -----Original Message-----
> > > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, November 20, 2003 2:18 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: Map Backed Action Form
> > >
> > >
> > > Look here
> > > http://puneetdelhi.tripod.com/
> > > Designing Screens For Variable Number Of Fields
> > >
> > >
> > > ----- Original Message ----- 
> > > From: "Agashivala, Vishal" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Thursday, November 20, 2003 7:17 AM
> > > Subject: RE: Map Backed Action Form
> > >
> > >
> > > > First up all I like to thanks Rick since you have reply.
> > > Basically I am new
> > > > here..
> > > > I tried to give all the details-
> > > > Actually, I am trying to implement the common ActionForm
> > > which holds the
> > > > value of the JSP/HTML fields. So then I did not need to
> > implement the
> > > > ActionForm for all my jsps. This ActionForm will pass it to
> > > common Action
> > > > Class that will be responsible to handle all the events. For
> > > of now I need
> > > > this much functionality.
> > > > To accomplish this I found out in the struts docs that you
> > > can use 'MAP
> > > > BACKED ACTIONFORM' so then I have tried that as follows-
> > > >
> > > > //Common ActionForm-
> > > > package com.web.controller;
> > > >
> > > > import java.util.Map;
> > > > import java.util.HashMap;
> > > > import java.util.Iterator;
> > > > import org.apache.struts.action.ActionForm;
> > > >
> > > > public class GenForm extends ActionForm
> > > > {
> > > >     private final Map values = new HashMap();
> > > >
> > > >     public void GenForm()
> > > >     {
> > > >         System.out.println("GenForm Constructor");
> > > >     }
> > > >     public void setValue(String key, Object value)
> > > >     {
> > > >         System.out.println("Keys=" + key + " ;value=" + value);
> > > >         values.put(key, value);
> > > >     }
> > > >
> > > >     public Object getValue(String key) {
> > > >         return values.get(key);
> > > >     }
> > > > }
> > > >
> > > > //Common Action Class
> > > > package com.web.controller;
> > > > import java.lang.reflect.Field;
> > > > import java.lang.reflect.Method;
> > > > import java.lang.reflect.Modifier;
> > > > import java.util.Enumeration;
> > > > import javax.servlet.http.HttpServletRequest;
> > > > import javax.servlet.http.HttpServletResponse;
> > > >
> > > >
> > > > import org.apache.struts.action.Action;
> > > > import org.apache.struts.action.ActionForward;
> > > > import org.apache.struts.action.ActionMapping;
> > > > import org.apache.struts.action.ActionForm;
> > > > import org.apache.struts.config.impl.ModuleConfigImpl;
> > > >
> > > > import com.web.controller.GenForm;
> > > >
> > > >
> > > > public class CommonEventHandler extends Action
> > > > {
> > > >
> > > >     public ActionForward execute(ActionMapping mapping,
> > > ActionForm form,
> > > > HttpServletRequest request, HttpServletResponse response)
> > > throws Exception
> > > >     {
> > > >         System.out.println("reached here");
> > > >
> > > >         if (form == null)
> > > >         {
> > > >             System.out.println("Action Form is null");
> > > >         }
> > > >         else
> > > >         {
> > > >             System.out.println("Action Form is Filled");
> > > >
> > > >         }
> > > >
> > > >         System.out.println(((GenForm)form).getValue("username"));
> > > >         return null;
> > > >     }
> > > >
> > > > //struts-config Entries
> > > >   <form-beans>
> > > >     <!-- Generic form bean -->
> > > >     <form-bean      name="GenForm"
> > > >                     type="com.web.controller.GenForm"/>
> > > >   </form-beans>
> > > >
> > > >   <action-mappings>
> > > >     <action    path="/button"
> > > >                type="com.web.controller.CommonEventHandler"
> > > >           name="GenForm"
> > > >               scope="request"
> > > >            validate="false"
> > > >    input="login.jsp">
> > > >       <forward name="failure" path="/mainMenu.jsp"/>
> > > >       <forward name="success"   path="/jsps/t.jsp"/>
> > > >     </action>
> > > >
> > > > //Login JSP
> > > > <HTML>
> > > > <HEAD>
> > > > <TITLE>Login Page</TITLE>
> > > > </HEAD>
> > > > <BODY>
> > > > Login
> > > > <BR>
> > > > <FORM METHOD=POST ACTION="button">
> > > > Username:<INPUT TYPE="text" NAME="username">
> > > > Password:<INPUT TYPE="text" NAME="password">
> > > > <INPUT TYPE="submit" value="SignIn">
> > > > </FORM>
> > > > </BODY>
> > > > </HTML>
> > > >
> > > > Now, for of now I have not coded forward and all.. If in the
> > > Action Class, I
> > > > ll get fields value for username and password then I can go
> > > ahead. Control
> > > > has reached upto CommonEventHandler Action class but
> > > ActionForm has not
> > > > filled up with the username and password?
> > > >
> > > > So, now my questions are -
> > > > 1. Is am I on a right track???
> > > > 2. Is this possible in Struts Framework what I need?
> > > > 3. Is there any other way around or any other framwork which
> > > I can use to
> > > > accomplish my requirement?
> > > >
> > > > Kindly get back to me If you have any further queries.
> > > Expecting some one
> > > > will help me in this struts world.
> > > >
> > > > Thanks and Regards,
> > > > Vishal Agashivala
> > > >
> > > > -----Original Message-----
> > > > From: Rick Reumann [mailto:[EMAIL PROTECTED]
> > > > Sent: Wednesday, November 19, 2003 10:20 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: Map Backed Action Form
> > > >
> > > >
> > > > Agashivala, Vishal wrote:
> > > >
> > > > > Hi
> > > > > Can anyone help me to implement MAP BACKED ACTION FORM???
> > > > > In this forum, I see 100 of mails but wht I am try to get
> > > > help on is not
> > > > > there..And NO ONE IS HERE TO HELP ME OUT?? AM I ASKING SOME
> > > > irrelevant info
> > > > > here?? If so atleast write to me so that i can think of other
> > > > way to work
> > > > > around..Atlest some one reply to my message
> > > > > Regards,
> > > >
> > > > Why don't you explain what you need help with? Like what you
> > > have tried
> > > > so far? What you want to accomplish? What isn't working?
> > > Anything would
> > > > be helpful to give us some direction. My first question would
> > > be why do
> > > > you want to back your form by a Map?
> > > >
> > > > -- 
> > > > Rick
> > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to