Thanks ,I will try. -----邮件原件----- 发件人: Angelo Chen [mailto:[EMAIL PROTECTED] 发送时间: 2008年4月7日 14:17 收件人: users@tapestry.apache.org 主题: Re: About redirect page
response.sendRedirect(request.getContextPath() + "/login"); return true; txhdeve wrote: > > import java.io.IOException; > > import org.apache.tapestry.services.Request; > import org.apache.tapestry.services.Response; > > public class AccessController implements Dispatcher { > public boolean dispatch(Request request, Response response) throws > IOException { > boolean canAccess = false; > > /* > * Access control logic goes here. If the user is allowed > to > access the > * resource, canAccess should be set to true. > */ > > if(!canAccess) { > /* > * This is an unauthorized request, so throw an > exception. We'll need > * more grace than this, such as a customized > exception page and/or > * redirection to a login page... > */ > throw new RuntimeException("Access violation!"); > } > > return false; > } > } > > > > > > I learn the dispatcher from wiki page of tapestry and I notice the > sentence: > > > > This is an unauthorized request, so throw an exception. We'll need > * more grace than this, such as a customized > exception page and/or > * redirection to a login page... > > > > > > But how to redirect a friendly page (exception page or login page)? > > > -- View this message in context: http://www.nabble.com/About-redirect-page-tp16534281p16534370.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- 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]