Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EB2EE115FE for ; Fri, 11 Apr 2014 11:15:23 +0000 (UTC) Received: (qmail 50799 invoked by uid 500); 11 Apr 2014 11:15:22 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 50771 invoked by uid 500); 11 Apr 2014 11:15:19 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 50408 invoked by uid 99); 11 Apr 2014 11:15:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2014 11:15:16 +0000 Date: Fri, 11 Apr 2014 11:15:16 +0000 (UTC) From: "Lukasz Lenart (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (WW-3441) support list ui tag bind data by listValue beside by listKey MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-3441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13966399#comment-13966399 ] Lukasz Lenart commented on WW-3441: ----------------------------------- I don't think it's a right solution, right now you can override each template file from simple theme and as you uncommon way to present Enum I'd suggest to override those templates as well instead introducing such change into framework. > support list ui tag bind data by listValue beside by listKey > ------------------------------------------------------------ > > Key: WW-3441 > URL: https://issues.apache.org/jira/browse/WW-3441 > Project: Struts 2 > Issue Type: Improvement > Reporter: zhouyanming > Fix For: 2.5.x > > Attachments: patch.txt > > > list ui tag include select checkboxlist radio. > typically we use a enum values as list for those tag > {code:java} > package biz.model; > import com.opensymphony.xwork2.ActionContext; > import com.opensymphony.xwork2.util.LocalizedTextUtil; > public enum EmployeeType { > PACKER, DELIVERYMAN, WAREHOUSEMAN , SALESMAN, MANAGER, SERVANT; > public String getName() { > return name(); > } > public String getDisplayName() { > return LocalizedTextUtil.findText(getClass(), name(), ActionContext > .getContext().getLocale(), name(), null); > } > public static EmployeeType parse(String name) { > if (name != null) > for (EmployeeType en : values()) > if (name.equals(en.name()) || name.equals(en.getDisplayName())) > return en; > return null; > } > @Override //sometimes we need override toString() to display nicely > public String toString() { > return getDisplayName(); > } > } > {code} > {code:html} > <@s.select name="employee.type" list="@biz.model.EmployeeType@values()" listKey="name" listValue="displayName" headerKey="" headerValue=""/> > {code} > I override enum's toString use displayName replace name,so currently struts2 can't bind data as selected > solution: > tag.contains(parameters.nameValue, itemKey) --> tag.contains(parameters.nameValue, itemKey) || tag.contains(parameters.nameValue, itemValue) -- This message was sent by Atlassian JIRA (v6.2#6252)