Hi Ivo,
Thanks! Lennaert had a similar problem and was able to solve it using
TextTemplate.
I solved my problem by creating an override of Include.onComponentTagBody :
add(new Include("include", "index.html") {
@Override
protected void onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag) {
// the original string
String content = importAsString();
// the variables to replace
Map<String, String> variables = new HashMap<String,
String>();
variables.put("contextPath",
getApplication().getApplicationSettings().getContextPath());
String newContent =
MapVariableInterpolator.interpolate(content, variables);
replaceComponentTagBody(markupStream, openTag, newContent);
}
});
Regards,
Matthijs
Ivo van Dongen wrote:
> Hi,
>
> I've used PackagedTextTemplate
> <http://wicketframework.org/wicket-extensions/apidocs/wicket/extensions/util/resource/PackagedTextTemplate.html>
>
> a couple of times in the past to include some macro like replacements.
> You can use the string from the template in a label and use
> setEscapeModelStrings() to let the html be rendered normally. I've
> used this for javascript in the past, but I don't see any problems in
> using it for html includes.
> Look at this component
> <http://webical.svn.sourceforge.net/viewvc/webical/trunk/src/main/java/org/webical/web/components/ajax/calendar/YUICalendar.java?revision=367&view=markup>
>
> and its template
> <http://webical.svn.sourceforge.net/viewvc/webical/trunk/src/main/resources/org/webical/web/components/ajax/calendar/calendarInitWithConfiguration.js?view=markup>
>
> for an example.
>
> Hope it helps,
> Ivo
> ||
> On 1/22/07, *Matthijs Wensveen* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Hi,
> I'm using an Include component to include some 'static' html file. The
> problem is that the html file references path that depend on the
> context
> path of the application so I would like to dynamically replace
> some text
> in the html file with the context path. i.e.: <a
> href="${contextPath}/my/other.html">link</a>.
>
> What would be the 'wicket' way to do this? I've looked at
> VariableInterpolator and that seems like an interesting class to use,
> but I don't know how and where. One idea would be to write a
> IResponseFilter but if it can be done in an easier way I would prefer
> that of course.
>
> Thanks in advance,
> Matthijs
>
> --
> Matthijs Wensveen
> Func. Internet Integration
> W http://www.func.nl
> T +31 20 4230000
> F +31 20 4223500
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net 's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ------------------------------------------------------------------------
>
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
--
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user