wicket

Wicket - getting body of markup element

混江龙づ霸主 提交于 2019-12-06 15:05:08
Assuming I have markup that looks like this : <span wicket:id="text">Some text that I'd like to read</span> Is it possible to get the content of the body of the tag somewhere, or is it irremediably stripped by wicket? Edit : My intent is to implement some kind of simple CMS. Users need to be able to enter LaTeX formulas, in the form of tex>a^2</tex> that I would then render with a RenderedDynamicImageResource. Other tags need to be interpreted in a similar way. I envisioned to do it in two steps with a Panel like this : public class LightweightMarkupPanel extends Panel implements

How to set custom HTTP response header in Wicket's Ajax responses?

☆樱花仙子☆ 提交于 2019-12-06 14:04:01
I need to set a custom HTTP header to all responses from my Wicket application. I'm currently doing it in a custom RequestCycle, where getWebResponse() is overridden along these lines: @Override public WebResponse getWebResponse() { WebResponse response = super.getWebResponse(); response.setHeader("X-custom", "..." ); return response; } This has worked great, until now that I've switched to using AjaxCheckBox ( something like this ) instead of normal CheckBox for certain configuration options. My question is, is there an easy way to include my custom header also in Wicket's Ajax responses ?

Refreshing a wicket Panel in browser refresh

牧云@^-^@ 提交于 2019-12-06 13:05:22
Im working on a pay-role system, and once the user refreshes the browser i need to refresh the statistics available in that page (the stats should be taken from the DB and display). But right now it doesn't work properly, cos in page refresh the java code doesn't get invoked but loads the cached page with the previous data. I tried fixing it adding the below code but it didn't work as well. @Override protected void setHeaders(WebResponse response) { response.setHeader("Cache-Control", "no-cache, max-age=0,must-revalidate, no-store"); } Anyone knows the fix for this? Thanks! This was the

Is there a way to introduce Internet Explorer conditional comments using JavaScript?

不羁岁月 提交于 2019-12-06 11:15:39
I have a segment of HTML code which includes a conditional comment: <!--[if IE]> <link rel="stylesheet" ...> <[endif]--> This code was tested and works correctly when included in the HEAD section of the page, on the initial page rendering. I would like to introduce the same conditional CSS to an existing page using JavaScript in an Ajax response. I have tried: var comment = document.createComment("[if IE]>\n<link rel=\"stylesheet\" ...>\n<[endif]"); Wicket.Head.addElement(comment); //this is framework code that just appends the element to the HEAD node of the page. I debugged and verified that

Call Wicket Code from Javascript

╄→гoц情女王★ 提交于 2019-12-06 11:10:55
问题 I'm trying to call some Java code from Javascript in Wicket. This is my Java code: public ShowUnternehmen() { add(new AbstractDefaultAjaxBehavior() { @Override protected void respond(AjaxRequestTarget ajaxRequestTarget) { System.out.println("respond"); } @Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead( component, response ); System.out.println(getCallbackUrl()); } }); } And this is the Javascript code: <wicket:head> <script type="text

Seeing the http request in wicket

梦想与她 提交于 2019-12-06 11:02:13
I'm using Apache Wicket and I want to see the http request itself (Exact text of the request without any processing!). What should I do? Thanks In Wicket 1.4, you can get the HttpServletRequest object (which is the servlet representation of the request, the rawest you can get) with this code: HttpServletRequest req = ((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest(); However, the "without any processing" part will not work for two reasons: the servlet engine itself will do some processing (like decoding url parameters) and Wicket will have consumed the input stream

Wicket ListView not refreshing

懵懂的女人 提交于 2019-12-06 08:52:50
I am taking my first steps with Apache Wicket and ran into the following problem. I have a ListView that displays a "delete" link right next to its entries. When the delete link is clicked, the entity represented by the list item is deleted from the database but the list itself does not get updated until I reload the page manually in the browser. IModel<List<SampleEntity>> sampleEntityListModel = new LoadableDetachableModel<List<SampleEntity>>() { @Override protected List<SampleEntity> load() { return mSampleEntityBA.findAll(); } }; mListview = new ListView<SampleEntity>("listview",

Wicket 6 IColumn How the name can be of type other than string?

↘锁芯ラ 提交于 2019-12-06 08:37:47
Interface IColumn contains a method getSortProperty(), which returns a value of any type S. How the name can be of type other than string? /** * Returns the name of the property that this header sorts. If null is returned the header will * be unsortable. * * @return the sort property */ S getSortProperty(); http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/extensions/markup/html/repeater/data/table/IColumn.html In wicket older version 6: PropertyColumn<SomeClass> column = new PropertyColumn(Model.of("Header"), "sortProperty", "propertyExpression"); Wicket 6: description:

Wicket wants to serialize my Panel

狂风中的少年 提交于 2019-12-06 08:10:44
When I access a specific page of my Wicket application, I get a NotSerializableException: java.io.NotSerializableException: my.package.MyPanel$1 But I can't explain why wicket should try to serialize the Panel . Any idea? I don't know if it helps, but here is the code I use to add the panel: final User profileUser = ...; final IModel<User> loggedInUser = ...; add(new MyPanel("panelid", new Model<MyObject>(new MyObject())) { @Override public boolean isVisible() { return profileUser != null && profileUser.equals(loggedInUser.getObject()); } }); Wicket serializes many things into the session as

How to control JPA persistence in Wicket forms?

谁都会走 提交于 2019-12-06 06:43:45
问题 I'm building an application using JPA 2.0 (Hibernate implementation), Spring, and Wicket. Everything works, but I'm concerned that my form behaviour is based around side effects. As a first step, I'm using the OpenEntityManagerInViewFilter . My domain objects are fetched by a LoadableDetachableModel which performs entityManager.find() in its load method. In my forms, I wrap a CompoundPropertyModel around this model to bind the data fields. My concern is the form submit actions. Currently my