All pastes #568258 Raw Edit

Unnamed

public java v1 · immutable
·published 2007-06-15 12:52 UTC
rendered paste body
		if (submit) {			System.out.println("SUBMIT");			Map map = request.getParameterMap();			String[] keySet = (String[])map.keySet().toArray(new String[0]);			HashMap<Integer, FriendRelationDescription> hm = new HashMap();			//			loop over all checkboxes and check what types was checked/selected and remember them			for (int i  = 0; i < keySet.length; i++) {				if (keySet[i].matches("\\d*")) {					int frdtId = Integer.parseInt(keySet[i]);					System.out.println("frdtId = " + frdtId);					FriendRelationDescription frd = new FriendRelationDescription(frId);					frd.setFriendRelationDescriptionType(new FriendRelationDescriptionType(frdtId));//					byt ut frdtId mot frdId foer att funka med gamla					hm.put(frdtId, frd);				}			}			for (int i  = 0; i < keySet.length; i++) {//				loop over all input fields that the user filles in				if (keySet[i].matches("\\d*_value\\d*")) {					int index = keySet[i].indexOf('_');					int frdtId = Integer.parseInt(keySet[i].substring(0, index));					String valId = keySet[i].substring(index+6);					FriendRelationDescription temp = new FriendRelationDescription(frId);//					byt ut frtdId mot frdId foer att funka med gamla//					if that type was checked/selected					if (hm.containsKey(frdtId)) {						FriendRelationDescription frd = hm.get(frdtId);						frd.setFriendRelation(new FriendRelation(frId));						System.out.println("valId = " + valId);						frd.getClass().							getMethod("setValue" + valId, String.class).							invoke(frd, ((String[])map.get(keySet[i]))[0]);					}				}			}