I am looking at wicket trying to decide if i would want to use it for my
project.
Currently I am struggling trying to give static and dynamic pages consistent
look with wicket without using sitemesh. I was able to get wicket
application to direct all static page requests to my wicket StaticPage that
would read the content of a file and add it to the page as MultiLineLabel.
However my problem is that i don't want to add whole html file. I need to
extract the content of <title>, <body> and <meta> tags and add these
separately. Is there anything in api or any examples i should look at ?
Please see the code below.
in Aplication.java init()
mount(new URIRequestTargetUrlCodingStrategy("/docs")
{
@Override
public IRequestTarget decode(RequestParameters
requestParameters)
{
String path = "/app/" + getURI(requestParameters);
return new PageRequestTarget(new StaticPage(new
WebExternalResourceRequestTarget(path)));
}
});
----------------------------------------------------------------------------------------------------------------------------------------------------------------
in StaicPage.java
public class StaticPage extends BasePage implements AuthenticatedWebPage
{
public StaticPage(WebExternalResourceRequestTarget staticResource)
{
String staticResourceContent = "";
try {
staticResourceContent =
convertStreamToString(staticResource.getResourceStream().getInputStream());
} catch (ResourceStreamNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
add(new MultiLineLabel("staticContent",
staticResourceContent));
}
}
---------------------------------------------------------------------------------------------------------------------------
Here is what i get in the browser when click on static link:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
this is a test
</body>
</html>
This is in the footer
--------------------------------------------------------------------------------------------------
Another variation of StaticPage.java i tried was
public class StaticPage extends BasePage implements AuthenticatedWebPage
{
public StaticPage(WebExternalResourceRequestTarget staticResource)
{
MarkupResourceStream markupStream =
new
MarkupResourceStream(staticResource.getResourceStream());
MarkupParser parser = new MarkupParser(markupStream);
Markup markup = parser.parse();
However I got stuck at this point since i still don't see a way of getting
individual html tags from Markup
thank you in advance,
Vicky
--
View this message in context:
http://www.nabble.com/how-to-give-static-pages-consistant-look-with-wicket---partial-repeat-tp21958254p21958254.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]