Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block

public class SaveMarksAction extends ActionSupport {
	private Map marks = new HashMap();

	public Map getMarks() {
		return marks;
	}


	public String execute() throws Exception {
		// get list of candidate IDs
		List candidateIds = marks.keySet();

		for (Iterator iter = candidateIds.iterator(); iter.hasNext();) {
			String candidateId = (String) iter.next();
			String mark = parseMap(marks.get(candidateId));

			// process candidates and marks...
		}

	}

	// helper function to parse the map of entries....
	private static String parseMap(String[] map) {
		if (map == null) {
			return null;
		}
		if (map.length != 1) {
			return null;
		}
		return map[0];
	}


}

...

Explanation

The resulting vm file is rendered as

...

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

or

DisplayTag (server side)

...