java²Ù×÷Excel
// ´´½¨Excel
String destFileName = tableName + ".xls";//ÎļþÃû
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=".concat(String .valueOf(destFileName)));
WorkbookSettings wbs = new WorkbookSettings();
WritableWorkbook w = Workbook.createWorkbook(response .getOutputStream(), wbs);//´ò¿ªÎļþ
jxl.write.WritableSheet ws = w.createSheet("sheet0", 0);// // Éú³ÉÃûΪ“sheet0”µÄ¹¤×÷±í£¬²ÎÊý0±íʾÕâÊǵÚÒ»Ò³
// ÔÚLabel¶ÔÏóµÄ¹¹Ôì×ÓÖÐÖ¸Ãûµ¥Ôª¸ñλÖÃÊǵÚÒ»ÁеÚÒ»ÐÐ(0,0)
// ÒÔ¼°µ¥Ôª¸ñÄÚÈÝΪtest
Label label = new Label(0, 0, "test123");
// ½«¶¨ÒåºÃµÄµ¥Ôª¸ñÌí¼Óµ½¹¤×÷±íÖÐ
sheet.addCell(label);
// ×ÖÌåÉèÖÃ
WritableFont font = new WritableFont(WritableFont.createFont("¿¬Ìå_GB2312"), 12, WritableFont.BOLD);
WritableCellFormat format = new WritableCellFormat(font);
format.setBackground(jxl.format.Colour.GRAY_25);
format.setLocked(false);//µ¥Ôª¸ñËø¶¨
format.setBorder(jxl.format.Border.ALL,
jxl.format.BorderLineStyle.getStyle(1));
format.setWrap(true);//ÉèÖÃ×Ô¶¯»»ÐÐ
// ×ÖÌåÉèÖýáÊø
// µ¥Ôª¸ñÉèÖÃÄÚÈÝ£¨ÒÔϱíʾ£¬µÚiÁУ¬µÚ1ÐУ©
·½Ê½1£º
ExcelUtil.makeCellData(ws, i, 0, (String) map.get("BTF_TITLE"), ExcelUtil.LABEL_ALIGN_LEFT,ExcelUtil.BORDER_LINE_ALL, null, ExcelUtil.CELL_TYPE_LABEL,jxl.format.Colour.GRAY_25);
·½Ê½2£º
ws.addCell(new Label(i, 0, (String) map.get("BTF_TITLE"), format));
//×îºóдÎļþ£¬¹Ø±Õ
w.write();
w.close();
//º
Ïà¹ØÎĵµ£º
synchronizedµÄÒ»¸ö¼òµ¥Àý×Ó
public class TextThread
{
/**
* @param args
*/
public static void main(String[] args)
{
// TODO ×Ô¶¯Éú³É·½·¨´æ¸ù
TxtThread tt = new TxtThread();
  ......
import java.net.URL;
import java.net.URLDecoder;
public class PathUtil
{
/**
* Get the env of windir, such as "C:\WINDOWS".
* @return the env of windir value.
*/
public static String getWindir(){
return System.getenv("windir");
}
......
Java ¶àÏ̱߳à³ÌÖ®Èý£ºsynchronized ¹Ø¼ü×ÖµÄʹÓÃ
´øÓÐ synchronized ¹Ø¼ü×ֵķ½·¨´ú±íÕâ¸ö·½·¨¼ÓËø¡£Ç¡µ±¶øÓÖÁé»îµØÔËÓà synchronized ¹Ø¼ü×Ö£¬ÊǶàÏ̱߳à³ÌµÄ±ØÐ޿Ρ£
¡¡¡¡1¡¢synchronized¹Ø¼ü×ÖµÄ×÷ÓÃÓòÓжþÖÖ£º
¡¡¡¡1£©ÊÇij¸ö¶ÔÏóʵÀýÄÚ£¬synchronized aMethod(){}¿ÉÒÔ·ÀÖ¹¶à ......
Ò».µã»÷ͼÊ飬չʾ¸ÃÊéµÄÏêϸÐÅÏ¢
µã»÷ͼÊé→booksÒ³Ãæ→ͨ¹ýurlÖØÐ´displayBook.jsp?isbn=¸ÃÊé±àºÅ →´«ÈëdisplayBooksÒ³Ãæ→
<c:set var="isbn" value="${param.isbn}"></c:set>
<c:forEach var="currentBook" items="${sessionScope.bookTitles}">
<c:if test="${ ......
Java ÖиøÊý×Ö×ó±ß²¹0 £¨1£©·½·¨Ò»
import java.text.NumberFormat; public class NumberFormatTest { public static void main(String[] args) {
//´ý²âÊÔÊý¾Ý
int i = 1;
......