On Wednesday 25 February 2009 21:15:09 Gordian Yuan wrote: > Hi, Lukasz > > All I know is # request is a Map, it is only stored request of attributes, > it does not have getRemoteUser(). > > Now I have to use EL and ordinary html tags replace struts2 tags to solve > this problem. > > However, thank you for your reply ... >
If you have static methods turned on for OGNL, you might be able to use the following expression - @com.opensymphony.xwork2.actioncont...@getcontext().get(@org.apache.struts2.strutsstat...@http_request).getRemoteUser() It's ugly, but it should work. Another thing to try is to whip up a quick interceptor that pushes the String you want onto the value stack... Something like the following should work - ActionContext context = ActionContext.getContext(); context.getValueStack().set( "remoteUser", ((HttpServletRequest)(context.get(HTTP_REQUEST))).getRemoteUser()); Then, any action that is intercepted by this interceptor could have a tag - <s:property value="#remoteUser"/> Of course, EL is fine too... Struts doesn't expose many Servlet Spec objects as a design choice. There are obviously times when it's necessary. Given adequate time, you might be able to move away from the Serlvet Spec by incorporating something like Spring Security, etc. But, that may not be practical, so stick with EL if you want the quick solution, or write an interceptor if you want to make the solution more Struts-y, and if you have enough time and want to gain a whole heck of a lot of functionality, then try out Spring Security. -Wes -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org