Rectangle 27 0

As far as I'm aware current struts2 major release ships with tiles 2.0.6. Wildcard support has been added since tiles 2.1 so I'm afraid you can not use wildcards with current version of plugin. If you want to setup the tiles 2.1+ with struts2 anyway you have to tweak the plugin yourself or wait for the next release. You also might wanna consider using a preparer in case you want to set some dynamic values to you definition. Hope this helps. you can check this issue for tiles plugin which is unresolved yet.

Are you aware, has anyone integrated the newer version of tiles2 with Struts in some project, somewhere?

@bozo According to the link I gave you above it's planned for integration, but don't know when it's gonna be released.

I'm pretty sure I have such a project... So I think there is one somewhere. I'm not trying to be cryptic, I asked a very similar question and someone sent me their project I just found it difficult to decipher at the time and this question prompted me to look for it. It must be at home...

Here is a working example in Netbeans.

tiles2 - Struts2 with Tiles 2.1 or 2.2 - Stack Overflow

struts2 tiles2
Rectangle 27 0

This solution does not use tiles expressions but will work if you need to display localized text in JSP when key is passed through tiles definitions.

In your JSP then use Struts2 <s:set> tag to set title from tiles definition to local variable and then use it in <s:text> tag.

Yes, this does work for messages from the tiles definition to a struts2 tag. I still have not been able to resolve how to get messages from struts2 to the tiles definition.

the goal is to keep all messages in one place.

What do you mean? All messages is in the properties files. And that is just a key. What you want to do with text from properties files in tiles definition?

Let's make sure we're on the same page. What do you get as the final value for <s:text name="%{#title}"/>?

struts - struts2 MessageResources in tiles - Stack Overflow

struts2 struts tiles tiles2 apache-tiles
Rectangle 27 0

type="tiles"
type="TilesResult.class"
location="tiles-definition-name"
location="/jsp/userLogin.jsp"

Have following in your web.xml:

<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>

