You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Fernando Wermus <fe...@gmail.com> on 2010/01/04 22:43:45 UTC

More than one access denied page

I would like to have two access denied pages according to some parameters.
Is this possible?




-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus

Re: Unexpected RuntimeException with PagingNavigator

Posted by Igor Vaynberg <ig...@gmail.com>.
use PagingNavigator instead

-igor

On Mon, Jan 4, 2010 at 3:58 PM, devush <de...@googlemail.com> wrote:
> Dear All,
> I am trying to get a Pagingnavigator using DataView.
> I get following exception(Jetty 6.1.4 DEVELOPMENT mode, Wicket 1.4.5 ):
> ---
> Unexpected RuntimeException:
> WicketMessage: The component(s) below failed to render. A common problem is
> that you have added a component in code but forgot to reference it in the
> markup (thus the component will never be rendered).
> 1. [MarkupContainer [Component id = pageLink]]
> 2. [Component id = pageNumber]
> 3. [MarkupContainer [Component id = pageLink]]
> 4. [Component id = pageNumber]
> 5. [MarkupContainer [Component id = pageLink]]
> 6. [Component id = pageNumber]
> Root cause:org.apache.wicket.WicketRuntimeException: The component(s) below
> failed to render. A common problem is that you have added a component in
> code but forgot to reference it in the markup (thus the component will never
> be rendered).
> 1. [MarkupContainer [Component id = pageLink]]
> 2. [Component id = pageNumber]
> 3. [MarkupContainer [Component id = pageLink]]
> 4. [Component id = pageNumber]
> 5. [MarkupContainer [Component id = pageLink]]
> 6. [Component id = pageNumber]
> at org.apache.wicket.Page.checkRendering(Page.java:1162)
> at org.apache.wicket.Page.renderPage(Page.java:922)
> at
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:261)
> ----
> Current Class extends the WebPage. My code looks like:
>
> IDataProvider<Contact> itemDataProvider = new IDataProvider<Contact>() {
> public Iterator iterator(int first, int count) {
>   Object[] objs = list.toArray();
>   List outList = new ArrayList();
>   for (int i = first; i < count; i++) {   // i know this is not clean
>       Contact c = (Contact) objs[i];
>       outList.add(c);
>   }
>   return outList.iterator();
> }
>
> public IModel<Contact> model(final Contact object) {
>   return new LoadableDetachableModel() {
>
>   @Override
>   protected Contact load() {
>   return (Contact) object;
>       }
>   };
>   }
>   public int size() {
>       return list.size();
>   }
>   public void detach() {}
>   };
> DataView dataView = new DataView("mywork", itemDataProvider, 5) {
>   protected void populateItem(Item item) {
>       Contact contact = (Contact) item.getModelObject();
>       item.add(new Label("id", contact.getId()));
>   }
> };
> dataView.setItemsPerPage(5);
> add(dataView);
> add(new PagingNavigation("nav", dataView));
>
> It works fine if I take the PagingNavigation out of code.
>
> My HTML Code is:
> <table cellspacing="0" class="dataview" >
> <tbody>
> <tr wicket:id="mywork">
> <td><span wicket:id="id">Test ID</span></td>
> </tr>
> </tbody>
> </table>
> <span wicket:id="nav">navigation controls here</span>
>
> Apart from this, i also tried with
>   new DataView("mywork", new ListDataProvider(list))
>
> any ideas where I am wrong.
> regards,
> devush
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Unexpected RuntimeException with PagingNavigator

Posted by devush <de...@googlemail.com>.
Dear All,
I am trying to get a Pagingnavigator using DataView.
 I get following exception(Jetty 6.1.4 DEVELOPMENT mode, Wicket 1.4.5 ):
---
Unexpected RuntimeException:
WicketMessage: The component(s) below failed to render. A common problem is
that you have added a component in code but forgot to reference it in the
markup (thus the component will never be rendered).
1. [MarkupContainer [Component id = pageLink]]
2. [Component id = pageNumber]
3. [MarkupContainer [Component id = pageLink]]
4. [Component id = pageNumber]
5. [MarkupContainer [Component id = pageLink]]
6. [Component id = pageNumber]
Root cause:org.apache.wicket.WicketRuntimeException: The component(s) below
failed to render. A common problem is that you have added a component in
code but forgot to reference it in the markup (thus the component will never
be rendered).
1. [MarkupContainer [Component id = pageLink]]
2. [Component id = pageNumber]
3. [MarkupContainer [Component id = pageLink]]
4. [Component id = pageNumber]
5. [MarkupContainer [Component id = pageLink]]
6. [Component id = pageNumber]
at org.apache.wicket.Page.checkRendering(Page.java:1162)
at org.apache.wicket.Page.renderPage(Page.java:922)
at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:261)
 ----
Current Class extends the WebPage. My code looks like:

IDataProvider<Contact> itemDataProvider = new IDataProvider<Contact>() {
public Iterator iterator(int first, int count) {
    Object[] objs = list.toArray();
    List outList = new ArrayList();
    for (int i = first; i < count; i++) {   // i know this is not clean
        Contact c = (Contact) objs[i];
        outList.add(c);
    }
    return outList.iterator();
}

public IModel<Contact> model(final Contact object) {
    return new LoadableDetachableModel() {

    @Override
    protected Contact load() {
    return (Contact) object;
        }
    };
    }
    public int size() {
        return list.size();
    }
    public void detach() {}
    };
DataView dataView = new DataView("mywork", itemDataProvider, 5) {
    protected void populateItem(Item item) {
        Contact contact = (Contact) item.getModelObject();
        item.add(new Label("id", contact.getId()));
    }
};
dataView.setItemsPerPage(5);
add(dataView);
add(new PagingNavigation("nav", dataView));

It works fine if I take the PagingNavigation out of code.

My HTML Code is:
<table cellspacing="0" class="dataview" >
<tbody>
 <tr wicket:id="mywork">
 <td><span wicket:id="id">Test ID</span></td>
 </tr>
</tbody>
</table>
<span wicket:id="nav">navigation controls here</span>

Apart from this, i also tried with
    new DataView("mywork", new ListDataProvider(list))

any ideas where I am wrong.
regards,
devush 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: More than one access denied page

Posted by Igor Vaynberg <ig...@gmail.com>.
what causes the page to be displayed?

-igor

On Mon, Jan 4, 2010 at 1:43 PM, Fernando Wermus
<fe...@gmail.com> wrote:
> I would like to have two access denied pages according to some parameters.
> Is this possible?
>
>
>
>
> --
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: More than one access denied page

Posted by Fernando Wermus <fe...@gmail.com>.
I implemented the interface you mention on my own xxxAuthorizationStrategy,
but It doesnt work. I think this is because the user isnt authenticated and
he is trying to access a protected page.



On Tue, Jan 5, 2010 at 7:50 AM, Wilhelmsen Tor Iver <To...@arrive.no>wrote:

> > I would like to have two access denied pages according to some
> > parameters.
> > Is this possible?
>
> In your implementation of IUnauthorizedComponentInstantiationListener check
> for the parameters (e.g. placed into the request or the like) and set a
> different responsepage or redirect to a different page based on this.
>
> - Tor Iver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus

SV: More than one access denied page

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> I would like to have two access denied pages according to some
> parameters.
> Is this possible?

In your implementation of IUnauthorizedComponentInstantiationListener check for the parameters (e.g. placed into the request or the like) and set a different responsepage or redirect to a different page based on this.

- Tor Iver

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org