同学让我帮忙写这个,可我连JavaBean都不知怎么回事,求大牛帮助
解决方案 »
- 求js正则获取下面值
- ext带参数的分页
- 关于动态的更改iframe的src进入不同的页面
- jsp中怎么改变FCKeditor 中的背景色
- 我用window.open下载文件,但是遇到了中文问题,大家帮忙!
- 请帮忙看看我的程序,为什么输入数据后,不能作出响应
- 一个可能比较幼稚或者浮的问题,struts VS webwork
- 请问谁能告诉我在地址栏中输入1127.0.0.1:8080/ch1/first.jsp出现下面报告是什么原因怎么解决?
- 怎么知道mysql使用什么中文编码方式(charsetEncoding)?或者说怎么设置中文编码方式?
- 求助:关于使用tomcat4.1在ie6中直接使用servlet的问题
- 急!求高手解决 servlet异常:Cannot forward after response has been committed
- package com.jxte.sendmessage?
package com.fendou.wyb;import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;class Color {
HashMap<String, Integer> rgb = new HashMap<String, Integer>();public Color() {rgb.put(null, null);
}public void init() {
}public Color(String key, Integer value) {
rgb.put(key, value);
}public HashMap<String, Integer> getRgb() {
return rgb;
}public void setRgb(HashMap<String, Integer> rgb) {
this.rgb = rgb;
}
}class Content {
public Color color;public Content() {
super();
}public Content(Color color) {this.color = color;}public Color getColor() {
return color;
}public void setColor(Color color) {
this.color = color;
}
}public class Detail {
public ArrayList<Content> content;public Detail() {
super();
}public Detail(ArrayList<Content> content) {
this.content = new ArrayList<Content>();
for (int i = 0; i < content.size(); i++) {
this.content.add(content.get(i));
}
}public static void main(String[] args) {
Color color1 = new Color();
Color color2 = new Color();
Color color3 = new Color();
Color color4 = new Color();
Color color5 = new Color();
Color color6 = new Color();
Color color7 = new Color();
Color color8 = new Color();
Color color9 = new Color();
color1.rgb.put("red", 11);
color1.rgb.put("blue", 12);
color1.rgb.put("green", 13);
color2.rgb.put("red", 21);
color2.rgb.put("blue", 22);
color2.rgb.put("green", 23);
color3.rgb.put("red", 31);
color3.rgb.put("blue", 32);
color3.rgb.put("green", 33);
color4.rgb.put("red", 41);
color4.rgb.put("blue", 42);
color4.rgb.put("green", 43);
color5.rgb.put("red", 51);
color5.rgb.put("blue", 52);
color5.rgb.put("green", 53);
color6.rgb.put("red", 61);
color6.rgb.put("blue", 62);
color6.rgb.put("green", 63);
color7.rgb.put("red", 71);
color7.rgb.put("blue", 72);
color7.rgb.put("green", 73);
color8.rgb.put("red", 81);
color8.rgb.put("blue", 82);
color8.rgb.put("green", 83);
color9.rgb.put("red", 91);
color9.rgb.put("blue", 92);
color9.rgb.put("green", 93);List<Content> contents = new ArrayList<Content>();contents.add(new Content(color1));
contents.add(new Content(color2));
contents.add(new Content(color3));
contents.add(new Content(color4));
contents.add(new Content(color5));
contents.add(new Content(color6));
contents.add(new Content(color7));
contents.add(new Content(color8));
contents.add(new Content(color9));for (int i = 0; i < contents.size(); i++) {
System.out.print("the contents[" + i + "] red is "
+ contents.get(i).getColor().rgb.get("red"));
System.out.print("\t the contents[" + i + "] blue is "
+ contents.get(i).getColor().rgb.get("blue"));
System.out.println("\t the contents[" + i + "] green is "
+ contents.get(i).getColor().rgb.get("green"));
}
System.out.println("detail.content[7].color.rgb[\"red\"].value is "
+ contents.get(6).getColor().rgb.get("red"));
}
}