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/18 04:35:48 UTC

struts 1.2 html:select and submit button

 HI,

I am using struts 1.2 in my web application. I have to display one
<html:select>.... <html:options> list

list will be build dynamically. User can select any option. base on the
user's selection page will be refreshed (need to hit the database and
display information in other fields on same page.) I need to know two
things:

1) there is one submit button on that page and one action is associated with
that submit button. i can call the associated action class once the user
finish the form and click the submit button. When user select from list i
need to call another action class.

I want to know how to call another action class, (when user select something
from list), as list control is inside the same html:form tag.

2) When user selects some value from list i need to refresh the page and
populate the other fields.

I would like to know, Lets say there are ten values and user has selected
third option, how to keep selected that third option as page is already
refreshed?

I am beginner in struts.. any sample code would be a great help for me

Thank you for time and help.

sonu

Re: struts 1.2 html:select and submit button

Posted by hijayanth <hi...@rediffmail.com>.
Hi,

Can you please let how did you address your requirement of having multiple
action classes?


Thanks and regards,
jayanth

--
View this message in context: http://struts.1045723.n5.nabble.com/struts-1-2-html-select-and-submit-button-tp3477760p4558693.html
Sent from the Struts - User mailing list archive at Nabble.com.

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


Re: struts 1.2 html:select and submit button

Posted by Antonio Petrelli <an...@gmail.com>.
2008/3/18, Sonu S <so...@gmail.com>:
>  1) there is one submit button on that page and one action is associated with
>  that submit button. i can call the associated action class once the user
>  finish the form and click the submit button. When user select from list i
>  need to call another action class.
>
>  I want to know how to call another action class, (when user select something
>  from list), as list control is inside the same html:form tag.

Use Javascript.

>  2) When user selects some value from list i need to refresh the page and
>  populate the other fields.
>
>  I would like to know, Lets say there are ten values and user has selected
>  third option, how to keep selected that third option as page is already
>  refreshed?


You have two options:
1) the simplest (but I don't like it because it can cause some side
effects): use a session-scoped form bean;
2) the action is called on the "onchange" event of the <select> tag.
The new value of the select tag itself is submitted. You process it
and you reput it inside the HttpServletRequest. In the JSP page, you
can process it (e.g. with the use of EL) to show the previously
selected value.

HTH
Antonio

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


Re: struts 1.2 html:select and submit button

Posted by Sudhan Maharjan <ma...@gmail.com>.
You can simply call a struts action through AJAX. A little bit of AJAX can
help to do your task. If you know AJAX, you can call struts action while
sending request as req.open("GET", someaction.do, true);


On Tue, Mar 18, 2008 at 9:20 AM, Sonu S <so...@gmail.com> wrote:

>  HI,
>
> I am using struts 1.2 in my web application. I have to display one
> <html:select>.... <html:options> list
>
> list will be build dynamically. User can select any option. base on the
> user's selection page will be refreshed (need to hit the database and
> display information in other fields on same page.) I need to know two
> things:
>
> 1) there is one submit button on that page and one action is associated
> with
> that submit button. i can call the associated action class once the user
> finish the form and click the submit button. When user select from list i
> need to call another action class.
>
> I want to know how to call another action class, (when user select
> something
> from list), as list control is inside the same html:form tag.
>
> 2) When user selects some value from list i need to refresh the page and
> populate the other fields.
>
> I would like to know, Lets say there are ten values and user has selected
> third option, how to keep selected that third option as page is already
> refreshed?
>
> I am beginner in struts.. any sample code would be a great help for me
>
> Thank you for time and help.
>
> sonu
>