Tomcat的版本多的是亂入牛毛,本人一向喜歡用jstl/el表達式的,可是遇到多個版本的tomcat就會出現不解析EL表達式,原樣輸出的問題.
解決思路:
修改web.xml中聲明部分的schema版本為2.4
在jsp頁面中的<page>指令中添加isELIgnored="false"
雪山飛鵠溫馨提示:您的每一次轉載,體現了我寫此文的意義!!!煩請您在轉載時注明出處http://www.aygfsteel.com/sxyx2008/謝謝合作!!! |
Tomcat的版本多的是亂入牛毛,本人一向喜歡用jstl/el表達式的,可是遇到多個版本的tomcat就會出現不解析EL表達式,原樣輸出的問題.
解決思路:
修改web.xml中聲明部分的schema版本為2.4
在jsp頁面中的<page>指令中添加isELIgnored="false"
package com.velocity.test;
import java.io.IOException;
import java.io.StringWriter;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
public class VelocityTest {
public static void main(String[] args) {
try {
Velocity.init();
} catch (Exception e) {
e.printStackTrace();
}
VelocityEngine engine=new VelocityEngine();
engine.setProperty(Velocity.RESOURCE_LOADER, "class");
engine.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
VelocityContext context= new VelocityContext();
context.put("name", "林心如");
context.put("velocity", "Velocity");
Template template = null;
try {
template = engine.getTemplate("velocity.vm","gbk");
} catch (ResourceNotFoundException e) {
e.printStackTrace();
} catch (ParseErrorException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
StringWriter writer=new StringWriter();
try {
template.merge(context, writer);
System.out.println(writer.toString());
} catch (ResourceNotFoundException e) {
e.printStackTrace();
} catch (ParseErrorException e) {
e.printStackTrace();
} catch (MethodInvocationException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
void sendRedirect(java.lang.String location) throws java.io.IOException
If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
location
- the redirect location URL
java.io.IOException
- If an input or output exception occurs
java.lang.IllegalStateException
- If the response was committed or if a partial URL is given and cannot be converted into a valid URL 剛入手聯想Y450(TSI),給機子裝了win7中文旗艦版,在該環境下安裝myeclipse6.5,可是導入以前xp環境下的工程就一直出現正在構建工作空間,一直這么持續下去,直到最后出現未響應。汗,在網上搜了一把也沒找到結果。在這里貼出來,希望有遇到過的可以給俺指點指點,xp都用幾年了,實在是不想用xp了。哦忘了介紹下硬件配置了:酷睿T6600雙核處理器 2.2主頻 2G內存,我記得以前臺式機一G內存 AMD3000+還照樣跑myeclipse了,難道win7不支持myeclipse么,呵呵,這好像有點說不過去,畢竟Java老大哥是跨平臺的么,好了,不扯了,有誰遇到過,麻煩給解釋下。
汗,解決了
抓個圖來炫炫
package com.poi.excel;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
public class CreateExcel {
public static void create()
{
//創建工作表
HSSFWorkbook wb=new HSSFWorkbook();
//創建第一個工作區
HSSFSheet sheet=wb.createSheet("周工作報表");
//創建標題行
HSSFRow row=sheet.createRow(0);
//創建第一行的第一個單元格
HSSFCell cell=row.createCell(0);
cell.setCellValue("序號");
cell=row.createCell(1);
cell.setCellValue("星期一");
cell=row.createCell(2);
cell.setCellValue("星期二");
cell=row.createCell(3);
cell.setCellValue("星期三");
cell=row.createCell(4);
cell.setCellValue("星期四");
cell=row.createCell(5);
cell.setCellValue("星期五");
cell=row.createCell(6);
cell.setCellValue("星期六");
cell=row.createCell(7);
cell.setCellValue("星期日");
List list=new ArrayList();
list.add("開會");
list.add("下訂單");
list.add("拜訪客戶");
list.add("研討");
list.add("再次拜訪");
list.add("達成協議");
list.add("簽署協議");
for (int i = 0; i < list.size(); i++) {
row=sheet.createRow(i+1);
cell=row.createCell(0);
cell.setCellValue(i+1);
cell=row.createCell(1);
cell.setCellValue(list.get(0).toString());
cell=row.createCell(2);
cell.setCellValue(list.get(1).toString());
cell=row.createCell(3);
cell.setCellValue(list.get(2).toString());
cell=row.createCell(4);
cell.setCellValue(list.get(3).toString());
cell=row.createCell(5);
cell.setCellValue(list.get(4).toString());
cell=row.createCell(6);
cell.setCellValue(list.get(5).toString());
cell=row.createCell(7);
cell.setCellValue(list.get(6).toString());
}
File f=new File("計劃書11.xls");
try {
wb.write(new FileOutputStream(f));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
CreateExcel.create();
}
}