RE: Understanding View configuration

"Schnitzer, Jeff" <[email protected]> Tue, 10 Feb 2004 20:09:58 -0800
Newsgroups gmane.comp.web.maverick.general
Message-ID <[email protected]>
> From: Aidan Mark Humphreys [mailto:[email protected]]
> 
> Another 2 simple questions (in case anyone feels like answering
> :).

No problem :-)

> This snippet is taken from the domify friend book example.
> 
> 	<views>
> 		<view id="loginRequired" path="loginRequired.jsp">
> 			<transform path="trimOutside.jsp"/>
> 		</view>
> 	</views>
> 
> 	<command name="changePassword">
> 			<controller class="...ChangePassword"/>
> 
> 			<view ref="loginRequired"/>
> 
> 			<view name="success">
> 				<transform path="changePassword.xsl"/>
> 				<transform path="inside.xsl"/>
> 			</view>
> 	</command>
> 
> How should  one interpret the nameless view reference in  the
> command changePassword? Does it act like a "default" tag in a
> switch statement - ie if the controller returns a value not
> assoicated with a view name (anything but "success" in this
> case), use the referenced view?


The "ref" is a special case.  See the documentation for the config
schema:

http://mav.sourceforge.net/maverick-manual.html#N105F4

If there is no name, it defaults to the value of ref.

If you only have a single view, you can leave off the name entirely and
that view will be rendered no matter what you return from the
controller.


> 2nd question - in this example ...
> 
> 		<command name="loginSubmit">
> 			<controller class="...LoginSubmit" />
> 
> 			<view name="success" type="redirect"/>
> 
> 			<view name="error" path="loginFailed.jsp">
> 				<transform path="trimOutside.jsp"/>
> 			</view>
> 		</command>
> 
> What is the target of the "success" redirect view? Redirect to
> where?

The redirect view can either look for a path in the static config
(missing in the above example) or it can take the destination from the
controller dynamically (through the model).  Take a look at the javadocs
for RedirectViewFactory:

http://mav.sourceforge.net/api/org/infohazard/maverick/view/RedirectView
Factory.html


Jeff


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
[INVALID FOOTER]