Pardon the disheveled nature of this response :/

Whether or not the image object need to be "recreated"
is more an issue w/ your persistence mechanism, but
you'll at least need some sort of UID for each.

On the S2 side you can create a map keyed on the UID
and expose whatever properties you want (like an
object.metadata field or just a string or whatever)
and use map notation on your form.

Check out the wiki page on type conversion to see a
bit more about how maps can be used:

http://struts.apache.org/2.x/docs/type-conversion.html

It's down towards the bottom. In a nutshell you can do
something like (pseudotag):

<s:hidden name="theMap[aUid].id/> // To recover the
UID on form submission
<s:textfield name="theMap[aUid].metadata"/>

where the map is:

Map<UidClass, ImageClass> _theMap;

with an appropriate getter.

On submission your map will be filled in w/ the form's
values, the next step depends a bit on your
persistence mechanism.

d.


--- Mark Steyn <[EMAIL PROTECTED]> wrote:

> Forgive me is this is a very obvious question, but
> I'm new to struts 2,
> and despite googling around, I'm still not sure as
> to how to do
> something.
> 
> I'm trying to accomplish the following:
> 
> 1. Create a form which is used upload a zip file
> containing a number of
> images
> 2. Upload and process those images, creating java
> objects and database
> records for each.
> 3. Display a second form allowing the user to
> associate additional
> metadata with the images 
> 
> I'm currently stumped on step 3.
> 
> I can upload the images and create objects
> representing them, and create
> a form in a jsp allowing additional data to be
> associated with these
> objects, but once that form is submitted, I'm not
> sure how to map the
> posted data back to my image objects.  
> 
> From what I gather, the image objects that were
> created in step 2 need
> to be recreated in step 3, but I can't see an easy
> means of doing this.
> Are type converters the best way forward, or is
> there a better
> alternative?
> 
> Any assistance will be gratefully appreciated.
> 
> Mark 
> 
> 
>
---------------------------------------------------------------------
> 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