You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Fran Hesser <fh...@gmail.com> on 2009/12/09 14:34:15 UTC

Convention plug-in, tiles, and no @Result annotation

Is there a way to use the convention plugin, and not specify the
@Result annotation for the action classes with the result being tiles
or will it only find .jsps and Freemarker templates?
When I run this code I get the dreaded:
com.opensymphony.xwork2.config.ConfigurationException@1199919 ==> No
result defined for action com.action.vehicle.ServiceMaintenanceAction
and result success

Here’s what I have:
Struts.xml:
<package name="default" extends="tiles-default">
<!-- Default to tiles result type -->
<result-types>
<result-type name="tiles"class="org.apache.struts2.views.tiles.TilesResult"
default="true" />
</result-types>
</package>
<package name="service" extends="default"/>

Tiles-def.xml:
<definition name="service-maintenance-success" extends="service.base">
<put-attribute name="pageName"     value="Service Maintenance"/>
<put-attribute name="templateName" value="exampleTemplate.css"/>
<put-attribute name="body"
value="/WEB-INF/jsp/tiles/vehicle/serviceMaintenance.jsp"/>
</definition>

ServiceMaintenanceAction Class:
@Action(value="/vehicle/service-maintenance")
    public String execute() {
        return SUCCESS;
}

package-info.java:
@ParentPackage("vehicle")


Thanks,
Franklin

package name="service" extends="default"/>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Convention plug-in, tiles, and no @Result annotation

Posted by Konstantyn Harasevich <Ha...@yandex.ru>.
Hello

Problem with Tiles 2:

When try to deploy   application standart  wrapper exception 
Servlet.service()

Problem with tiles for configuring locale. Exception tell that no definition 
for locale in tiles with  null pointer exception .

How to resolve this?

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Convention plug-in, tiles, and no @Result annotation

Posted by Paweł Wielgus <po...@gmail.com>.
Hi Fran and Wes,
an alternative for what Wes has written is to use tiles inside jsp
files like this,
in my-action.jsp i have: [extra spaces added]

< % @page contentType="text/html;charset=utf-8" language="java" % >
< % @ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" % >
< % @ taglib prefix="s" uri="/WEB-INF/struts2conf/struts-tags.tld" % >

< tiles:insertDefinition name="isiak.main" >
	< tiles:putAttribute name="body" >

...and your body html/jsp goes here....

	< / tiles:putAttribute >
< / tiles:insertDefinition >

also isiak.main is defined in tiles.xml as:
< definition name="isiak.main"
    template="/WEB-INF/pages/layout/main.jsp">
< / definition >

and definition of tiles listener in web.xml:
< listener >
    < listener-class >
        org.apache.struts2.tiles.StrutsTilesListener
    < / listener-class >
< / listener >


It works well for me.

Best greetings,
Paweł Wielgus.


2009/12/9 Wes Wannemacher <we...@wantii.com>:
> I haven't tried it, but from the docs it looks like you can set the
> 'struts.convention.relative.result.types' variable. It defaults to
> 'dispatcher,velocity,freemarker' so add 'tiles' to it and see if that
> works.
>
> -Wes
>
> On Wed, Dec 9, 2009 at 8:34 AM, Fran Hesser <fh...@gmail.com> wrote:
>> Is there a way to use the convention plugin, and not specify the
>> @Result annotation for the action classes with the result being tiles
>> or will it only find .jsps and Freemarker templates?
>> When I run this code I get the dreaded:
>> com.opensymphony.xwork2.config.ConfigurationException@1199919 ==> No
>> result defined for action com.action.vehicle.ServiceMaintenanceAction
>> and result success
>>
>> Here’s what I have:
>> Struts.xml:
>> <package name="default" extends="tiles-default">
>> <!-- Default to tiles result type -->
>> <result-types>
>> <result-type name="tiles"class="org.apache.struts2.views.tiles.TilesResult"
>> default="true" />
>> </result-types>
>> </package>
>> <package name="service" extends="default"/>
>>
>> Tiles-def.xml:
>> <definition name="service-maintenance-success" extends="service.base">
>> <put-attribute name="pageName"     value="Service Maintenance"/>
>> <put-attribute name="templateName" value="exampleTemplate.css"/>
>> <put-attribute name="body"
>> value="/WEB-INF/jsp/tiles/vehicle/serviceMaintenance.jsp"/>
>> </definition>
>>
>> ServiceMaintenanceAction Class:
>> @Action(value="/vehicle/service-maintenance")
>>     public String execute() {
>>         return SUCCESS;
>> }
>>
>> package-info.java:
>> @ParentPackage("vehicle")
>>
>>
>> Thanks,
>> Franklin
>>
>> package name="service" extends="default"/>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Convention plug-in, tiles, and no @Result annotation

Posted by Wes Wannemacher <we...@wantii.com>.
I haven't tried it, but from the docs it looks like you can set the
'struts.convention.relative.result.types' variable. It defaults to
'dispatcher,velocity,freemarker' so add 'tiles' to it and see if that
works.

-Wes

On Wed, Dec 9, 2009 at 8:34 AM, Fran Hesser <fh...@gmail.com> wrote:
> Is there a way to use the convention plugin, and not specify the
> @Result annotation for the action classes with the result being tiles
> or will it only find .jsps and Freemarker templates?
> When I run this code I get the dreaded:
> com.opensymphony.xwork2.config.ConfigurationException@1199919 ==> No
> result defined for action com.action.vehicle.ServiceMaintenanceAction
> and result success
>
> Here’s what I have:
> Struts.xml:
> <package name="default" extends="tiles-default">
> <!-- Default to tiles result type -->
> <result-types>
> <result-type name="tiles"class="org.apache.struts2.views.tiles.TilesResult"
> default="true" />
> </result-types>
> </package>
> <package name="service" extends="default"/>
>
> Tiles-def.xml:
> <definition name="service-maintenance-success" extends="service.base">
> <put-attribute name="pageName"     value="Service Maintenance"/>
> <put-attribute name="templateName" value="exampleTemplate.css"/>
> <put-attribute name="body"
> value="/WEB-INF/jsp/tiles/vehicle/serviceMaintenance.jsp"/>
> </definition>
>
> ServiceMaintenanceAction Class:
> @Action(value="/vehicle/service-maintenance")
>     public String execute() {
>         return SUCCESS;
> }
>
> package-info.java:
> @ParentPackage("vehicle")
>
>
> Thanks,
> Franklin
>
> package name="service" extends="default"/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org