struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yunaki <>
Subject type convertion about complex object question
Date Sat, 08 May 2010 17:20:45 GMT

I want to convert a group of html input tag into hashmap? each value of html
input tag is for a set of Sequence Objects. e.g.

code in input.jsp

<input name="SequenceMap" value="1,2|A;U;T">
<input name="SequenceMap" value="1,2|S;T;R">
<input name="SequenceMap" value="1,3|S;T;R">

a converter split the value by vertical bar, 
the left part of the value contains two id property for Property1 and
Property2 objects in each new Sequence and is the corresponding key in map.
the converter also split the right part of the value to set Character
property of a set of Sequence objects

e.g.    value="property1Id,Property2Id|Character1;character2;

Map key is "property1Id,Property2Id"

convertFromString(Map arg0, String[] arg1, Class arg2){
  Map<int, Set<Sequence>> SequenceMap=new HashMap<int, Set<Sequence>>();
  for(int a=0; a<arg1.length;a++){
      String[] valueSet=arg1[a].split("|");
      String[] propertySet=valueSet[0].split[";"]
      Set<Sequence> SequenceSet=new HashSet<Sequence>();
      Property1 proeprty1=new Property1(propertySet[0]);
      Property2 proeprty2=new Property2(propertySet[1]);
      String[] sequenceSet=valueSet[1].split(";");
      for(int b=0;b<sequenceSet.length;b++){
           Sequence sequence=new Sequence();
  return SequenceMap;

map property in action is:

Map<int, Set<Sequence>> SequenceMap

Sequence class:

public class Sequence{
   int id:
   String Character;
   Property1 property1;
   Property2 property2

public Property1 class{
   int property1Id

public Property2 class{
  int property2Id

Any know how to write "Element" and "KeyProperty" type convertion properties

many thanks
View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message