|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Struts 2 annotations and Tiles 2Can I use the Struts 2 annotation - style of specifying action results
to set a tile name as the target for a Struts action? Here's my action: @Result(name = "success", value="startApplication") public class ApplicationStartAction { private String pageTitle; private String companyName; public String execute() throws Exception { pageTitle = "Start Job Application"; companyName = "Men's Wearhouse"; return "success"; } ...getters and setters here.. } Here's my tiles.xml file: <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN" "http://tiles.apache.org/dtds/tiles-config_2_0.dtd"> <tiles-definitions> <definition name="baseLayout" template="/layouts/base.jsp"> <put-attribute name="head" value="/tiles/head.jsp"/> <put-attribute name="body" value="/tiles/body.jsp"/> </definition> <definition name="startApplication" extends="baseLayout"> </definition> </tiles-definitions> When I attempt to execute the ApplicationStartAction, I get the error: The requested resource (/ApplicantTracking/startApplication) is not available. which I assume to mean that the action result mapping to the tile definition is not working. Thanks, Wes |
|
|
RE: Struts 2 annotations and Tiles 2I believe that I have verified that you cannot successfully specify a
Tiles definition as a Struts action result if you are using annotations. It appears to work, however, if you use the XML configuration. Wes -----Original Message----- From: Gamble, Wesley (WG10) [mailto:WG10@...] Sent: Monday, May 19, 2008 5:37 PM To: users@... Subject: Struts 2 annotations and Tiles 2 Can I use the Struts 2 annotation - style of specifying action results to set a tile name as the target for a Struts action? Here's my action: @Result(name = "success", value="startApplication") public class ApplicationStartAction { private String pageTitle; private String companyName; public String execute() throws Exception { pageTitle = "Start Job Application"; companyName = "Men's Wearhouse"; return "success"; } ...getters and setters here.. } Here's my tiles.xml file: <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN" "http://tiles.apache.org/dtds/tiles-config_2_0.dtd"> <tiles-definitions> <definition name="baseLayout" template="/layouts/base.jsp"> <put-attribute name="head" value="/tiles/head.jsp"/> <put-attribute name="body" value="/tiles/body.jsp"/> </definition> <definition name="startApplication" extends="baseLayout"> </definition> </tiles-definitions> When I attempt to execute the ApplicationStartAction, I get the error: The requested resource (/ApplicantTracking/startApplication) is not available. which I assume to mean that the action result mapping to the tile definition is not working. Thanks, Wes |
|
|
Re: Struts 2 annotations and Tiles 22008/5/20 Gamble, Wesley (WG10) <WG10@...>:
> Can I use the Struts 2 annotation - style of specifying action results > to set a tile name as the target for a Struts action? You may want to ask the Struts Users mailing list: http://struts.apache.org/mail.html Antonio |
|
|
RE: Struts 2 annotations and Tiles 2Answer:
You have to specify the result type as part of the result annotation, like so: @Results({ @Result(name = "success", value="startApplication", type=TilesResult.class), @Result(name="error", value="/error.jsp", type=TilesResult.class) }) ...class definition... Wes -----Original Message----- From: Gamble, Wesley (WG10) [mailto:WG10@...] Sent: Monday, May 19, 2008 5:37 PM To: users@... Subject: Struts 2 annotations and Tiles 2 Can I use the Struts 2 annotation - style of specifying action results to set a tile name as the target for a Struts action? Here's my action: @Result(name = "success", value="startApplication") public class ApplicationStartAction { private String pageTitle; private String companyName; public String execute() throws Exception { pageTitle = "Start Job Application"; companyName = "Men's Wearhouse"; return "success"; } ...getters and setters here.. } Here's my tiles.xml file: <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN" "http://tiles.apache.org/dtds/tiles-config_2_0.dtd"> <tiles-definitions> <definition name="baseLayout" template="/layouts/base.jsp"> <put-attribute name="head" value="/tiles/head.jsp"/> <put-attribute name="body" value="/tiles/body.jsp"/> </definition> <definition name="startApplication" extends="baseLayout"> </definition> </tiles-definitions> When I attempt to execute the ApplicationStartAction, I get the error: The requested resource (/ApplicantTracking/startApplication) is not available. which I assume to mean that the action result mapping to the tile definition is not working. Thanks, Wes |
|
|
Re: Struts 2 annotations and Tiles 22008/5/20 Gamble, Wesley (WG10) <WG10@...>:
> Answer: > > You have to specify the result type as part of the result annotation, > like so: > > @Results({ > @Result(name = "success", value="startApplication", > type=TilesResult.class), > @Result(name="error", value="/error.jsp", type=TilesResult.class) > }) > > ...class definition... Good to know, thanks :-) Antonio |
| Free Forum Powered by Nabble | Forum Help |