JSP内建对象
JSP内建对象- -
① out - javax.servlet.jsp.jspWriter
out对象用于把结果输出到网页上。
方法:
1. void clear() ;
清除输出缓冲区的内容,但是不输出到客户端。
2. void clearBuffer() ;
清除输出缓冲区的内容,并输出到客户端。
3. void close() ;
关闭输出流,清除所有内容。
4. void flush() ;
输出缓冲区里面的数据。
5. int getBufferSize() ;
获取以kb为单位的目前缓冲区大小。
6. int getRemaining() ;
获取以kb为单位的缓冲区中未被占用的空间大小。
7. boolean isAutoFlush() ;
是否自动刷新缓冲区。
8. void newLine() ;
输出一个换行字符。
9. void print( boolean b ) ;
void print( char c ) ;
void print( char[] s ) ;
void print( double d ) ;
void print( float f ) ;
void print( int i ) ;
void print( long l ) ;
void print( Object obj ) ;
void print( String s ) ;
将指定类型的数据输出到Http流,不换行。
10. void println( boolean b ) ;
void println( char c ) ;
void println( char[] s ) ;
void println( double d ) ;
void println( float f ) ;
void println( int i ) ;
void println( long l ) ;
void println( Object obj ) ;
void println( String s ) ;
将指定类型的数据输出到Http流,并输出一个换行符。
11. Appendable append( char c ) ;
Appendable append( CharSequence cxq, int start, int end ) ;
Appendable append( CharSequence cxq ) ;
将一个字符或者实现了CharSequence接口的对象添
相关文档:
不说废话了,看下面的例子吧(利用structs实现):
在WEB-INF下有两个页面: a.jsp 和 b.jsp , 现在要实现从a.jsp连接到b.jsp
在a.jsp中:
<html:link action= ......
3. <jsp:forward page="" />
它的底层部分是由RequestDispatcher来实现的,因此它带有RequestDispatcher.forward()方法的印记。
如果在之前有很多输出,前面的输出已使缓冲区满,将自动输出到客户端,那么该语句将不起作用,这一点应该特别注意。
另外要注意:它不能改变浏览器地址,刷新的话会导致重复提交
4. 修改HTTP ......
一:工厂模式出现的原因
一般设计模式:
view plaincopy to clipboardprint?
interface Fruit{
public void eat();
}
class Apple implements Fruit{
&n ......
引用自: http://hi.baidu.com/tickwudi/blog/item/1c0ddb6dd4e821fc4316949b.html
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort ......
我们都知道在jsp中include有两种形式,分别是
< %@ include file=” ”% >
< jsp:include page=” ” flush=”true”/ >
前者是指令元素、后者是行为元素。
具体它们将在何处用?如何用及它们有什么区别?这应该是很多人看到它都会想到的问题。下面一起来看看吧。
通常 ......