Hi Tapestry Users,

Short version: Can a component use @InjectPage to redirect in case there is a problem during the render phase?

Unabridged version:

I have a my business layers running EJB.
Layout of project is like jumpstart for EJB stuff.  Works great.

EJB can't find any values in the database - cool. EJB Exception.


My Layout component pseudo code looks like this:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd";
      xmlns:p="tapestry:parameter"
      lang="en">
  <head>.....</head>
  <body>

  <div t:type="Header" />

  <div t:type="Slider" />

  <div t:type="CallToAction" />

  <div t:type="Footer" />

  </body>
</html>



If I have no Slider info in the database, and the exception is down below (in EJB land), I'd like Slider to throw an exception. And redirect to a CreateSliderSection page or some other "hey you don't have enough of a configuration for me to present" page.

My Slider component looks like this:

/**
 *
 * @author mylo
 */
public class Slider {

    @Inject
    private SliderSectionService sliderService;

    @Property
    private SliderSection slider;

    @InjectPage
    private CreateSliderSection createSliderSection;

    void setupRender() throws SystemException {
        slider = sliderService.getById(new Long(1));
    }

    Object onException(Throwable cause) {
        return createSliderSection ;
    }
}

Neither the SystemException (which extends RuntimeException as per Jumpstart) nor onException seem to be doing anything in this component.


Can a component use @InjectPage to redirect in case there is a problem during the render phase?

Cheers
Chris @author mylo!

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

Reply via email to