You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kshitiz <k....@gmail.com> on 2012/05/27 15:20:06 UTC
Problem in adding user confirmation feature by wicket way...
Hi,
I am trying to get user confirmation before deleting something...here is the
code:
// Defining delete button for deleting post
AjaxFallbackButton ajaxPostDeleteButton = new AjaxFallbackButton(
"postDeleteButton", postForm) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target,
final Form<?> form) {
if (target != null) {
try {
ShowPostPanel.this
.replaceWith(new ConfirmDeletePanel(
ShowPostPanel.this.getId(),
"really delete?") {
@Override
protected void onCancel() {
this.replaceWith(ShowPostPanel.this);
}
@Override
protected void onConfirm() {
PostService postService = new PostService();
int postId = ((PostDomain) listItem
.getModelObject())
.getPostId();
postService
.deletePost(postId);
this.replaceWith(ShowPostPanel.this);
}
});
} catch (Exception exception) {
error(exception.getMessage());
}
setResponsePage(getPage().getPageClass());
target.add(postDomainListContainer);
}
}
@Override
protected void onError(AjaxRequestTarget target,
Form<?> form) {
// TODO Auto-generated method stub
}
/*@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return ajaxPostprocessingCallDecorator;
}*/
};
*ConfirmDeletePanel is same as given in tutorial and ShowPostPanel is where
the delet button is present.*
But I am getting the error:
Root cause:
*org.apache.wicket.WicketRuntimeException: No Page found for component [
[Component id = postDeleteButton]]
* at org.apache.wicket.Component.getPage(Component.java:1776)
at WalknShine.Panel.ShowPostPanel$2$1.onSubmit(ShowPostPanel.java:149)
at
org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:76)
at
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(AjaxFormSubmitBehavior.java:172)
at
org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1151)
What is the error basically? I am not able to get it...code works fine if I
remove this ConfirmDeletePanel part.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Problem-in-adding-user-confirmation-feature-by-wicket-way-tp4649510.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problem in adding user confirmation feature by wicket way...
Posted by kshitiz <k....@gmail.com>.
Please help me out here...I dont want to use javascript to get user
confirmation...
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Problem-in-adding-user-confirmation-feature-by-wicket-way-tp4649510p4649523.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problem in adding user confirmation feature by wicket way...
Posted by kshitiz <k....@gmail.com>.
I removed the error by modifying the code:
protected void onConfirm() {
PostService postService = new PostService();
int postId = ((PostDomain) listItem
.getModelObject())
.getPostId();
try {
postService
.deletePost(postId);
*setResponsePage(getPage().getPageClass());* // added here
} catch (Exception exception) {
error(exception.getMessage());
}
this.replaceWith(ShowPostPanel.this);
}
Now the error is:
*org.apache.wicket.request.handler.ComponentNotFoundException: Could not
find component
'userTypePanel:userType:0:showPostPanel:postDomainListContainer:post:0:postForm:postDeleteButton'
on page 'class WalknShine.Home.Home
* at
org.apache.wicket.request.handler.PageAndComponentProvider.getComponent(PageAndComponentProvider.java:181)
at
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.getComponent(ListenerInterfaceRequestHandler.java:92)
at
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:239)
at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:781)
at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
ShowPostPanel is present inside UserTypePanel. Why it is searching that as
I have given ShowPostPanel to be replaced??
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Problem-in-adding-user-confirmation-feature-by-wicket-way-tp4649510p4649512.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org