You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mohan Radhakrishnan <Mo...@hclcomnet.co.in> on 2003/03/13 10:31:14 UTC

Hi,
    I have a dumb question to ask.

     What does the tag <html:form do that document.form.submit() doesn't do
?

    If there is a considerable difference between these two methods, then it
might explain some of the things we have been facing here.

Mohan



-----Original Message-----
From: Ian Hunter [mailto:ihunter@hunterweb.net]
Sent: Thursday, March 13, 2003 7:21 AM
To: Struts Users Mailing List
Subject: Accessing DynaActionForm fields within custom tag


I have a form where the submit button is supposed to say "add login" or
"update login" depending on if the user in question (based on field
fkMember) already exists in the login database.  I have tags called HasLogin
and HasNoLogin that take an integer parameter, and return whether or not the
condition is true.

I am using a DynaActionForm to populate the rest of the fields.  The
DynaActionForm is a session scoped bean called "loginForm" -- the following
code actually works:

<!-- form tags and all that above -->
<td><html:submit>
<jsp:useBean id="loginForm" scope="session"
class="org.apache.struts.action.DynaActionForm"/>
<app:HasNoLogin idMember="<%=new Integer
(Integer.parseInt((String)loginForm.get("fkMember")))%>">
<bean:message key="button.addlogin"/>
</app:HasNoLogin>
<app:HasLogin idMember="<%=new Integer
(Integer.parseInt((String)loginForm.get("fkMember")))%>">
<bean:message key="button.updatelogin"/>
</app:HasLogin>
</html:submit></td>
<!-- rest of page below -->

The syntax above offends my sensibilities.  First, I ought to be able to
refer to the bean in question without using a <jsp:useBean> I think; it's
obviously available to the rest of the form, if the form works (and it
does).  Seconds, casting the get() as a String and doing a parseInt to it to
create a new Integer is silly.

Isn't there a more elegant way to do this?

Ian


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Posted by Mark Lowe <ml...@officinedigitali.it>.
One is a javascript method that allows you to submit a form, the other 
a jsp tag that renders to an html form when its asociated with a form 
bean..

Or have i miss understood the question?



Giovedì, 13 mar 2003, alle 10:31 Europe/Rome, Mohan Radhakrishnan ha 
scritto:

> Hi,
>     I have a dumb question to ask.
>
>      What does the tag <html:form do that document.form.submit() 
> doesn't do
> ?
>
>     If there is a considerable difference between these two methods, 
> then it
> might explain some of the things we have been facing here.
>
> Mohan
>
>
>
> -----Original Message-----
> From: Ian Hunter [mailto:ihunter@hunterweb.net]
> Sent: Thursday, March 13, 2003 7:21 AM
> To: Struts Users Mailing List
> Subject: Accessing DynaActionForm fields within custom tag
>
>
> I have a form where the submit button is supposed to say "add login" or
> "update login" depending on if the user in question (based on field
> fkMember) already exists in the login database.  I have tags called 
> HasLogin
> and HasNoLogin that take an integer parameter, and return whether or 
> not the
> condition is true.
>
> I am using a DynaActionForm to populate the rest of the fields.  The
> DynaActionForm is a session scoped bean called "loginForm" -- the 
> following
> code actually works:
>
> <!-- form tags and all that above -->
> <td><html:submit>
> <jsp:useBean id="loginForm" scope="session"
> class="org.apache.struts.action.DynaActionForm"/>
> <app:HasNoLogin idMember="<%=new Integer
> (Integer.parseInt((String)loginForm.get("fkMember")))%>">
> <bean:message key="button.addlogin"/>
> </app:HasNoLogin>
> <app:HasLogin idMember="<%=new Integer
> (Integer.parseInt((String)loginForm.get("fkMember")))%>">
> <bean:message key="button.updatelogin"/>
> </app:HasLogin>
> </html:submit></td>
> <!-- rest of page below -->
>
> The syntax above offends my sensibilities.  First, I ought to be able 
> to
> refer to the bean in question without using a <jsp:useBean> I think; 
> it's
> obviously available to the rest of the form, if the form works (and it
> does).  Seconds, casting the get() as a String and doing a parseInt to 
> it to
> create a new Integer is silly.
>
> Isn't there a more elegant way to do this?
>
> Ian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org