Have following in your struts.xml (If you are using annotations alone and no struts.xml, then you have to create a minimal one for this because there's no annotation available to define a custom result type)

<struts>
<constant name="struts.convention.default.parent.package" value="codeoftheday.blogspot.com"/>
<package name="codeoftheday.blogspot.com" extends="struts-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types> 
</package>
</struts>

Basically I am using annotation with tiles and it's giving me another exception i have done that too SEVERE: Exception starting filter struts2 Unable to load configuration. - [unknown location]

struts2 - Tiles Integration with Struts 2 Annotation - Stack Overflow

struts2 annotations tiles tiles2
Rectangle 27 0

Preparer

You can use "expression" instead of "value" in the tiles.xml, take a look at symfony-world.blogspot.com/2013/02/

tiles2 - Struts2 tiles How to set attribute values in dynamically… - S...

struts2 tiles2 struts-config struts-html
Rectangle 27 0

I've used tiles, but have never tried to dynamically reload it.

Load the Tiles filter. It is useful if your definition files can be changed and you periodically need to reload them.

struts2 - Enable Tiles devMode like Struts' devMode to reload tiles.xm...

struts2 struts tiles tiles2
Rectangle 27 0

You could define the 4 headers as such

<definition name="Members" extends="baseLayout">
    <put-attribute name="headerA" value="/headerA.jsp"/>
    <put-attribute name="headerB" value="/headerB.jsp"/>
    <put-attribute name="headerC" value="/headerC.jsp"/>
    <put-attribute name="headerD" value="/headerD.jsp"/>
    <put-attribute name="body" value="/gbody.jsp"/>
</definition>

and then in the base layout have some code that says

<c:if test="${memberA}">
    <tiles:insert attribute="headerA"/>
</c:if>
etc...

java - How to have a flexible website using tile? - Stack Overflow

java struts2 tiles tiles2 apache-tiles
Rectangle 27 0

I could solve the problem by changing my pom.xml to the following

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>6.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-core</artifactId>
            <version>1.3.10</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-tiles-plugin</artifactId>
            <version>2.3.12</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-convention-plugin</artifactId>
            <version>2.3.14</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-dojo-plugin</artifactId>
            <version>2.3.14</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-taglib</artifactId>
            <version>1.3.10</version>
        </dependency>
        <dependency>
            <groupId>jdbc</groupId>
            <artifactId>jdbc-stdext</artifactId>
            <version>2.0</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>javax.sql</groupId>
            <artifactId>jdbc-stdext</artifactId>
            <version>2.0</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.glassfish.extras</groupId>
            <artifactId>glassfish-embedded-static-shell</artifactId>
            <version>3.1.1</version>
        </dependency>
        <dependency>
            <groupId>com.kenai.nbpwr</groupId>
            <artifactId>org-apache-commons-dbcp</artifactId>
            <version>1.2.2-201002241055</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.24</version>
        </dependency>
        <dependency>
            <groupId>commons-dbutils</groupId>
            <artifactId>commons-dbutils</artifactId>
            <version>1.5</version>
        </dependency>
        <dependency>
            <groupId>struts</groupId>
            <artifactId>struts</artifactId>
            <version>1.2.9</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-core</artifactId>
            <version>2.2.2</version>
        </dependency>
        <dependency>
    <groupId>org.apache.tiles</groupId>
    <artifactId>tiles-jsp</artifactId>
    <version>2.2.2</version>
</dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.5.6</version>
        </dependency>
     <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
    <exclusion>
        <groupId>com.sun.jmx</groupId>
        <artifactId>jmxri</artifactId>
    </exclusion>
    <exclusion>
        <groupId>com.sun.jdmk</groupId>
        <artifactId>jmxtools</artifactId>
    </exclusion>
    <exclusion>
            <groupId>javax.jms</groupId>
            <artifactId>jms</artifactId>
    </exclusion>
</exclusions>
</dependency>
            <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.5.6</version>
</dependency>
<dependency>
    <groupId>org.apache.tiles</groupId>
    <artifactId>tiles-template</artifactId>
    <version>2.2.2</version>
</dependency>



        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-servlet</artifactId>
            <version>2.2.2</version>
        </dependency>
        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jsp-2.1-glassfish</artifactId>
            <version>9.1.02.B04.p0</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.2.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-api</artifactId>
            <version>2.2.2</version>
        </dependency>
        <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.8.0</version>
        </dependency>
        <dependency>
    <groupId>commons-digester</groupId>
    <artifactId>commons-digester</artifactId>
    <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>6.0</version>
        </dependency>
    </dependencies>
</project>

spring - Combination of Tile2 + Spring3 + Struts2 - Stack Overflow

spring struts2 spring-security tiles tiles2
Rectangle 27 0

Using a wildcard is not required, but is convenient when the app uses Single (or Multiple) Action, Multiple Methods to handle tightly-coupled functionality.

Particularly for small apps, and demos, it's a way to minimize XML configuration.

These days it might be more typical to remove most of the XML configuration and configure actions/methods individually using annotations.

I cannot duplicate the issue. Taking a minimal S2 app with a single line in menu.jsp and header.jsp and a stripped-down baseLayout.jsp results in the following:

I had to step off from this project for a little while. Not sure what exactly was wrong but I started from scratch again - struts.xml and tiles.xml look the same but it kinda works now. It does display the "DispSchedule.jsp" and the contents inside it, but displays it below the main window. Not inside the "body" because the content doesn't fit there. Is there a way to make the "body" segment such that a scroll bar is added when the content doesn't fit?

tiles2 - Struts2 Tiles plugin with multiple action classes - Stack Ove...

struts2 tiles2 struts2-tiles-plugin
Rectangle 27 0

Add / to the begining of your address and remove all the dependencies which include tile in their names except the followings.

<put-attribute name="menu" expression="OGNL: '/menu' + 
                         @com.myproject.controller.Default@getRole() + '.jsp'"/>
<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-tiles3-plugin</artifactId>
    <version>2.3.14</version>
</dependency>
<dependency>
    <groupId>org.apache.tiles</groupId>
    <artifactId>tiles-el</artifactId>
    <version>3.0.1</version>
</dependency>
<dependency>
    <groupId>org.apache.tiles</groupId>
    <artifactId>tiles-ognl</artifactId>
    <version>3.0.1</version>
</dependency>

struts2 - Tile does not work properly with OGNL expressions - Stack Ov...

struts2 spring-security tiles tiles2
Rectangle 27 0

Here is another working configuration that uses Listener instead of Filter. (since Tiles 2.1.2)

<context-param>
  <param-name>org.apache.tiles.definition.dao.LocaleUrlDefinitionDAO.CHECK_REFRESH</param-name>
  <param-value>true</param-value>
</context-param>
<listener>
  <listener-class>org.apache.tiles.web.startup.TilesListener</listener-class>
</listener>

struts2 - Enable Tiles devMode like Struts' devMode to reload tiles.xm...

struts2 struts tiles tiles2
Rectangle 27 0

Update: there is now Tiles 2.2.2 (GA) available and Struts 2.2.3. And it seems the latest Struts ships with tiles libs 2.0.6. Has anyone managed to integrate these latest versions of Struts2 and Tiles2? I am not interested in Sitemesh since this is a big existing tiles based project.

I was able :), I use the last Tiles libs and Struts 2.2.3 in my web applications

Have you changed the existing struts2-tiles plugin to do it? What's the cookbook here? :)

tiles2 - Struts2 with Tiles 2.1 or 2.2 - Stack Overflow

struts2 tiles2