Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi
Thanx
I was able to do this, my only concern is, is there a
way i can get the ArrayList stored in request instead
of session,
currently i am putting the arraylist in session like
this
session.setAttribute("itembean", arrayList);
and accessing it in jsp like this
<html:options collection="itembean"
property="MASTERITEM" labelProperty="ITEMDESCRIPTION"
/>
If i store it in request, and hit submit i loose the
arrayList
Ashish
--- Rosemary Philip <ro...@gmail.com> wrote:
> 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
> <ku...@yahoo.com> 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:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
>
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: using dropdown box
Posted by Rosemary Philip <ro...@gmail.com>.
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
<ku...@yahoo.com> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: using dropdown box
Posted by Stephen Gibson <sg...@idvelocity.com>.
In this example, I have an ActionForm ClaimsQCForm. On that form I have an
arraylist named stateBeanList.
<snip>
protected java.util.ArrayList stateBeanList = null;
...
/**
* Gets the stateBeanList
* @return Returns a java.util.ArrayList
*/
public java.util.ArrayList getStateBeanList() {
return stateBeanList;
}
/**
* Sets the stateBeanList
* @param stateBeanList The stateBeanList to set
*/
public void setStateBeanList(java.util.ArrayList stateBeanList) {
this.stateBeanList = stateBeanList;
}
<snip>
The stateBeanList is an arrayList of a JavaBean stateBean which is basically
the getters and setters associated with a database table of states (US and
Canada) which I loaded with my action object servlet. Two of the columns in
this table are stateAbbreviation and stateName. I am allowing the user to
select the state name and returning the state abbreviation to another bean
defined in my actionForm ClaimsQCForm cib.installationState.
Here is the JSP code relating to this
<bean:define id="stateList" name="ClaimsQCForm" property="stateBeanList" />
<html:select name="ClaimsQCForm" property="cib.installationState" size="1"
styleClass="larger">
<html:option value=" ">
<bean:message key="option.selectState"/>
</html:option>
<html:options collection="stateList"
property="stateAbbreviation"
labelProperty="stateName" />
</html:select>
The bean:message section is a text messge that say "Please Select a State"
fyi
I hope this helps
Steve Gibson
336-217-6394
-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
Sent: Tuesday, October 26, 2004 10:22 AM
To: user@struts.apache.org
Subject: using dropdown box <html:options example
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org