Hello I disable el because '#' is used by the JSP EL under JSP 2.1 and I use this character in OGNL expressions. This information is from http://struts.apache.org/2.x/docs/ognl.html. OK, disable is wrong word, I should wrote that I set isELignored to true :-)
My first idea was that I can use: <s:property value="%{#request.getRemoteUser()}" /> or <s:property value="%{#request.isUserInRole('role_name')}" /> but this doesn't work. I tried too: <s:property value="[EMAIL PROTECTED]@getRequest().getRemoteUser()}" /> <s:property value="%{getRemoteUser()}" /> I don't have any errors, but result is null. I'm sure that remoteUser is set, because I have <%= request.getRemoteUser() %> in my jsp and I see good result ;-) For <s:property value="%{request.getRemoteUser()}" /> I have error: 12:25:23:085 WARN com.opensymphony.xwork2.util.OgnlValueStack [http-8080-Processor24]; Caught an exception while evaluating expression 'request.getRemoteUser()' against value stack java.lang.NullPointerException: target is null for method getRemoteUser Best regards Marcin Orlinski Laurie Harper wrote: > > OGNL in Struts provides access to these scopes via named attributes on > the stack (e.g. %{#session.attribute}). It seams quite reasonable to me > to want to limit pages to using a single expression language. I don't > know if this use case is viable, but it's reasonable to want it :-) > > To the OP: what did you try, and what happened? Post exactly what > configuration you set, what you tried in the JSP and what errors or > unexpected behaviours you saw as a result. > > L. > > Felipe Rodrigues wrote: >> Why did you disabled EL and how did you do that? >> You can use EL with OGNL. OGNL works only with things in its stack, and >> I'm >> not sure about how get things from outside its stack, e.g. Session, >> Request, >> Context or even Page. To get these values, the best way is use EL. >> I can't see any reason to don't use EL. >> >> Regards, >> >> Felipe >> >> >> Marcin Orlinski wrote: >>> Hello >>> >>> I have problem only in JSP. I have disabled EL and I tried use OGNL. Can >>> you give me example how to get this information ? >>> >>> Best regards. >>> Marcin OrliĆski >>> >>> >>> Felipe Rodrigues wrote: >>>> Well, >>>> >>>> If you're in a JSP, you can get it direct from the request, even using >>>> EL >>>> or using expressions. >>>> If you're in a action you may want take a look at the documentation. >>>> Specific in the part of FAQ -> How To. >>>> You'll find that you can get the request object by implementing the >>>> interface ServletRequestAware or using the code >>>> ActionContext.getContext().getRequest(). >>>> >>>> Using the interface is a better approach. Make your choice. :-) >>>> >>>> Regards, >>>> >>>> Felipe >>>> >>> >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/-s2--use-remoteUser-with-struts-tags-tf3656482.html#a10283544 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]