Child pages
  • Tabular inputs with HashMap
Skip to end of metadata
Go to start of metadata

Intro

I have a need to enter tabular data, like marks from a list of examination candidates.

This is how it's done :

the mark.vm file..

the SaveMarksAction

Explanation

The resulting vm file is rendered as

Webwork will populate the marks into the Map marks via

whereby you can get the list of candidateIds via

and the individual marks via

Possible enhancements

Couple tabular inputs with some sortable table component (javascript, client side)

or

DisplayTag (server side)

I believe there's some discussion on the mailing list about using Ognl to handle it automatically. I didn't follow it in detail, but from what I know, (do correct me if I'm wrong) the Ognl method is not available yet. The above works for now.

Conclusion

Feedback, comments and suggestions on better methods to perform the same function are welcome. If there's a simpler way, or a customised component to handle this tabular input automatically, I believe it'll be very useful.

  • No labels

2 Comments

  1. Unknown User (cv_)

    Great stuff, Bernard! One minor enhancement would be use a type converter to get rid of that parseMap(String[]) method. Not sure if it's possible, though.

  2. Unknown User (hyeungsf)

    Thanks for the information. It really helps my project.
    BTW I just wonder what does name=marks'$candidate.id' mean. I tried to use the example. However, the HTML generated always has the name="". Would be helpful if you can explain more.