How to get request locale in OGNL?
Hi, I want to know how to get request locale in OGNL? For now I use s:set var=locale value='#session.WW_TRANS_I18N_LOCALE?#session.WW_TRANS_I18N_LOCALE.toString():zh_CN'/ This must assume that the initial value is zh_CN. So I need to know how to get request locale in OGNL. Thx Gordian Yuan
Re: How to get request locale in OGNL?
Thank you for your rapid response I try to use #context.locale now. It's look fine.But I'm not sure When i write s:property value=#request.locale/ , output is zh_CN But i write s:property value=#request/ , output is {__sitemesh__filterapplied=true, __spring_security_filterSecurityInterceptor_filterApplied=true, __spring_security_session_fixation_filter_applied=true, __spring_security_session_integration_filter_applied=true, __cleanup_recursion_counter=1, struts.request_uri=/agencyx/signin.action, javax.servlet.forward.servlet_path=/signin.action, struts.view_uri=/jsp/signin.jsp, lazyLoadingFilter.FILTERED=true, struts.valuestack=com.opensymphony.xwork2.ognl.ognlvaluest...@443799, javax.servlet.forward.request_uri=/agencyx/signin.action, javax.servlet.forward.context_path=/agencyx} I can't find where is locale property ... Gordian Yuan On Thu, May 21, 2009 at 7:27 PM, stanl...@gmail.com wrote: invocation.getStack().findString(#attr.locale) On Thu, May 21, 2009 at 6:22 AM, Gordian Yuan gordiany...@gmail.com wrote: Hi, I want to know how to get request locale in OGNL? For now I use s:set var=locale value='#session.WW_TRANS_I18N_LOCALE?#session.WW_TRANS_I18N_LOCALE.toString():zh_CN'/ This must assume that the initial value is zh_CN. So I need to know how to get request locale in OGNL. Thx Gordian Yuan
Re: How to get request locale in OGNL?
typo..I try to use #request.locale now .. On Thu, May 21, 2009 at 7:51 PM, Gordian Yuan gordiany...@gmail.com wrote: Thank you for your rapid response I try to use #context.locale now. It's look fine.But I'm not sure When i write s:property value=#request.locale/ , output is zh_CN But i write s:property value=#request/ , output is {__sitemesh__filterapplied=true, __spring_security_filterSecurityInterceptor_filterApplied=true, __spring_security_session_fixation_filter_applied=true, __spring_security_session_integration_filter_applied=true, __cleanup_recursion_counter=1, struts.request_uri=/agencyx/signin.action, javax.servlet.forward.servlet_path=/signin.action, struts.view_uri=/jsp/signin.jsp, lazyLoadingFilter.FILTERED=true, struts.valuestack=com.opensymphony.xwork2.ognl.ognlvaluest...@443799, javax.servlet.forward.request_uri=/agencyx/signin.action, javax.servlet.forward.context_path=/agencyx} I can't find where is locale property ... Gordian Yuan On Thu, May 21, 2009 at 7:27 PM, stanl...@gmail.com wrote: invocation.getStack().findString(#attr.locale) On Thu, May 21, 2009 at 6:22 AM, Gordian Yuan gordiany...@gmail.com wrote: Hi, I want to know how to get request locale in OGNL? For now I use s:set var=locale value='#session.WW_TRANS_I18N_LOCALE?#session.WW_TRANS_I18N_LOCALE.toString():zh_CN'/ This must assume that the initial value is zh_CN. So I need to know how to get request locale in OGNL. Thx Gordian Yuan
Re: It's a struts2 bug? or just I miss something or configuration error
Hi,Dave I'm using a Maven plug-ins that at compile time will be automatically native2ascii I have just finally solve this problem, some jsp page I forgot to add the following command %@ page contentType=text/html; charset=UTF-8 pageEncoding=UTF-8% Together with this command,everyhing is fine. This is my carelessness. Thank you Gordian On Sat, Apr 11, 2009 at 7:33 AM, Dave Newton newton.d...@yahoo.com wrote: Gordian Yuan wrote: and i have two properties #en_US properties createCampaign.name=Name createCampaign.submit=Create #zh_CN properties createCampaign.name=名称 createCampaign.submit=创建 You can't just put Chinese text in a properties file, you have to use something like native2ascii to convert it into something Java can understand. Searching the web for java properties will provide resources, or just read the Java docs: http://java.sun.com/javase/6/docs/api/java/util/Properties.html Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: It's a struts2 bug? or just I miss something or configuration error
I forgot to say that I am using Struts 2.1.6 On Thu, Apr 9, 2009 at 6:14 PM, Gordian Yuan gordiany...@gmail.com wrote: Hi all, I encountered the issue of international and I don't know this is a bug or just I miss something or configuration error. The issue is I have a simple page like this s:form action=saveCampaign s:textfield id=name name=name key=createCampaign.name/ s:submit key=createCampaign.create/ /s:form and i have two properties #en_US properties createCampaign.name=Name createCampaign.submit=Create #zh_CN properties createCampaign.name=名称 createCampaign.submit=创建 In english version everything is fine, but in chinese version the s:textfield is fine, but s:submit tag is some messy code! I have change the page like this s:form action=saveCampaign s:textfield id=name name=name key=createCampaign.name/ s:submit key=createCampaign.name/ /s:form But the submit button still messy code .. Is it a bug? Any input will be welcome .. thx Gordian
It's a struts2 bug? or just I miss something or configuration error
Hi all, I encountered the issue of international and I don't know this is a bug or just I miss something or configuration error. The issue is I have a simple page like this s:form action=saveCampaign s:textfield id=name name=name key=createCampaign.name/ s:submit key=createCampaign.create/ /s:form and i have two properties #en_US properties createCampaign.name=Name createCampaign.submit=Create #zh_CN properties createCampaign.name=名称 createCampaign.submit=创建 In english version everything is fine, but in chinese version the s:textfield is fine, but s:submit tag is some messy code! I have change the page like this s:form action=saveCampaign s:textfield id=name name=name key=createCampaign.name/ s:submit key=createCampaign.name/ /s:form But the submit button still messy code .. Is it a bug? Any input will be welcome .. thx Gordian - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: It's a struts2 bug? or just I miss something or configuration error
Hi, Greg First, thx for you reply. But i dont think this is my project encoding configurion error, because in s:textfield tag everything is fine, but s:submit tag is some messy code! And I change the s:submit tag the key attribute as same as the s:textfield tag. It's still messy code.I have no idea.I use the 2.0 series do not have this problem.If there is no way I will try downgrading to 2.0.14 verify whether the issue of Struts2.1 Gordian On Fri, Apr 10, 2009 at 9:15 AM, Greg Lindholm glindh...@yahoo.com wrote: @ Martin: Not sure why you reply directly to me and not to the list? Maybe hit the wrong button? BTW: UTF-8 works great for Chinese and the far eastern languages. UTF-16 is incorrect in this case. The Tomcat URIEncoding= parameter refers to how to decode parameters that are included on the query string in an HTTP GET request, and this should (always) be UTF-8. --- On Thu, 4/9/09, Martin Gainty mgai...@hotmail.com wrote: From: Martin Gainty mgai...@hotmail.com Subject: RE: It's a struts2 bug? or just I miss something or configuration error To: glindh...@yahoo.com Date: Thursday, April 9, 2009, 7:45 PM #yiv326085407 .hmmessage P { margin:0px; padding:0px;} #yiv326085407 { font-size:10pt; font-family:Verdana;} http://struts.apache.org/2.0.8/docs/submit.html key specifies the name,label and the value Also last I heard UTF-8 does not support all Chinese Japanese Korean charsets so you'll need to tweak your TC connector URIEncoding settings to UTF-16 in $TOMCAT_HOME/conf/server.xml Connector port=8080 maxHttpHeaderSize=8192 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=8443 acceptCount=100 connectionTimeout=2 disableUploadTimeout=true URIEncoding=UTF-16 /HTH Martin __ Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité 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: Thu, 9 Apr 2009 12:16:30 -0700 From: glindh...@yahoo.com To: user@struts.apache.org Subject: Re: It's a struts2 bug? or just I miss something or configuration error Can you do a view source on the page from your browser and post what the form looks like. gordian yuan wrote: I forgot to say that I am using Struts 2.1.6 On Thu, Apr 9, 2009 at 6:14 PM, Gordian Yuan gordiany...@gmail.com wrote: Hi all, I encountered the issue of international and I don't know this is a bug or just I miss something or configuration error. The issue is I have a simple page like this s:form action=saveCampaign s:textfield id=name name=name key=createCampaign.name/ s:submit key=createCampaign.create/ /s:form and i have two properties #en_US properties createCampaign.name=Name createCampaign.submit=Create #zh_CN properties createCampaign.name=名称 createCampaign.submit=创建 In english version everything is fine, but in chinese version the s:textfield is fine, but s:submit tag is some messy code! I have change the page like this s:form action=saveCampaign s:textfield id=name name=name key=createCampaign.name/ s:submit key=createCampaign.name/ /s:form But the submit button still messy code .. Is it a bug? Any input will be welcome .. thx Gordian -- View this message in context: http://www.nabble.com/It%27s-a-struts2-bug--or-just-I-miss-something-or-configuration-error-tp22968079p22977533.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org Rediscover Hotmail®: Get e-mail storage that grows with you. Check it out.
How to set an ActionValidatorManager to unittest?
Hi, All I found this article, How do I unit test my action's validation logic http://cwiki.apache.org/confluence/display/WW/How+do+I+unit+test+my+action%27s+validation+logic, However, in struts2.1.6 have been removed ActionValidatorManagerFactory class My question is how can be obtain an ActionValidatorManager in unittest? Any input will be great! Thanks... Gordian
How to user HttpServletRequest getRemoteUser() method on struts2 tag?
Hi all, I want to know what is there a way through the ognl tag in struts2 access to the HttpServletRequest getRemoteUser() method I google a lot of about this issue but i can't find any resolvent. Someone know how to do it? Any input will be great ... Thank you Gordian
Re: How to user HttpServletRequest getRemoteUser() method on struts2 tag?
Hi, Lukasz Thank for your reply #request.remoteUser actual is request.getAttribute(remoteUser), not i want request.getRemoteUser() Gordian On Wed, Feb 25, 2009 at 6:38 PM, Lukasz Lenart lukasz.len...@googlemail.com wrote: 2009/2/25 Gordian Yuan gordiany...@gmail.com: I want to know what is there a way through the ognl tag in struts2 access to the HttpServletRequest getRemoteUser() method I google a lot of about this issue but i can't find any resolvent. Someone know how to do it? Any input will be great ... Thank you #request.remoteUser ? Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to user HttpServletRequest getRemoteUser() method on struts2 tag?
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 ... Gordian On Wed, Feb 25, 2009 at 11:54 PM, Lukasz Lenart lukasz.len...@googlemail.com wrote: 2009/2/25 Gordian Yuan gordiany...@gmail.com: #request.remoteUser actual is request.getAttribute(remoteUser), not i want request.getRemoteUser() Yes, you're right try #request.getRemoteUser() Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to user HttpServletRequest getRemoteUser() method on struts2 tag?
Hi Wes, Thank you for your wonderful answer.These two methods are very good solution to my problem. THANK YOU!!! Gordian On Thu, Feb 26, 2009 at 10:34 AM, Wes Wannemacher w...@wantii.com wrote: 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
Re: Update 2.0.x to 2.1.6
Hi, Juergen you can just put struts2-dojo-plugin.jar to your WEB-INF/lib if you dont use maven Gordian On Sun, Feb 22, 2009 at 10:11 PM, Martin Gainty mgai...@hotmail.com wrote: Juergen- I would place the plugin details in a profile in your projects pom.xml which will be activated later on profiles profile iddojo211/id build plugins plugin groupIdorg.apache.struts/groupId artifactIdstruts2-dojo-plugin/artifactId version2.1.1/version /plugin /plugins /build /profile /profiles and then to activate by mvn utility mvn groupId:artifactId:goal -P dojo211 http://maven.apache.org/guides/introduction/introduction-to-profiles.html Mit freundlichen Grüßen Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. From: juergen.l...@bmw.de To: user@struts.apache.org Date: Thu, 22 Jan 2009 09:24:55 +0100 Subject: Update 2.0.x to 2.1.6 Hello, i want to update to 2.1.6. I use Dojo. In the migration guide is written that you should Add the Dojo plugin as a new dependency for your project. dependency groupIdorg.apache.struts/groupId artifactIdstruts2-dojo-plugin/artifactId version2.1.1/version /dependency But where to put this? _ Windows Live™: Discover 10 secrets about the new Windows Live. http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!7540.entry?ocid=TXT_TAGLM_WL_t2_ugc_post_022009http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns%21550F681DAD532637%217540.entry?ocid=TXT_TAGLM_WL_t2_ugc_post_022009
How to use struts2 tag to a open a new window?
Hi all,I has see the document http://struts.apache.org/2.0.14/docs/a.html http://struts.apache.org/2.0.14/docs/a.html and i can't found html tag A target attribute on s:a now i write the code like this a href='s:property value=editJob /' target=_blank modify/a It struts2 has a good way to be able to use s:a to open a new window ? Thanks!
Re: Struts2 Error.
http://struts.apache.org/2.x/docs/simple-setup.html Your can just add minium requirement for your application The following files are a minium requirement for your application. FilenameDescriptionstruts2-core.jarFramework library itself, found in distribution root directoryxwork.jarXWork 2 library on which Struts 2 is built (version 2.0 or later)ognl.jarObject Graph Navigation Language (OGNL), the expression language used throughout the frameworkfreemarker.jarAll UI tag templates are written in Freemarker (also a good option for your own views)commons-logging.jarCommons logging, which the framework uses to support transparently logging to either Log4J or JDK 1.4+web.xmlJava web application configuration file that defines the filters (and other components) for your web applicationstruts.xmlFramework configuration file that defines the actions, results, and interceptors for your application If any Struts 2 Plugins are included, then other JARs may be needed too. For example, the optional Spring Plugin requires the Spring JARs to be present. On Wed, Dec 24, 2008 at 4:19 PM, Srinivasan KS kssva...@gmail.com wrote: hi, I am trying to run the struts2 sample application. I am using Jdeveloper 11g IDE with weblogic server. I am getting this error, when I am running the application. Dec 24, 2008 10:59:38 AM AST Error HTTP BEA-101165 Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.FilterDispatcher. Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - zip:C:/oracle/Middleware/jdeveloper/system/system11.1.1.0.31.51.88/DefaultDomain/servers/DefaultServer/tmp/_WL_user/ts1/m52x67/war/WEB-INF/lib/struts2-core-2.0.14.jar!/struts-default.xml:30:72 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208) at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395) Truncated. see log file for complete stacktrace Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - zip:D:/srini-personal/struts-2.0.1.4-sample-blank/strutsblank/public_html/WEB-INF/lib/struts2-core-2.0.14.jar!/struts-default.xml:30:72 - bean - zip:C:/oracle/Middleware/jdeveloper/system/system11.1.1.0.31.51.88/DefaultDomain/servers/DefaultServer/tmp/_WL_user/ts1/m52x67/war/WEB-INF/lib/struts2-core-2.0.14.jar!/struts-default.xml:30:72 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:193) at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395) Truncated. see log file for complete stacktrace Kindly let me know the reason for this. Thanks. Srinivasan
Re: Message properties not displaying
Hi, Celinio do you declare constant name=struts.ui.theme value=simple / or s:from theme=simple/s:from ? you can simple try s:label key=personBean.firstName theme=xhtml / On Sun, Dec 28, 2008 at 5:44 PM, Celinio Fernandes cel...@yahoo.com wrote: Hi, I am trying to display a label using messages in a property file src/global-messages.properties : personBean.firstName=Your first name (The default locale i am using is en_US) In struts.xml i declared it : constant name=struts.custom.i18n.resources value=global-messages / In a JSP i try do display a label : s:label key=personBean.firstName / The HTML code generated is : label id=personBean_firstName/label The text is missing. Does anyone have an idea what the problem might be ? Thanks
Re: html:select problem
http://www.theserverside.com/discussions/thread.tss?thread_id=35726 or you can search it use google http://www.google.com/search?hl=zh-CNq=select+default+option+strutsbtnG=Google+搜索lr=http://www.google.com/search?hl=zh-CNq=select+default+option+strutsbtnG=Google+%E6%90%9C%E7%B4%A2lr= On Sat, Dec 27, 2008 at 7:33 PM, Tanb81 tanmoy_...@yahoo.com wrote: hi, I am developing a project on struts. I have a drop down like :- html:select property='%= genreIds[0] %' styleClass=inputbox html:options collection=genres property=value labelProperty=label/ /html:select Now I need a value of this dropdown to be automatically selected based on a value which is coming from previous page. The problem is I am not able to do this because I am new to Struts. Please help me out. Thanks in advance. -- View this message in context: http://www.nabble.com/html%3Aselect-problem-tp21183393p21183393.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How do I submit Simplified Chinese text to my Action Class?
Do you have add a CharacterEncodingFilter in web.xml ? for example filter filter-nameencodingFilter/filter-name filter-classorg.springframework.web.filter.CharacterEncodingFilter/filter-class init-param param-nameencoding/param-name param-valueUTF-8/param-value /init-param init-param param-nameforceEncoding/param-name param-valuetrue/param-value /init-param /filter filter-mapping filter-nameencodingFilter/filter-name url-pattern/*/url-pattern /filter-mapping On Sun, Dec 28, 2008 at 10:54 AM, jmlynn jmlynn...@gmail.com wrote: Hi, I am new to handling Simplified Chinese text in Struts, JSP, Java web site. I was able to read from database, and disply Simplified Chinese text in my JSP pages. However, when I modified the displayed Chinese text in my JSP and submit it, What I got in the Action class was unreadable text, which was saved to the database. To determine what the problem was, I added a java line of code to hardcode the returned text: String strValue = formBean.getTranslated(); strValue = some Chinese text; // override code for testing preparedStmt.setString(1, strValue); preparedStmt.execute(); I can now update my database with the hardcoded Chinese text. Hence it is obvious that the getTranslated() method did not return properly encoded text. I had been using the following in my JSP pages %...@page contentType=text/html pageEncoding=UTF-8% ... meta http-equiv=Content-Type content=text/html; charset=UTF-8 ... html:textarea property=translated rows=4 cols=60/ I thought I was encoding the page correctly since I can display and enter Chinese text. Any idea? -- View this message in context: http://www.nabble.com/How-do-I-submit-Simplified-Chinese-text-to-my-Action-Class--tp21189721p21189721.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org