tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jack Ramzi <jackra...@yahoo.com>
Subject OGNL does not open the requested file
Date Mon, 13 May 2013 06:24:37 GMT
Hi, 

I am trying to use OGNL in my tile but it considers the expression as a string ( whatever
I use it counts as a string).

How should I change it in a way to count the expression as name of a page not string.

I am using the following code to embed the jsp file name, when admin user is logged in it
replace ROLE_ADMIN with the @com.... expression but does not load menuRole_Admin.jsp page.
It just shows menuRole_Admin.jsp as a string on browser.

  

     <put-attribute name="menu" expression="OGNL: 'menu' + 
                              @com.myproject.controller.Default@getRole()
+ '.jsp'"/> 

**tile.xml**

     <tiles-definitions>
             ....
            <definition name="register1" extends="baseLayout">
              <put-attribute name="menu" expression="OGNL: 'menu' + 
                          @com.myproject.controller.Default@getRole()
+ '.jsp'"/> 
                <put-attribute name="body" value="/body.jsp"/>
            </definition>
            ......

**pom.xml**


    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
      instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-
        4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
           ..........
        <dependencies>
            <dependency>
                <groupId>org.apache.struts</groupId>
                <artifactId>struts2-core</artifactId>
                <version>2.3.8</version>
            </dependency>
             <dependency>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jsp-2.1-glassfish</artifactId>
                <version>9.1.02.B04.p0</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>org.glassfish.extras</groupId>
                <artifactId>glassfish-embedded-static-shell</artifactId>
                <version>3.1.1</version>
                <scope>system</scope>
                <systemPath>${glassfish.embedded-static-shell.jar}</systemPath>
            </dependency>
            <dependency>
                <groupId>com.kenai.nbpwr</groupId>
                <artifactId>org-apache-commons-dbcp</artifactId>
                <version>1.2.2-201002241055</version>
                <type>nbm</type>
            </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>commons-dbutils</groupId>
                <artifactId>commons-dbutils</artifactId>
                <version>1.5</version>
                <type>jar</type>
            </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.apache.taglibs</groupId>
                <artifactId>taglibs-parent</artifactId>
                <version>3</version>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>javax.xml</groupId>
                <artifactId>jaxrpc</artifactId>
                <version>1.1</version>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>taglibs</groupId>
                <artifactId>fmt</artifactId>
                <version>1.1.2</version>
                <type>tld</type>
            </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>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>1.3.2</version>
            </dependency>
            <dependency>
                <groupId>net.sf.opencsv</groupId>
                <artifactId>opencsv</artifactId>
                <version>2.3</version>
                <type>jar</type>
            </dependency>
            <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>
            <dependency>
                <groupId>org.apache.tiles</groupId>
                <artifactId>tiles-api</artifactId>
                <version>3.0.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.tiles</groupId>
                <artifactId>tiles-core</artifactId>
                <version>3.0.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.tiles</groupId>
                <artifactId>tiles-extras</artifactId>
                <version>3.0.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.tiles</groupId>
                <artifactId>tiles-jsp</artifactId>
                <version>3.0.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.tiles</groupId>
                <artifactId>tiles-servlet</artifactId>
                <version>3.0.1</version>
            </dependency>
            <dependency>
                <groupId>jdom</groupId>
                <artifactId>jdom</artifactId>
                <version>b10</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>1.6.4</version>
            </dependency>
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-web-api</artifactId>
                <version>6.0</version>
                <type>jar</type>
            </dependency>
            <dependency>
                <groupId>axis</groupId>
                <artifactId>axis</artifactId>
                <version>1.4</version>
            </dependency>
            <dependency>
                <groupId>commons-discovery</groupId>
                <artifactId>commons-discovery</artifactId>
                <version>0.2</version>
            </dependency>
            <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>1.1.1</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>
                
        </dependencies>
    
        <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>
    
    </project>

**web.xml**






    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-
         app_3_0.xsd">
        <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.tiles.extras.complete.CompleteAutoloadTilesListener</listener-
           class>
        </listener>
           <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 

        </listener>
         <context-param> 
            <param-name>contextConfigLocation</param-name> 
            <param-value>
                /WEB-INF/applicationContext.xml
                /WEB-INF/myProject-security.xml 
                /WEB-INF/login-service.xml
            </param-value> 
        </context-param> 
        <filter> 
            <filter-name>springSecurityFilterChain</filter-name> 
            <filter-class> 
                org.springframework.web.filter.DelegatingFilterProxy 
            </filter-class> 
        </filter> 
    
        <filter-mapping> 
            <filter-name>springSecurityFilterChain</filter-name> 
            <url-pattern>/*</url-pattern> 
        </filter-mapping>
        <filter>
            <filter-name>struts2</filter-name>
            <filter-
          class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    </web-app>

**myproject-security.xml**



    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns='http://www.springframework.org/schema/security' 
            xmlns:beans='http://www.springframework.org/schema/beans' 
                xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
                xsi:schemaLocation='http://www.springframework.org/schema/beans

        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/security
        http://www.springframework.org/schema/security/spring-security-3.0.xsd'>
    <beans:import resource='login-service.xml'/> 
    <http auto-config="true" access-denied-page="/notFound.jsp" use-expressions="true">
        <intercept-url pattern="/search/view*" access="hasRole('ROLE_ADMIN')" />

        <form-login login-page="/index" 
                    authentication-failure-url="/index?error=1"
                    default-target-url="/default"/> 
        <remember-me/>
         <logout logout-success-url="/index.jsp"/>
    </http> 
    <authentication-manager> 
              ...........
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message