public StringBuffer createSolution(HttpServletRequest request,
HttpServletResponse response) throws EasyJException {
Long problemId = new Long(request.getParameter("problemId"));
SingleDataProxy sdp = SingleDataProxy.getInstance();
Problemreason problemreason = new Problemreason();
ProblemreasonSolution prs = new ProblemreasonSolution();
problemreason.setProblemId(problemId);
String solution = "无解决方案";
ArrayList problemreasons = sdp.query(problemreason);
StringBuffer buffer = new StringBuffer();
buffer
.append("<meta http-equiv=\"Expires\" content=\"0\"><meta http-equiv=\"Pragma\" content=\"no-cache\"><meta http-equiv=\"Cache-Control\" content=\"no-cache\">");
buffer
.append("<link href=\"/css/iknow1_1.css\" rel=\"stylesheet\" type=\"text/css\">");
buffer
.append("<link href=\"/css/table.css\" rel=\"stylesheet\" type=\"text/css\">");
buffer
.append("<link href=\"/css/pattern.css\" rel=\"stylesheet\" type=\"text/css\">");
buffer
.append("<link href=\"/css/scenario.css\" rel=\"stylesheet\" type=\"text/css\">");
buffer
.append("<script language=\"javascript\" src=\"/js/ProblemsolutionReply.js\"></script>");
buffer
.append("<form name=\"form2\" id=\"form2\" method=\"post\" action=\"\" type=\"enter2tab\"><div id=\"newSolution\"></div>");
buffer.append("<div id=\"center2\" ><div class=\"bai\">");
buffer
.append("<div class=\"mb12 bai\" id=\"solution_more\" ><div class=\"rr_1\"></div><div class=\"rr_2\"></div><div class=\"rr_3\"></div><div class=\"rr\">");
buffer
.append("<div class=\"t1\"><div class=\"ico\"><div class=\"ianswer\"></div></div>发表新的解决方案</div>");
buffer.append("<div class=\"bc0\" style=\"padding:0px 0pt;\">");
// 产生标题
buffer
.append("<div class=\"t2\"><TABLE style=\"MARGIN-TOP: 8px; MARGIN-BOTTOM: 8px\" cellSpacing=0 cellPadding=0 width=\"100%\" align=center border=0><TBODY></TBODY></TABLE><TABLE class=f9 id=newsTable cellSpacing=0 cellPadding=0 width=\"100%\" align=center bgColor=#ffffff border=0><TBODY>");
buffer
.append("<TR bgColor=#f3f3f3><TD class=tdline28 noWrap width=\"5%\"></TD><TD class=tdline28 width=\"14%\" height=30><b>序号</b></TD><TD class=tdline28 width=\"1%\"> </TD><TD class=tdline28><B>原因概要</B></TD><TD class=tdline28 width=\"15%\"><B> </B></TD></TR>");
// 产生所有的原因,供选择
if (problemreasons != null) {
for (int i = 0; i < problemreasons.size(); i++) {
solution = "无解决方案";
// 原因简写部分
problemreason = (Problemreason) problemreasons.get(i);
buffer.append("<TR id=trBG" + i + ">");
buffer
.append("<TD class=tdline28 noWrap align=left ><INPUT onclick=\"Problemsolution.changeTRbg(this,'trBG"
+ i
+ "')\" type=\"checkbox\" value=\""
+ problemreason.getProblemreasonId()
+ "\" name=\"choose_reason\"></TD>");
buffer.append("<TD class=tdline28 align=left>" + (i + 1)
+ "</TD>");
buffer.append("<TD class=tdline28 align=right> </TD>");
if (problemreason.getProblemreasonContent().length() > 10) {
buffer.append("<TD class=tdline28 align=left title="
+ problemreason.getProblemreasonContent()
+ ">"
+ problemreason.getProblemreasonContent()
.subSequence(0, 9) + "...</TD>");
} else {
buffer
.append("<TD class=tdline28 align=left title="
+ problemreason.getProblemreasonContent()
+ ">"
+ problemreason.getProblemreasonContent()
+ "</TD>");
}
buffer
.append("<TD class=tdline28 noWrap align=left><A class=\"bluelink\" onclick=; href=\"javascript:Problemsolution.newsShowHide('news"
+ i + "');\">查看该原因以及解决方案</A></TD></TR>");
// 原因主要内容(隐藏)
prs.setProblemreasonId(problemreason.getProblemreasonId());
ArrayList prss = sdp.query(prs);
if (prss.size() > 0) {
solution = "";
for (int j = 0; j < prss.size(); j++) {
prs = (ProblemreasonSolution) prss.get(j);
solution = solution + prs.getProblemsolutionId();
}
}
buffer
.append("<TR><TD class=tdline28 id=news"
+ i