Ashish,

not sure if the following is what you are looking for. I am doing a
simple modifying the lookup table.


in my jsp
<bean:define id="adminModifyFormData"
name="<%=Constants.ADMIN_MODIFY_FORM%>" scope="session"
                         type="com.web.forms.AdminModifyForm"/>

<bean:define id="techAL"
name="<%=Constants.PAGE_ATTR_ADMIN_MODIFY_TECH_LIST%>"
scope="request"/>

<TABLE width="100%" >
<TR>   
<TD align='right' class="dtllabel">Technique used Old Value</TD>
<TD class="dtlcontent">
<html:select name="<%=Constants.ADMIN_MODIFY_FORM%>" property="techUsed">
    <html:options collection="techAL" property="techCd"
labelProperty="techDscr" />
</html:select>
</TD>
</TR>


name="<%=Constants.ADMIN_MODIFY_FORM%>"  is the formbean that  has
both the old value(drop down) and the new value(text box where user
enters the modified value) like given below...
public class AdminModifyForm extends ActionForm {
        private String techUsed;
        private String techUsedNew;

<html:options collection="techAL" property="techCd"
labelProperty="techDscr" />    where techAL is an arraylist of already
existing values in the lookup table. In the action class which
prepares/initializes(sort-of) the jsp for display, I am obtaining that
arraylist using DAO/helper classes. property="techCd"
labelProperty="techDscr" where labelProperty is what the user sees on
the page and property is what business logic uses as the key to that
object(equiv to value="" in html)


in my action class which prepares the jsp for display
ArrayList list1= new ArrayList();
list1 =helper.getAdminValuesTech(mapping,form,request,response,errors);
                //set the option lists
session.setAttribute(Constants.PAGE_ATTR_ADMIN_MODIFY_TECH_LIST,list1);
request.setAttribute(Constants.PAGE_ATTR_ADMIN_MODIFY_TECH_LIST,list1);

in my action class which uses the value from the selection in the
combobox in jsp, i obtain them using getter methods of formbean
System.out.println("\ntechused"+adminModifyForm.getTechUsed());
System.out.println("\ntechusednew"+adminModifyForm.getTechUsedNew()  );

hth,
Rosemary

On Tue, 26 Oct 2004 07:22:24 -0700 (PDT), Ashish Kulkarni
<[EMAIL PROTECTED]> wrote:
> Hi
> Can some on provide a example of using <html:options
> in jsp,
> how to define the in struts-config.xml file, how to
> populate the data in Action class and then display it
> on jsp page,
> Also how to retain this data in request for other
> request,
> For example , suppose the user hits enter to submit
> the data Action class which process the data, and if
> there is any error, display back the jsp with the
> error message, and all the values in dropdown box with
> the value selected by user selected in option
> I have seen the examples provided by struts, but it is
> not clear how to use it with Action class
> Ashish
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
> http://promotions.yahoo.com/new_mail
> 
> ---------------------------------------------------------------------
> 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