struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fusillator <fusilla...@gmail.com>
Subject Re: usage of ${...}
Date Tue, 15 Jan 2013 17:40:39 GMT
Il 15/01/2013 17:17, Taner Diler ha scritto:
> Hi,
>
> I'm beginner on struts 2. I want to display object properties by using
> ${...} in s:iterator tag. But It's not being rendered and ${name}
> displaying. Is there any configuration that I missed?
>
> *list.jsp*
>
> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
> <%@ taglib prefix="s" uri="/struts-tags" %>
> <html>
> <head></head>
> <body>
> <h1>User List</h1>
>
> <ul class="nav nav-list todo-list">
>      <s:iterator value="#request.users" var="user">
>          <li id="user-<s:property value="#user.id"/>-${id}">
>              <span id="user-<s:property value="#user.id"/>-fullname"><s:property
> value="fullname"/>**</span>
>              <span id="user-<s:property value="#user.id"/>-email"><s:property
> value="email"/></span>
>              <s:if test="roles.length != 0">
>                  <s:iterator value="roles" var="role">
>                  <span id="user-<s:property value="#user.id"/>-role-<s:property
> value="#role.id"/>" class="todo-category badge badge-info">
>                      <s:property value="name"/>
>                  </span>
>                  </s:iterator>
>              </s:if>
>          </li>
>      </s:iterator>
> </ul>
>
> </body>
> </html>
>
>
> struts.xml
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE struts PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd">
>
> <struts>
>       <constant name="struts.devMode" value="true" />
>
>      <constant name="struts.i18n.reload" value="true"/>
>
>      <package name="default" namespace="/" extends="struts-default">
>
>          <interceptors>
>
>              <interceptor name="login"
>                  class="ui.user.actions.LoginInterceptor"></interceptor>
>
>              <interceptor name="auth"
>
> class="ui.user.actions.AuthorizationInterceptor"></interceptor>
>
>              <interceptor-stack name="securestack">
>                     <interceptor-ref name="login"/>
>                     <interceptor-ref name="auth"/>
>                  <interceptor-ref name="defaultStack" />
>              </interceptor-stack>
>              <interceptor-stack name="unsecurestack">
>                  <interceptor-ref name="defaultStack" />
>              </interceptor-stack>
>          </interceptors>
>      </package>
> </struts>
>
>
> *maven dependencies *
>
>      <dependencies>
>          <dependency>
>              <groupId>com.google.collections</groupId>
>              <artifactId>google-collections</artifactId>
>              <version>1.0</version>
>          </dependency>
>          <dependency>
>              <groupId>junit</groupId>
>              <artifactId>junit</artifactId>
>              <version>3.8.1</version>
>              <scope>test</scope>
>          </dependency>
>
>          <dependency>
>              <groupId>javax.servlet</groupId>
>              <artifactId>javax.servlet-api</artifactId>
>              <version>3.0.1</version>
>              <scope>provided</scope>
>          </dependency>
>
>          <dependency>
>              <groupId>javax.servlet.jsp</groupId>
>              <artifactId>javax.servlet.jsp-api</artifactId>
>              <version>2.2.1</version>
>              <scope>provided</scope>
>          </dependency>
>
>          <dependency>
>              <groupId>javax.el</groupId>
>              <artifactId>javax.el-api</artifactId>
>              <version>2.2.2</version>
>              <scope>provided</scope>
>          </dependency>
>
>          <dependency>
>              <groupId>javax.servlet</groupId>
>              <artifactId>servlet-api</artifactId>
>              <version>2.5</version>
>              <scope>provided</scope>
>          </dependency>
>
>          <dependency>
>              <groupId>org.apache.struts</groupId>
>              <artifactId>struts2-core</artifactId>
>              <version>2.3.8</version>
>          </dependency>
>
>          <dependency>
>              <groupId>com.jgeppert.struts2.jquery</groupId>
>              <artifactId>struts2-jquery-plugin</artifactId>
>              <version>3.5.0</version>
>          </dependency>
>
>          <dependency>
>              <groupId>org.apache.struts</groupId>
>              <artifactId>struts2-convention-plugin</artifactId>
>              <version>2.3.8</version>
>          </dependency>
>
>      </dependencies>
>
Hi Taner, I'm a beginner too. Isn't ${} evaluated as an expression 
language expression? If so, the servlet engine should search an 
attribute named id in the four scope (page,request,application,session). 
To get a request parameter you might use the following el expression 
${request.id} being request an implicit object in the page scope.
A useful tips to view the variable accessible with # or %{} sign is 
inserting a tag <debug /> in the view page.
Waiting for an expert comment, anyway.

Best regards



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


Mime
View raw message