📄 filetag.java
字号:
package com.jspdev.ch14;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.*;
public class FileTag extends SimpleTagSupport {
private String fileName;
public void setFileName(String fileName)
{
this.fileName=fileName;
}
public void doTag() throws JspException, IOException
{
BufferedReader in=new BufferedReader(new FileReader(fileName));
String temp="";
String fileContent="";
while((temp=in.readLine())!=null)
fileContent+=temp;
in.close();
getJspContext().getOut().write( "<table border=1><tr bgcolor=9944cc><td>文件标签</tr></td><tr bgcolor=cc44cc><td>"+fileContent+"</td></tr></table>" );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -