StringBuilder stringBuilder = new StringBuilder();利用StringBuild对象
将写好样式的表单或者表格用append方法添加,最后用stringBuilder.toString()方法即可转为实际页面
注意将所有值的空格全部替换成" "否则,有空格的值无法读取完整信息。
stringBuilder.append(
"<body style=\"background:#CEFFCE\">\n"+
"<form>\n"+
"<div style=\"text-align:right\">\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Date Reported:</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("RPT_DTE")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Your Name:</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("RPT_NAM")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Your Department:</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("RPT_DPT")).replace(" ", " ")+"><br/>\n"+
"</div>\n"+
"</form>\n"+
"<hr />\n"+
"<p style=\"text-align:center;font-weight:bold\" >Transaction Details</p>\n"+
"<hr /> \n"+
"<form>\n"+
"<div style=\"text-align:right\">\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Transaction Reference:</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("TRANS_REF")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Currency:</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("CURRENCY")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Transaction Amount(FCY):</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("AMOUNT_FCY")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Transaction Amount(LCY):</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("AMOUNT_LCY")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Value Date of Transaction:</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("VALUE_DATE")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">What bank are we are receiving the funds from?</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("FRM_BAK")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">What country are the funds coming from?</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("FRM_CTY")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">What bank are we paying the funds to?</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("PAY_BAK")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">What country are we paying the funds to?</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("PAY_CTY")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Name of the Remitter:</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("RMT_NAM")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Name of the Beneficiary:</label><input type=\"text\" style=\"width:400px;margin:3px 0px 3px 0px\" value="+((String)param.get("BFY_NAM")).replace(" ", " ")+"><br/>\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Do you suspect that Money Laundering has already taken place?<label/>");
if(spcLdr){
stringBuilder.append(STYLE_CHECKED);
}else{
stringBuilder.append(STYLE_NOCHECKED);
}
stringBuilder.append("<label style=\"font-family:微软雅黑;font-size:13px\">Do you think that this transaction is money laundering or terrorist financing in action?<label/>");
if(spcFnc){
stringBuilder.append(STYLE_CHECKED);
}else{
stringBuilder.append(STYLE_NOCHECKED);
}
stringBuilder.append("<label style=\"font-family:微软雅黑;font-size:13px\">Are you asking for the consent ot the MLRO to undertake the transaction?<label/>");
if(spcUtk){
stringBuilder.append(STYLE_CHECKED);
}else{
stringBuilder.append(STYLE_NOCHECKED);
}
stringBuilder.append(
"</div>\n"+
"</form>\n"+
"<hr />\n"+
"<div style=\"text-align:right\">\n"+
"<label style=\"font-family:微软雅黑;font-size:13px\">Explain why are you Suspicious about this transaction?</label><br/>\n"+
"<textarea style=\"width:939px;height:100px;margin:3px 0px 3px 0px\">"+((String)param.get("RPT_DCP")).replace(" ", " ")+"</textarea><br/>\n"+
"</div>\n"+
"<hr />\n"+
"</body>"
);