You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by abhilash <so...@gmail.com> on 2008/04/16 05:56:54 UTC

issues with redirectexception in tapestry4.1.5

Hi all,
moving to tapestry 4.1.5.In my page i have a submit button which will
redirect to a page .
In the action method of a submit button i am throwing a new
RedirectException.In tapestry4.0.2
i had no problems.but in tapestry4.1.5 the browser is not getting
refreshed.I am pasting piece of my code
here.
<input type="button" class="button" value="Cancel" jwcid="@Submit"
action="listener:refreshClicked"  async="true"/>
public void refreshClicked(IRequestCycle cycle) {
try {
			Stack<Crumb> s = getVisitObject().getUrlStack();
			if(null != s) {
				Crumb crumb = null;
				if(s.size() > 1){
					crumb = s.elementAt(s.size() - 1);
				}
				String previousPage = getPreviousPage();
				if (crumb != null) {
					redirectUrl = crumb.getUrl();
				} else {
					if (previousPage == null) {
						previousPage = "Home";
					}
					cycle.activate(previousPage);
					return;
				}					
				/*if (((previousPage == null) && (crumb != null)) ||
previousPage.equals(getPageName())) {
						previousPage = crumb.getPageId();
					}*/					
			}
			WebRequest request =
getPage().getRequestCycle().getInfrastructure().getRequest();
			List<Message> msgList =
(List<Message>)request.getAttribute(Constants.MESSAGE_LIST);
			if (msgList != null) {
				getVisitObject().setMessageList(msgList);
			}
		} catch (Throwable t) {
			LOG.error("Error while saving changes", t);
			throw new PageRedirectException(PAGE_ERROR);
		} 		
		throw new RedirectException(redirectUrl);

}

when i click on button its not giving any exceptions but the browser is not
getting refreshed.
any ideas?
thanks in advance.

-- 
View this message in context: http://www.nabble.com/issues-with-redirectexception-in-tapestry4.1.5-tp16715950p16715950.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: issues with redirectexception in tapestry4.1.5

Posted by abhilash <so...@gmail.com>.
i got whats the problem is.
redirectUrl was not correct so,i was getting stalelink exception.
it got solved.I want to know in tapestry4.1.5 how do i check
the request is ajaxrequest or not.
thanks for the reply.

Andreas Andreou wrote:
> 
> Can you capture and paste the  ajax response?
> 
> On Wed, Apr 16, 2008 at 6:56 AM, abhilash <so...@gmail.com>
> wrote:
>>
>>  Hi all,
>>  moving to tapestry 4.1.5.In my page i have a submit button which will
>>  redirect to a page .
>>  In the action method of a submit button i am throwing a new
>>  RedirectException.In tapestry4.0.2
>>  i had no problems.but in tapestry4.1.5 the browser is not getting
>>  refreshed.I am pasting piece of my code
>>  here.
>>  <input type="button" class="button" value="Cancel" jwcid="@Submit"
>>  action="listener:refreshClicked"  async="true"/>
>>  public void refreshClicked(IRequestCycle cycle) {
>>  try {
>>                         Stack<Crumb> s = getVisitObject().getUrlStack();
>>                         if(null != s) {
>>                                 Crumb crumb = null;
>>                                 if(s.size() > 1){
>>                                         crumb = s.elementAt(s.size() -
>> 1);
>>                                 }
>>                                 String previousPage = getPreviousPage();
>>                                 if (crumb != null) {
>>                                         redirectUrl = crumb.getUrl();
>>                                 } else {
>>                                         if (previousPage == null) {
>>                                                 previousPage = "Home";
>>                                         }
>>                                         cycle.activate(previousPage);
>>                                         return;
>>                                 }
>>                                 /*if (((previousPage == null) && (crumb
>> != null)) ||
>>  previousPage.equals(getPageName())) {
>>                                                 previousPage =
>> crumb.getPageId();
>>                                         }*/
>>                         }
>>                         WebRequest request =
>>  getPage().getRequestCycle().getInfrastructure().getRequest();
>>                         List<Message> msgList =
>>  (List<Message>)request.getAttribute(Constants.MESSAGE_LIST);
>>                         if (msgList != null) {
>>                                 getVisitObject().setMessageList(msgList);
>>                         }
>>                 } catch (Throwable t) {
>>                         LOG.error("Error while saving changes", t);
>>                         throw new PageRedirectException(PAGE_ERROR);
>>                 }
>>                 throw new RedirectException(redirectUrl);
>>
>>  }
>>
>>  when i click on button its not giving any exceptions but the browser is
>> not
>>  getting refreshed.
>>  any ideas?
>>  thanks in advance.
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/issues-with-redirectexception-in-tapestry4.1.5-tp16715950p16715950.html
>>  Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>  For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> Tapestry / Tacos developer
> Open Source / JEE Consulting
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/issues-with-redirectexception-in-tapestry4.1.5-tp16715950p16719377.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: issues with redirectexception in tapestry4.1.5

Posted by Andreas Andreou <an...@gmail.com>.
Can you capture and paste the  ajax response?

On Wed, Apr 16, 2008 at 6:56 AM, abhilash <so...@gmail.com> wrote:
>
>  Hi all,
>  moving to tapestry 4.1.5.In my page i have a submit button which will
>  redirect to a page .
>  In the action method of a submit button i am throwing a new
>  RedirectException.In tapestry4.0.2
>  i had no problems.but in tapestry4.1.5 the browser is not getting
>  refreshed.I am pasting piece of my code
>  here.
>  <input type="button" class="button" value="Cancel" jwcid="@Submit"
>  action="listener:refreshClicked"  async="true"/>
>  public void refreshClicked(IRequestCycle cycle) {
>  try {
>                         Stack<Crumb> s = getVisitObject().getUrlStack();
>                         if(null != s) {
>                                 Crumb crumb = null;
>                                 if(s.size() > 1){
>                                         crumb = s.elementAt(s.size() - 1);
>                                 }
>                                 String previousPage = getPreviousPage();
>                                 if (crumb != null) {
>                                         redirectUrl = crumb.getUrl();
>                                 } else {
>                                         if (previousPage == null) {
>                                                 previousPage = "Home";
>                                         }
>                                         cycle.activate(previousPage);
>                                         return;
>                                 }
>                                 /*if (((previousPage == null) && (crumb != null)) ||
>  previousPage.equals(getPageName())) {
>                                                 previousPage = crumb.getPageId();
>                                         }*/
>                         }
>                         WebRequest request =
>  getPage().getRequestCycle().getInfrastructure().getRequest();
>                         List<Message> msgList =
>  (List<Message>)request.getAttribute(Constants.MESSAGE_LIST);
>                         if (msgList != null) {
>                                 getVisitObject().setMessageList(msgList);
>                         }
>                 } catch (Throwable t) {
>                         LOG.error("Error while saving changes", t);
>                         throw new PageRedirectException(PAGE_ERROR);
>                 }
>                 throw new RedirectException(redirectUrl);
>
>  }
>
>  when i click on button its not giving any exceptions but the browser is not
>  getting refreshed.
>  any ideas?
>  thanks in advance.
>
>  --
>  View this message in context: http://www.nabble.com/issues-with-redirectexception-in-tapestry4.1.5-tp16715950p16715950.html
>  Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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