You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dirk Liebscher <di...@gmx.de> on 2003/11/18 11:33:17 UTC

- Transfering multiple values in >option>

Hello,

I'm a student and new to Struts and I've got the following problem, which I
have to describe textually, cause the code has not been implemented yet:

I've got a form with data to ..ehm... consider a car, which is a value
object. This object is stored as an attribute in an ActionForm.
Every car has got a product group, which again is an value object and stored
inside the car object of the ActionForm.

So in the JSP-form I use nested-tags. The root tag is the ActionForm.
Then <nested:nest property="car">
And then follows a <nested:select property="productgroup"> - box, showing
the names of product groups as labels. The values are the identification
codes of these product groups. It's only possible to choose one of the
groups.

Now, if I submit the form, the choosen product group will be stored inside
the car object and the car object inside the form object.
But only the id of the product group is stored, whereas the label is not.

And thats my problem, because I'd like to show the name of the choosen
product group on a following jsp-page before it will be saved in a database.
But I only get the id, cause I can't declare more than one value for an
select-box.

Any idea or workaround?

Thanks a lot,
Dirk Liebscher



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


Re: - Transfering multiple values in >option>

Posted by Arron Bates <st...@keyboardmonkey.com>.
Dirk,

A standard problem. Many people implement some kind of lookup system to fetch
things like drop down values and such. You are right, you do only get the ID,
and it's going to be up to you to fetch the value from somewhere if you want
to show it to the user again. Most likely the same place that got you the
options in the first place. The common solution people gravitate towards is
keeping such objects as singletons in memory. That way the lookups are nice
and speedy.

In summary I'm sorry to say that nothing in life is free :)

All the best.


Arron.



> Hello,
> 
> I'm a student and new to Struts and I've got the following problem,
>  which I have to describe textually, cause the code has not been 
> implemented yet:
> 
> I've got a form with data to ..ehm... consider a car, which is a 
> value object. This object is stored as an attribute in an 
> ActionForm. Every car has got a product group, which again is an 
> value object and stored inside the car object of the ActionForm.
> 
> So in the JSP-form I use nested-tags. The root tag is the ActionForm.
> Then <nested:nest property="car">
> And then follows a <nested:select property="productgroup"> - box, showing
> the names of product groups as labels. The values are the identification
> codes of these product groups. It's only possible to choose one of 
> the groups.
> 
> Now, if I submit the form, the choosen product group will be stored inside
> the car object and the car object inside the form object.
> But only the id of the product group is stored, whereas the label is 
> not.
> 
> And thats my problem, because I'd like to show the name of the 
> choosen product group on a following jsp-page before it will be 
> saved in a database. But I only get the id, cause I can't declare 
> more than one value for an select-box.
> 
> Any idea or workaround?
> 
> Thanks a lot,
> Dirk Liebscher
> 
> ---------------------------------------------------------------------
> 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