|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.github.drinkjava2.jwebbox.WebBox
public class WebBox
JWebBox is a small layout tool used in java server pages(JSP) projects, playing the same role like Apache Tiles and SiteMesh, no XML file, no Tags, simple(only 1 java file), can be used to support whole site's layout or only few page components.
| Nested Class Summary | |
|---|---|
static class |
WebBox.Show
This is a custom TagLib for JSP and also can be used in FreeMaker |
static class |
WebBox.WebBoxException
A runtime exception caused by WebBox |
| Field Summary | |
|---|---|
static String |
JWEBBOX_ID
|
| Constructor Summary | |
|---|---|
WebBox()
|
|
WebBox(String page)
Create a WebBox |
|
| Method Summary | ||
|---|---|---|
void |
afterExecute()
For subclasses override this method to do something |
|
void |
afterPrepared()
For subclasses override this method to do something |
|
void |
afterShow()
For subclasses override this method to do something |
|
void |
beforeExecute()
For subclasses override this method to do something |
|
void |
beforeShow()
For subclasses override this method to do something |
|
void |
execute()
For subclasses override this method to do something |
|
static
|
getAttribute(javax.servlet.jsp.PageContext pageContext,
String attributeName)
Get an attribute from current page's WebBox instance |
|
|
getAttribute(String key)
Get WebBox's attribute |
|
Map<String,Object> |
getAttributeMap()
Get the attribute map of WebBox instance |
|
static WebBox |
getBox(javax.servlet.jsp.PageContext pageContext)
Get current pageContext's WebBox instance |
|
WebBox |
getFatherWebBox()
Set the father page's WebBox instance |
|
String |
getName()
get the name of the WebBox instance |
|
|
getObject(String key)
Search and return an attribute object follow this order: pageContext->request->parameter->session |
|
Object |
getPage()
Get the page |
|
javax.servlet.jsp.PageContext |
getPageContext()
Get current pageContext if have |
|
Object |
getPrepareBean()
Get the prepare bean instance |
|
String |
getPrepareBeanMethod()
Get the prepare bean method name |
|
String |
getPrepareStaticMethod()
Get the Prepare static method name |
|
String |
getPrepareURL()
Get the prepare URL |
|
String |
getText()
Get the Text |
|
static boolean |
isEmptyStr(String str)
Check if String null or empty |
|
void |
prepareOnly(javax.servlet.jsp.PageContext pageContext)
Prepare data, only but do not output text and do not show page |
|
WebBox |
setAttribute(String key,
Object value)
Set attribute for current WebBox instance |
|
WebBox |
setAttributeMap(Map<String,Object> attributeMap)
Set the attribute map for WebBox instance |
|
void |
setFatherWebBox(WebBox fatherWebBox)
Get the father page's WebBox instance |
|
WebBox |
setName(String name)
Set the name of the WebBox instance |
|
WebBox |
setPage(Object page)
Set a JSP page or URL |
|
void |
setPageContext(javax.servlet.jsp.PageContext pageContext)
Set pageContext to it |
|
void |
setPageContextAttribute(String key,
Object value)
Set a pageContext attribute |
|
WebBox |
setPrepareBean(Object prepareBean)
Set a prepare bean which has a prepare method |
|
WebBox |
setPrepareBeanMethod(String prepareBeanMethod)
Set the bean prepare method name |
|
WebBox |
setPrepareStaticMethod(String prepareStaticMethod)
Set a prepare static method |
|
WebBox |
setPrepareURL(String prepareURL)
Set prepare URL, this URL be called after prepare methods but before show page |
|
void |
setRequestAttribute(String key,
Object value)
Set a request attribute |
|
void |
setSessionAttribute(String key,
Object value)
Set a session attribute |
|
WebBox |
setText(String text)
Set the text String |
|
WebBox |
show(javax.servlet.jsp.PageContext pageContext)
Prepare data and out put text include page if have |
|
static void |
showAttribute(javax.servlet.jsp.PageContext pageContext,
String attributeName)
Assume the value is String or WebBox instance, show it |
|
WebBox |
showPageOnly(javax.servlet.jsp.PageContext pageContext)
Show page only, do not call prepareStaticMethod and URL |
|
static void |
showTarget(javax.servlet.jsp.PageContext pageContext,
Object target)
Show an target object, target can be: WebBox instance or String or List of WebBox instance or String |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String JWEBBOX_ID
| Constructor Detail |
|---|
public WebBox()
public WebBox(String page)
page - The JSP or FTL or any URL, for example: "/template/abc.jsp"| Method Detail |
|---|
public static boolean isEmptyStr(String str)
public void beforeShow()
public void beforeExecute()
public void execute()
public void afterExecute()
public void afterPrepared()
public void afterShow()
public WebBox show(javax.servlet.jsp.PageContext pageContext)
public void prepareOnly(javax.servlet.jsp.PageContext pageContext)
public WebBox showPageOnly(javax.servlet.jsp.PageContext pageContext)
public static WebBox getBox(javax.servlet.jsp.PageContext pageContext)
public static <T> T getAttribute(javax.servlet.jsp.PageContext pageContext,
String attributeName)
public static void showAttribute(javax.servlet.jsp.PageContext pageContext,
String attributeName)
public static void showTarget(javax.servlet.jsp.PageContext pageContext,
Object target)
public WebBox setAttribute(String key,
Object value)
public <T> T getAttribute(String key)
public <T> T getObject(String key)
public void setPageContextAttribute(String key,
Object value)
public void setRequestAttribute(String key,
Object value)
public void setSessionAttribute(String key,
Object value)
public String getPrepareURL()
public WebBox setPrepareURL(String prepareURL)
public Object getPage()
public WebBox setPage(Object page)
public String getText()
public WebBox setText(String text)
public WebBox setPrepareStaticMethod(String prepareStaticMethod)
public String getPrepareStaticMethod()
public Object getPrepareBean()
public WebBox setPrepareBean(Object prepareBean)
public String getPrepareBeanMethod()
public WebBox setPrepareBeanMethod(String prepareBeanMethod)
public Map<String,Object> getAttributeMap()
public WebBox setAttributeMap(Map<String,Object> attributeMap)
public String getName()
public WebBox setName(String name)
public WebBox getFatherWebBox()
public void setFatherWebBox(WebBox fatherWebBox)
public javax.servlet.jsp.PageContext getPageContext()
public void setPageContext(javax.servlet.jsp.PageContext pageContext)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||