|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.Component
org.apache.wicket.markup.html.WebComponent
org.apache.wicket.markup.html.include.Include
public class Include
Component that includes/ renders the import result of an URL, much like JSP include.
Use this to integrate non-Wicket locations in your page. This component is NOT meant for integrating more Wicket sources as a means of quick and dirty page composition. Use Panels, Borders and (Markup)inheritance for page composition instead.
You can feed this component the URL directly, or use a model that should deliver a valid URL. You can both use absolute (e.g. http://www.theserverside.com/) and relative (e.g. mydir/mypage.html) urls. This component will try to resolve relative urls to resources in the same webapplication.
The following example shows how to integrate a header and footer, coming from a plain HTML source on the same server is integrated using this component. The files footer.html and header.html would be located in the web application root directory
Java:
...
add(new Include("header", "header.html"));
add(new Include("footer", "footer.html"));
...
Html:
...
<div>
<div wicket:id="header">header comes here</div>
<div>I am the body!</div>
<div wicket:id="footer">footer comes here</div>
</div>
...
| Field Summary |
|---|
| Fields inherited from class org.apache.wicket.Component |
|---|
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
| Constructor Summary | |
|---|---|
Include(String id)
Construct. |
|
Include(String id,
IModel<String> model)
Construct. |
|
Include(String id,
String modelObject)
Construct. |
|
| Method Summary | |
|---|---|
Charset |
getCharset()
|
protected String |
importAsString()
Imports the contents of the url of the model object. |
void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Processes the body. |
| Methods inherited from class org.apache.wicket.markup.html.WebComponent |
|---|
onRender |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Include(String id)
id - component id
public Include(String id,
IModel<String> model)
id - component idmodel - the model
public Include(String id,
String modelObject)
id - component idmodelObject - the model object (will be wrapped in a model)| Method Detail |
|---|
protected String importAsString()
public void onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Component
onComponentTagBody in class ComponentmarkupStream - The markup streamopenTag - The open tag for the bodypublic Charset getCharset()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||