the default mechanism for passing information back and forth is string for more complex datatypes you're going to have to build the interface yourself assuming this is the method protected boolean[] hasRoles(List roleIdentifiers, AuthorizationInfo info) The value of foo is : , when inside the bean tag

," >
Role identifiers
you will have to config the /META-INF/ki.tld hasRoles JSP Displays body content only if the current user has one of the specified roles from a comma-separated list of role names. name true true alternative to make own tag is to use an existing tag that will concatenate string values Martin ______________________________________________ Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Mon, 4 May 2009 11:00:36 -0700 > From: > To: > Subject: Using Expression Language (EL) To Access ActionSupport Class Properties > > > We are building a new web application that uses both JSecurity > (, now known as Ki) and > Struts 2 (version 2.1.6). > > In many of the JSPs for this application, we need to provide a dynamic > String value to the JSecurity tag library's hasAnyRoles tag. This tag's > format is: > > > ...content to include if current user has one of the roles specified in the > name attribute... > > > Of course instead of hard-coding the values for the name attribute we want > to have the the attribute's value rendered dynamically using Struts 2. > > First we tried using: > > > > But that did not work even though we have a public method named getRoles in > the action support class that renders this jsp page. > > So just for a test we tried using expression language (EL): > > > > And the above worked just fine. > > I didn't know you could access properties of the ActionSupport class using > Expression Language. > > I researched the ability to use Expression Language (EL) to access > properties of the ActionSupport class in the Struts 2 documentation at > and in this mailing list. I didn't find much about > the capability to use EL to access properties of the ActionSupport class. > The documentation clearly states NOT to use EL in attributes for Struts 2 > tags, but it's not clear on using EL to access ActionSupport class > properties outside of the Struts 2 tags. > > Since we are building a new web application that will be around for some > time and would like to be able to upgrade to future versions of Struts 2, > we'd like to know if the ability to access ActionSupport class properties > using EL is a built-in and a supported feature of Struts 2? > > > Below is some test code to detail how this works: > > ActionSupport class: > > import com.opensymphony.xwork2.ActionSupport; > > public class TestActionSupport extends ActionSupport { > > private static final long serialVersionUID = 1L; > > public String execute() throws Exception { > > return SUCCESS; > > } > > public String getRoles() { > > return "Staff,Admin"; > > } > > } > > JSP View rendered when above class returns SUCCESS: > > <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> > <%@ taglib prefix="s" uri="/struts-tags" %> > > > > > Test of Struts 2 and EL > > > > >

Test of Struts 2 and EL Results Page


Roles via expression language: ${roles}


Roles via Struts 2 property tag:

> > > > Does Struts 2 turn the ActionSupport class itself turned into a bean object > that is placed in request scope? Is that how the Expression Language > ${roles} is able to execute correctly? > > Thanks for any information provided that helps us understand the use of EL > to access the ActionSupport class properties. > > Bruce > > -- > View this message in context: > Sent from the Struts - User mailing list archive at > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > For additional commands, e-mail: > _________________________________________________________________ Hotmail® has a new way to see what's up with your friends.