Hi,
I implemented your version but still I get the same error, if
I have the Google Analytics Code in the head.
Could it be an error with the way I insert the Google
Analytics Code? I do it in the following way.
In my WebPage class I overwrite the following method:
@Override
public void renderHead(HeaderResponse response) {
String script = "var _gaq = _gaq || ...";
response.renderJavaScript(script, null);
}
Andre
On Wed, 11 Apr 2012 11:38:52 +0200
Bas Gooren <[email protected]> wrote:
> Well, for starters I wonder why you are using multiple
> LoadableDetachableModels in a Vector?
>
> What we do 99% of the time is this:
> - Wrap the entire resultset in a LDM
> - Feed that LDM to a ListView or a variant (we have a custom
> RepeatingView for paged database listings)
> - Use PropertyModels inside the repeater item(s) (or not, since the
> ListView will refresh itself anyway)
>
> I'm pretty sure you don't need setReuseItems(true) in this case; The
> only reason I've seen where it's required on a ListView is when you use
> it inside a form and need form validation to work. Since I don't see any
> form fields inside your listview I guess this is not the case.
>
> I also wonder why you had "datacontainer.setVersioned(false)"?
>
> E.g.:
>
> private void displayResults(IModel<List<DefaultSearchResult>> results, int
> entriesPerPage) {
> WebMarkupContainer datacontainer = new
> WebMarkupContainer("listviewContainer");
> datacontainer.setOutputMarkupId(true);
> add(datacontainer);
>
> PageableListView<DefaultSearchResult> listview = new
> PageableListView<DefaultSearchResult>("listview", results, entriesPerPage) {
> StringBuilder sb;
>
> @Override
> protected void populateItem(ListItem<DefaultSearchResult> item) {
> DefaultSearchResult s = item.getModelObject();
>
> // Either (A)
> item.add(new ExternalLink("title", new
> PropertyModel(item.getModel(), "title"));
> // Or (B)
> item.add(new ExternalLink("title", s.getTitle());
>
> item.add(new Label("description", new
> PropertyModel(item.getModel(), "description")));
> item.add(new Label("time",
> s.getTime()).setEscapeModelStrings(false));
> }
> };
>
> datacontainer.add(listview);
> AjaxPagingNavigator apn = new AjaxPagingNavigator("navigator",
> listview){
> @Override
> protected void onAjaxEvent(AjaxRequestTarget target) {
> super.onAjaxEvent(target);
> target.appendJavaScript("scrollTo(0,0)");
> }
> };
> datacontainer.add(apn);
> }
>
>
>
>
> Op 11-4-2012 11:22, schreef [email protected]:
> > Hi,
> >
> > thank you for the answer.
> >
> > The "they are not completely empty" means the following. My results variable
> > is a Vector that contains LoadableDetachableModel's in the form of the
> > LoaableListingEntryModel. This model contains a class that has two variables
> > that I access with getResults() and getTime().
> > The content of the getResults() variable is a class that implements the
> > Serializable
> > interface. The getTime() variable just has a Vector with time strings.
> >
> > Now comes the interesting part. When I click on one of the links from the
> > PagingNavigator, the content of the getTime() variable is displayed in each
> > single ListItem. The getResults() class is empty. The content of the
> > getResults()
> > class is only shown after a page reload and once again empty after clicking
> > on one of the links from the PagingNavigator.
> > That's the reason why I said it is "not completely empty".
> >
> > I know that there are 60 results to display. The PagingNavigator shows 6
> > links for 10 entries per page. But after clicking on one of the links, the
> > objects
> > from the getResults() class are empty.
> >
> > Any idea?
> > Andre
> >
> > ----- Original Message -----
> > From: [email protected]
> > To: [email protected]
> > Date: 11.04.2012 00:51:38
> > Subject: Re: Page Expired with Google Analytics Tracking Code
> >
> >
> >> Hi,
> >>
> >> It sounds a lot like you are not using models properly. E.g. your
> >> "results" method parameter has a length which overflows the page size
> >> (and thus the pagingnavigator renders page links), but on a second
> >> request the contents of "results" are null/empty?
> >>
> >> Try debugging PageableListView#populateItem() and check what its model
> >> points to.
> >>
> >> Can you be more specific with regard to "they are not completely empty"?
> >> What exactly do you see, and what do you expect?
> >>
> >> Kind regards,
> >>
> >> Bas
> >>
> >> Op 10-4-2012 22:19, schreef Andre Schütz:
> >>> Hi,
> >>>
> >>> nobody an idea why the PageableListView is empty after clicking
> >>> on one of the links from the PagingNavigator?
> >>> After reloading of the page, the PageableListView is filled and
> >>> once again empty when I click on oe of the links from the
> >>> PagingNavigator.
> >>>
> >>> It seems, that the Listitem's are empty when I click on one of
> >>> the links in the PagingNavigator. But there are definitely more
> >>> items than just for one page and the PagingNavigator shows 6
> >>> possible pages.
> >>>
> >>> Thanks,
> >>> Andre
> >>>
> >>> On Mon, 9 Apr 2012 19:44:34 +0200
> >>> Andre Schütz<[email protected]> wrote:
> >>>
> >>>> Hello,
> >>>>
> >>>> I tried your approach and could find one mistake in my code.
> >>>> After the stepwise adding of the components to my results page,
> >>>> I found an error in two of my classes that are used on that page.
> >>>> These two classes did not implement the Serializable interface.
> >>>> I added the interface to these two classes and the PageExpired
> >>>> error was gone.
> >>>>
> >>>> But there is still another error. My PageableListView does not
> >>>> display the results when I click on one of the links in the
> >>>> AjaxPagingNavigator. The first page is displayed but the other
> >>>> pages in the list are nearly empty.
> >>>> They are not completely empty. I have 3 elements in an item of
> >>>> the PageableListView populateItem Method that must be filled
> >>>> in the html page.
> >>>> The elements are title, description and time.
> >>>>
> >>>> My code looks as follows:
> >>>>
> >>>> /***************
> >>>> * Code
> >>>> */
> >>>>
> >>>> private void displayResults(Vector<LoadableListingEntryModel> results,
> >>>> int entriesPerPage) {
> >>>> WebMarkupContainer datacontainer = new
> >>>> WebMarkupContainer("listviewContainer");
> >>>> datacontainer.setOutputMarkupId(true);
> >>>> add(datacontainer);
> >>>>
> >>>> PageableListView listview = new PageableListView("listview",
> >>>> results, entriesPerPage) {
> >>>> StringBuilder sb;
> >>>>
> >>>> @Override
> >>>> protected void populateItem(ListItem item) {
> >>>> if (item != null) {
> >>>> LoadableListingEntryModel model =
> >>>> (LoadableListingEntryModel)item.getModelObject();
> >>>> DefaultSearchResult s = model.getObject().getResult();
> >>>> String description = s.getDescription();
> >>>> String title = s.getTitle();
> >>>>
> >>>> item.add(new ExternalLink("title", title));
> >>>> item.add(new Label("description", description));
> >>>> item.add(new Label("time",
> >>>> s.getTime()).setEscapeModelStrings(false));
> >>>> }
> >>>> }
> >>>> };
> >>>>
> >>>> listview.setReuseItems(true);
> >>>> datacontainer.add(listview);
> >>>> AjaxPagingNavigator apn = new AjaxPagingNavigator("navigator",
> >>>> listview){
> >>>> @Override
> >>>> protected void onAjaxEvent(AjaxRequestTarget target) {
> >>>> super.onAjaxEvent(target);
> >>>> target.appendJavaScript("scrollTo(0,0)");
> >>>> }
> >>>> };
> >>>> datacontainer.add(apn);
> >>>> datacontainer.setVersioned(false);
> >>>> }
> >>>>
> >>>> /***************
> >>>> * Code
> >>>> */
> >>>>
> >>>> The LoadableListingEntryModel was one of the two classes
> >>>> that got the Serializable interface.
> >>>> When I click on one of the links of the AjaxPagingNavigator,
> >>>> the title and the description fields are emtpy. The time
> >>>> field is filled.
> >>>>
> >>>> I checked the items and have e.g. 60 items with title,
> >>>> description and time content. But only the time content
> >>>> is displayed, when I click on one of the
> >>>> AjaxPagingNavigator links.
> >>>>
> >>>> This error only occurs, if the Google Adsense Code is
> >>>> in the site. Could it be possible, that the Ajax call of
> >>>> the PageableListView has a problem?
> >>>>
> >>>> Thanks,
> >>>> Andre
> >>>>
> >>>> On Sat, 07 Apr 2012 21:46:53 +0200
> >>>> Bas Gooren<[email protected]> wrote:
> >>>>
> >>>>> Yes.
> >>>>>
> >>>>> Op 7-4-2012 20:37, schreef Andre Schütz:
> >>>>>> Thank you for the answer, I will try your 4 steps.
> >>>>>>
> >>>>>> Just as information. When you say, that I can make the form
> >>>>>> stateless, do you talk about the StatelessForm class?
> >>>>>>
> >>>>>> Andre
> >>>>>>
> >>>>>> On Sat, 07 Apr 2012 16:06:15 +0200
> >>>>>> Bas Gooren<[email protected]> wrote:
> >>>>>>
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> I would suggest the following:
> >>>>>>> 1) add a very simple test page: TestPage extends WebPage, which only
> >>>>>>> has
> >>>>>>> the search form on it (nothing else!)
> >>>>>>> 2) see if that works multiple times in a row
> >>>>>>> 3) if that works, add your google analytics code
> >>>>>>> 4) repeat steps 1-2
> >>>>>>>
> >>>>>>> In other words: eliminitate all other dependencies, so you can test
> >>>>>>> (in
> >>>>>>> isolation) if the google analytics code (or the component you've
> >>>>>>> wrapped
> >>>>>>> it in) is really the issue you are facing.
> >>>>>>>
> >>>>>>> You say that everything works ok when you add the query parameter for
> >>>>>>> the search. Having that parameter means you have a form with
> >>>>>>> method="get"? That, to me, would indicate you can make the form
> >>>>>>> stateless, which should prevent your search from redirecting to a
> >>>>>>> stateful url. (The /wicket/page start of the url indicates a stateful
> >>>>>>> page).
> >>>>>>>
> >>>>>>> But please start with steps 1-4 above to make sure you are looking in
> >>>>>>> the right place for the cause of your PageExpiredException.
> >>>>>>>
> >>>>>>> Bas
> >>>>>>>
> >>>>>>> Op 7-4-2012 14:04, schreef Andre Schütz:
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> I tested the page and could localize the following error:
> >>>>>>>>
> >>>>>>>> page expired:
> >>>>>>>>
> >>>>>>>> http://localhost:8080/wicket/page?7-1.IFormSubmitListener-resultsContent-searchPanel-searchForm
> >>>>>>>>
> >>>>>>>> This means. The error occurs, when I make another search via my
> >>>>>>>> search form which is a normal Form with a textfield and a submit
> >>>>>>>> button. But, when I change the keyword in the URL (represented as
> >>>>>>>> q=KEYWORD parameter), the search works without the error.
> >>>>>>>> It seems, that the Form throws the error when the Google Analytics
> >>>>>>>> Code is in the header.
> >>>>>>>>
> >>>>>>>> Any idea how I can solve that problem?
> >>>>>>>>
> >>>>>>>> Andre
> >>>>>>>>
> >>>>>>>> On Fri, 06 Apr 2012 19:36:28 +0200
> >>>>>>>> Bas Gooren<[email protected]> wrote:
> >>>>>>>>
> >>>>>>>>> Hi Andre,
> >>>>>>>>>
> >>>>>>>>> No, we have been using the tracking code for years with wicket
> >>>>>>>>> (1.3, 1.4
> >>>>>>>>> and 1.5) with 0 issues.
> >>>>>>>>>
> >>>>>>>>> I'm certain your Page expired error is caused by something else.
> >>>>>>>>>
> >>>>>>>>> From your description it sounds like your "search results"
> >>>>>>>>> page is
> >>>>>>>>> stateful, but no longer available when you perform a new search.
> >>>>>>>>> That
> >>>>>>>>> can happen for a variety of reasons.
> >>>>>>>>> What usually happens to narrow the problem down is to strip the
> >>>>>>>>> page as
> >>>>>>>>> far as possible, and see if it works. Incrementally add components
> >>>>>>>>> until
> >>>>>>>>> it breaks again and you will have found the culprit.
> >>>>>>>>>
> >>>>>>>>> Another possibility is that you have non-standard settings for
> >>>>>>>>> wicket
> >>>>>>>>> session (page) management. But my guess is that this is not the
> >>>>>>>>> case.
> >>>>>>>>>
> >>>>>>>>> Kind regards,
> >>>>>>>>>
> >>>>>>>>> Bas
> >>>>>>>>>
> >>>>>>>>> Op 6-4-2012 19:25, schreef Andre Schütz:
> >>>>>>>>>> Hello,
> >>>>>>>>>>
> >>>>>>>>>> did nobody have the same problem with the new Google Analytics
> >>>>>>>>>> code?
> >>>>>>>>>>
> >>>>>>>>>> I added the code directly into the .html file of my WebPage class.
> >>>>>>>>>>
> >>>>>>>>>> Andre
> >>>>>>>>>>
> >>>>>>>>>> On Thu, 5 Apr 2012 14:54:50 +0200
> >>>>>>>>>> Andre Schütz<[email protected]> wrote:
> >>>>>>>>>>
> >>>>>>>>>>> Hello,
> >>>>>>>>>>>
> >>>>>>>>>>> we added the actual Google Analytics Tracking Code into our
> >>>>>>>>>>> Wicket application. The code is rendered on every single
> >>>>>>>>>>> page directly before the closing</head> tag.
> >>>>>>>>>>>
> >>>>>>>>>>> Our problem is the following:
> >>>>>>>>>>> Page 1 with search box -> search for something
> >>>>>>>>>>> Page 2 is a search site where the search request is done
> >>>>>>>>>>> Page 3 is the result page, where the search result is presented
> >>>>>>>>>>>
> >>>>>>>>>>> We do:
> >>>>>>>>>>> Page 1 -> search for something
> >>>>>>>>>>> Page 2 appears and shows search progress
> >>>>>>>>>>> Page 3 appears and displays the results
> >>>>>>>>>>> Page 3 has a search box and we start another search
> >>>>>>>>>>> --> Page expired error
> >>>>>>>>>>>
> >>>>>>>>>>> Any ideas why this happens and how we can stop that?
> >>>>>>>>>>>
> >>>>>>>>>>> Thanks,
> >>>>>>>>>>> Andre
> >>>>>>>>>>>
> >>>>>>>>>>> --
> >>>>>>>>>>> Andre Schütz<[email protected]>
> >>>>>>>>>>>
> >>>>>>>>>>> ---------------------------------------------------------------------
> >>>>>>>>>>> To unsubscribe, e-mail: [email protected]
> >>>>>>>>>>> For additional commands, e-mail: [email protected]
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: [email protected]
> >>>>> For additional commands, e-mail: [email protected]
> >>>> --
> >>>> Andre Schütz<[email protected]>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: [email protected]
> >>>> For additional commands, e-mail: [email protected]
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
--
Andre Schütz <[email protected]>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]