Hi Brock
      I m getting action name from where exception is raised ,but the method
name from where the exception is raised is not coming.Can you please tell me
how to find the method name.
My Exception class is as follows:
public class StripesExceptionHandler1   implements ExceptionHandler
{

        private static net.sourceforge.stripes.util.Log LOG =
Log.getInstance(StripesExceptionHandler1.class);
        
        public void init(Configuration configuration) throws Exception {
                // TODO Auto-generated method stub
                
        }
        
        public void handle(Throwable throwable, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
                
                  ForwardResolution next = new
ForwardResolution("/examples/quickstart/Error.action");
                  StripesRequestWrapper wrapper=new 
StripesRequestWrapper(request)
                {
                @Override
                protected void constructMultipartWrapper(HttpServletRequest
request) throws StripesServletException {
                  Locale locale =
StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
                  setLocale(locale);
                }
                };
                  next.addParameter("realSource", makeSourceParameter(wrapper));
                  next.execute(wrapper,response);
                }

                private String makeSourceParameter(HttpServletRequest request) {
        
                  UrlBuilder ub = new UrlBuilder(request.getRequestURI(), 
false);
                  ub.addParameters(request.getParameterMap());
                  try {
                    return URLEncoder.encode(ub.toString(), "utf-8");
                  } catch (UnsupportedEncodingException e) {
                    LOG.error("Failed to encode url [" + ub.toString() + "]", 
e);
                  }
                  return null;
                }


    

}


SivaKumarl wrote:
> 
> Hi Brock
>   Thank for your reply,i tried but exception is coming (i m using
> stripes-1.4.3)
> Excepiton is:
> java.lang.IllegalStateException: A request made it through to some part of
> Stripes without being wrapped in a StripesRequestWrapper. The
> StripesFilter is responsible for wrapping the request, so it is likely
> that either the StripesFilter is not deployed, or that it's mappings do
> not include the DispatcherServlet _and_ *.jsp. Stripes does not requiire
> that the Stripes wrapper is the only request wrapper, or the outermost;
> only that is is present.
> 
> net.sourceforge.stripes.controller.StripesRequestWrapper.findStripesWrapper(StripesRequestWrapper.java:71)
> 
> net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.validateRequiredFields(DefaultActionBeanPropertyBinder.java:589)
> 
> net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.bind(DefaultActionBeanPropertyBinder.java:241)
> 
> net.sourceforge.stripes.controller.DispatcherHelper$3.intercept(DispatcherHelper.java:185)
> 
> net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:157)
> 
> net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:107)
> 
> net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:154)
> 
> net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:73)
> 
> net.sourceforge.stripes.controller.DispatcherHelper.doBindingAndValidation(DispatcherHelper.java:182)
> 
> net.sourceforge.stripes.controller.DispatcherServlet.doBindingAndValidation(DispatcherServlet.java:217)
> 
> net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:142)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> 
> net.sourceforge.stripes.action.ForwardResolution.execute(ForwardResolution.java:104)
> 
> net.sourceforge.stripes.examples.quickstart.StripesExceptionHandler1.handle(StripesExceptionHandler1.java:48)
> 
> net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:183)
> 
> My Exception class is:
> public class StripesExceptionHandler1   implements ExceptionHandler
> {
> 
>       private static net.sourceforge.stripes.util.Log LOG =
> Log.getInstance(StripesExceptionHandler1.class);
>       
>       public void init(Configuration configuration) throws Exception {
>               // TODO Auto-generated method stub
>               
>       }
>       
>       public void handle(Throwable throwable, HttpServletRequest request,
> HttpServletResponse response) throws ServletException, IOException {
>               
>                 ForwardResolution next = new
> ForwardResolution("/examples/quickstart/Error.action");
>                 next.addParameter("realSource", makeSourceParameter(request));
>                 next.execute(request,response);
>                
> //request.getRequestDispatcher("/technical_error.jsp").forward(request,
> response);
>               }
> 
>               private String makeSourceParameter(HttpServletRequest request) {
>                 UrlBuilder ub = new UrlBuilder(request.getRequestURI(), 
> false);
>                 ub.addParameters(request.getParameterMap());
>                 try {
>                   return URLEncoder.encode(ub.toString(), "utf-8");
>                 } catch (UnsupportedEncodingException e) {
>                   LOG.error("Failed to encode url [" + ub.toString() + "]", 
> e);
>                 }
>                 return null;
>               }
> 
> 
>     
> 
> }
> 
> 
> My ActionBeanclass is:
> public class ErrorActionBean implements ActionBean{
>       ActionBeanContext context;
>        private String realSource;
>        
>       public String getRealSource() {
>               return realSource;
>       }
> 
>       public void setRealSource(String realSource) {
>               this.realSource = realSource;
>       }
> 
>       public ActionBeanContext getContext() {
>               return context;
>       }
> 
>       public void setContext(ActionBeanContext context) {
>               this.context = context;
>       }
>       @DefaultHandler
>       public Resolution showErrorPage() {
>               System.out.println("Forwarding to ErrorPage");
>               return new ForwardResolution("/technical_error.jsp");
>               
>       }
> }
> 
> Matt Brock wrote:
>> 
>> 
>> SivaKumarl wrote:
>>> 
>>> When a exception is arising i m forwarding to Jsp page(techinical
>>> error.jsp) using StripesExceptionHandler
>>>  This page contains
>>>     SOME TEXT LIKE "internal problem occured";
>>>   and one "Back button";
>>> 
>>> when clicking on back button i want to go jsp page where the exception
>>> is raised.
>>> 
>> <p>
>> I don't think I quite understand--you want the back button to take you
>> back to a page that is generating an exception?  Won't it just forward
>> you to the exception page again?  Well, if you want the Error page to
>> have a variable that you can use to send you back to the calling page,
>> just pass it as a parameter.  For example:</p><pre>
>> public void handle(Throwable throwable, HttpServletRequest request,
>> HttpServletResponse response) throws ServletException, IOException {
>> [...]
>>   ForwardResolution next = new ForwardResolution("/Error.action");
>>   next.addParameter("realSource", makeSourceParameter(request));
>> [...]
>>   next.execute(...)
>> }
>> 
>> private String makeSourceParameter(HttpServletRequest request) {
>>   UrlBuilder ub = new UrlBuilder(request.getRequestURI(), false);
>>   ub.addParameters(request.getParameterMap());
>>   try {
>>     return URLEncoder.encode(ub.toString(), "utf-8");
>>   } catch (UnsupportedEncodingException e) {
>>     log.error("Failed to encode url [" + ub.toString() + "]", e);
>>   }
>>   return null;
>> }</pre><p>Then later on in your Error.jsp/action, put a parameter called
>> "realSource" that gets bound when the action is executed:</p><pre>public
>> class ErrorAction implements ActionBean {
>>   private String realSource;
>>   public String getRealSource() [...]
>>   public void setRealSource(String realSource) [...]
>>   [...]
>> }</pre><p>Now your error page has a variable you can use wherever you
>> like that contains the address of the source of the exception.</p>
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-go-back-to-action-from-ExceptionHandling-page-tp16269575p16321430.html
Sent from the stripes-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to