在一个方法中,要比较两个字段的值是否相等;其中有一张表AdrReport里面有一个字段currentareacode,它里面是有值的,但我不知道如何获取currentareacode字段里面的值,应当如何实现呢,具体应该怎么写?
SessionBean sessioninfo = (SessionBean) session.getAttribute("sessioninfo"); 
String grade = sessioninfo.getGrade(); 
String searchCode = sessioninfo.getSearchCode(); 
String currentareacode = request.getParameter("currentareacode"); if(grade.equals("2") && currentareacode.equals(searchCode))
 { 
String sql = "select " 
+ sb.toString().substring(0, sb.toString().length() - 1) 
+ " from adrreport a,adrmeddetail b where a.id=b.reportid and a.flag=1 and sflag=2"+wheresql; 
System.out.println(sql); 
DBManager dbm = new DBManager(); 
ResultSet rs = dbm.getRs("zjadr", "select count(*) from (" + sql + ") a"); // 查询结果集的条数 
rs.next(); 
int total = rs.getInt(1); // 得到结果的条数 
sql += " order by a.id"; 
//System.out.println(sql); 
ResultSet rs2 = dbm.getRs("zjadr", sql); // 得到查询结果 if (wwb != null) { 
// 创建一个可写入的工作表 
// Workbook的createSheet方法有两个参数,第一个是工作表的名称,第二个是工作表在工作薄中的位置 
WritableSheet ws = wwb.createSheet("sheet1", 0); 
ws.getSettings().setDefaultColumnWidth(15); /* =========先写excel的表头,根据用户选择的字段来写入excel文件========== */ 
// 设置表头单元格的样式 
WritableCellFormat wcf = new WritableCellFormat(); 
wcf.setBackground(Colour.SKY_BLUE); 
WritableFont wf = new WritableFont(WritableFont.createFont("宋体"), 11, WritableFont.BOLD, true); 
wcf.setFont(wf); 
wcf.setWrap(true); // 设置单元格内自动换行 
wcf.setAlignment(Alignment.CENTRE); 
wcf.setVerticalAlignment(VerticalAlignment.CENTRE); 
if (adrlist.size() != 0) { for (int col = 0; col < adrlist.size(); col++) { 
Label l = new Label(col, 0, 
adrlist.get(col).toString(), wcf); 
// 将生成的单元格添加到工作表中 
ws.addCell(l); 


if (medlist.size() != 0) { 
for (int col1 = 0; col1 < medlist.size(); col1++) { 
Label l1 = new Label(adrlist.size() + col1, 0, medlist 
.get(col1).toString(), wcf); 
ws.addCell(l1); 


int col = adrlist.size() + medlist.size(); 
/* ================表头写入完毕=================== */ /* ===============根据用户选择的列写入数据=============== */ 
// 设置内容单元格的样式 
WritableCellFormat wcf1 = new WritableCellFormat(); 
wcf1.setWrap(true); 
wcf1.setAlignment(Alignment.CENTRE); 
wcf1.setVerticalAlignment(VerticalAlignment.CENTRE); 
for (int j = 1; j <= total; j++) { // 第一行已写入表头,从第二行开始写入数据 
rs2.next(); 
for (int c = 0; c < col; c++) { 
Label labelC = new Label(c, j, rs2.getString(c + 1), 
wcf1); 
// 将生成的单元格添加到工作表中 
ws.addCell(labelC); 


/* ================写入数据完毕================== */ /* ===============开始合并单元格的操作================ */ 
for (int c = 1; c <= total; c++) { 
if (c < total) { 
int flag = 0; 
for (int e = 1; e <= total - c; e++) { 
Cell[] c1 = ws.getRow(c); 
Cell[] c2 = ws.getRow(c + e); 
if (c1[0].getContents().equals(c2[0].getContents())) { 
flag++; 
continue; 


if (flag != 0) { 
for (int d = 0; d < adrlist.size(); d++) { 
ws.mergeCells(d, c, d, c + flag); 



} // 从内存中写入文件中 
wwb.write(); 
// 关闭资源,释放内存 
wwb.close(); 
//关闭连接 
dbm.close(); 

} 我应该如何来获得currentareacode的值?只要获得了就达到我所需要的结果!谢谢!