You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sonu S <so...@gmail.com> on 2008/03/20 05:53:26 UTC

html:radio in struts

 Hi,

I have something like this in JSP :

<html:radio property="gender" value="male"/>MALE
<html:radio property="gender" value="female"/>FEMALE

1) i want to know how to make "Male" to be default selected when page is
loaded
2) I would set the value in form bean and on second page i would display
radio buttons to change the value. i would like to know how to make one
radio button selected as per the value set in form bean. I have already set
value in form bean... i have printed on console.. it is showing value but
not selecting in second page.

thank you
Sonu

Re: About tag

Posted by Chen Chunwei <ou...@cn.panasonic.com>.
Almost. :-(

Talos

----- Original Message ----- 
From: "Antonio Petrelli" <an...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, March 20, 2008 5:01 PM
Subject: Re: About tag <bean>


2008/3/20, Chen Chunwei <ou...@cn.panasonic.com>:
>
> And this is my fourth day to learn about JSP, STRUTS and everything about
> JAVA. So I found there are too much to learn, whereas I don't have much time
> to learn it systematically and I don't have enough materials to learn it
> from espesially that I cannot access Internet except e-mail. So this mail
> list is the only way that I can ask my questions.



Oh dear!
A colleague of mine asks if you are in jail :-D

Antonio

Re: About tag

Posted by Antonio Petrelli <an...@gmail.com>.
2008/3/20, Chen Chunwei <ou...@cn.panasonic.com>:
>
> And this is my fourth day to learn about JSP, STRUTS and everything about
> JAVA. So I found there are too much to learn, whereas I don't have much time
> to learn it systematically and I don't have enough materials to learn it
> from espesially that I cannot access Internet except e-mail. So this mail
> list is the only way that I can ask my questions.



Oh dear!
A colleague of mine asks if you are in jail :-D

Antonio

Re: About tag

Posted by Chen Chunwei <ou...@cn.panasonic.com>.
Thanks Antonio.

Yes, this is exactly what I want.

And this is my fourth day to learn about JSP, STRUTS and everything about JAVA. So I found there are too much to learn, whereas I don't have much time to learn it systematically and I don't have enough materials to learn it from espesially that I cannot access Internet except e-mail. So this mail list is the only way that I can ask my questions.

Talos

----- Original Message ----- 
From: "Antonio Petrelli" <an...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, March 20, 2008 4:03 PM
Subject: Re: About tag <bean>


2008/3/20, Chen Chunwei <ou...@cn.panasonic.com>:
>  Can tag <bean> fetch the value processed by a specified ActionForm?
>  For instance, there's an ActionForm named TestActionForm, which has a field defined with "String test". And the corresponding get-method getTest() will add a prefix "p:" to the field test. Supposing the origin value of test is "a", then whether I can use tag <bean> to get the processed value "p:a"? If can, then how?

I suppose that you are writing about <bean:write>.
Well, you can do it by using:
<bean:write name="formBeanName" property="test" />
"formBeanName" is the name that you declared in your
struts-config.xml, along with the called action.
The "getTest" will get called.

Antonio

P.S.: It seemed too simple to be true. Is it really this what you want?

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

Re: About tag

Posted by Antonio Petrelli <an...@gmail.com>.
2008/3/20, Chen Chunwei <ou...@cn.panasonic.com>:
>  Can tag <bean> fetch the value processed by a specified ActionForm?
>  For instance, there's an ActionForm named TestActionForm, which has a field defined with "String test". And the corresponding get-method getTest() will add a prefix "p:" to the field test. Supposing the origin value of test is "a", then whether I can use tag <bean> to get the processed value "p:a"? If can, then how?

I suppose that you are writing about <bean:write>.
Well, you can do it by using:
<bean:write name="formBeanName" property="test" />
"formBeanName" is the name that you declared in your
struts-config.xml, along with the called action.
The "getTest" will get called.

Antonio

P.S.: It seemed too simple to be true. Is it really this what you want?

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


About tag

Posted by Chen Chunwei <ou...@cn.panasonic.com>.
Hi all,

Can tag <bean> fetch the value processed by a specified ActionForm?
For instance, there's an ActionForm named TestActionForm, which has a field defined with "String test". And the corresponding get-method getTest() will add a prefix "p:" to the field test. Supposing the origin value of test is "a", then whether I can use tag <bean> to get the processed value "p:a"? If can, then how?

Talos

Re: html:radio in struts

Posted by Antonio Petrelli <an...@gmail.com>.
2008/3/20, Sonu S <so...@gmail.com>:
>  Hi,
>
>  I have something like this in JSP :
>
>  <html:radio property="gender" value="male"/>MALE
>  <html:radio property="gender" value="female"/>FEMALE
>
>  1) i want to know how to make "Male" to be default selected when page is
>  loaded

Initialize your ActionForm's "gender" property with "male".

>  2) I would set the value in form bean and on second page i would display
>  radio buttons to change the value. i would like to know how to make one
>  radio button selected as per the value set in form bean. I have already set
>  value in form bean... i have printed on console.. it is showing value but
>  not selecting in second page.

Use a session-scoped form-bean.

Antonio

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