Re: About StrutsTypeConverter
I am confused that why the signature of convertFromString is public Object convertFromString(Map context, String[] values, Class toClass) instead of public Object convertFromString(Map context, String value, Class toClass). What's the point to pass a String array instead of a String argument into this method? Best Regards, Vincent Lin 2011/7/3 Łukasz Lenart : > Take a look on EnumTypeConverter > > > Regards > -- > Łukasz > + 48 606 323 122 http://www.lenart.org.pl/ > Warszawa JUG conference - Confitura http://confitura.pl/ > > > 2011/7/2 Vincent Lin : >> Hi! >> >> I have a questsion about StrutsTypeConverter. >> It has 2 methods to be implemented: >> >> public Object convertFromString(Map context, String[] values, Class toClass) >> and >> public String convertToString(Map context, Object o) . >> >> Why the second parameter in convertFromString String[] instead of String? >> Does it mean struts will pass a array of String to converter when >> there are multiple parameter with the same name in JSP? >> >> But in that case, how do we convert the object back to String[] when >> the JSP is being rendered? >> >> Best Regards, >> Vincent >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
About StrutsTypeConverter
Hi! I have a questsion about StrutsTypeConverter. It has 2 methods to be implemented: public Object convertFromString(Map context, String[] values, Class toClass) and public String convertToString(Map context, Object o) . Why the second parameter in convertFromString String[] instead of String? Does it mean struts will pass a array of String to converter when there are multiple parameter with the same name in JSP? But in that case, how do we convert the object back to String[] when the JSP is being rendered? Best Regards, Vincent - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2.2.3 i18n properties not reloaded after redeployed
Hi Steven, I didn't restart the server. We are usint JBoss. We just copy the war file to deploy directory (the directory is similar to tomcat webapps) and let Jboss to redeploy it. If the server is restarted, the i18 properties will be reloaded. Regards, Vincent On Mon, Jun 20, 2011 at 3:14 PM, Steven Yang wrote: > i am not sure if there was any bug fix regarding i18n reload. > but can you describe how you "redeploy" your app? > do shutoff your server then deploy then start? > or do you just deploy without turning off anything? > > On Mon, Jun 20, 2011 at 1:55 PM, Vincent Lin wrote: > >> Hi, >> >> We migrated to Struts 2.2.3 recently. >> But we found that i18n properties are not reloaded after the web >> application redeployed. >> After setting struts.i18n.reload=true, it will be reloaded after >> redeployed. >> But page rendering speed is slow. >> >> Before 2.2.3, we were using Struts 2.0.11, the i18n properties will be >> reloaded after the web app is redeployed with >> struts.i18n.reload=false. >> >> Can we set any configuration to let i18n properties reloaded in 2.2.3 >> without setting struts.i18n.reload=true? >> It seems to hurt performance a lot. >> >> Thanks! >> Vincent Lin >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts 2.2.3 i18n properties not reloaded after redeployed
Hi, We migrated to Struts 2.2.3 recently. But we found that i18n properties are not reloaded after the web application redeployed. After setting struts.i18n.reload=true, it will be reloaded after redeployed. But page rendering speed is slow. Before 2.2.3, we were using Struts 2.0.11, the i18n properties will be reloaded after the web app is redeployed with struts.i18n.reload=false. Can we set any configuration to let i18n properties reloaded in 2.2.3 without setting struts.i18n.reload=true? It seems to hurt performance a lot. Thanks! Vincent Lin - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Error Throwing With Struts 2 Tags
It's really an annoying issue of struts2. It took me long time to troubleshoot this kind of problem. One time I came across "NoClassDefFoundError". It was swallowed by xwork. I wouldn't know it if I'd not used eclipse debbuger to step in the code. I wonder why this simple issue is not fixed in struts2/xwork. Struts2 is a great web framework if it easier to trouble shoot. On Fri, Jan 9, 2009 at 1:43 AM, Andy wrote: > > This would be a nice-to-have.. > > Patch would be to add a LOG.info() or throw an exception in > org.apache.struts2.components.Property.start().. > > > Date: Tue, 6 Jan 2009 16:23:40 -0500> From: newton.d...@yahoo.com> To: > user@struts.apache.org> Subject: Re: Error Throwing With Struts 2 Tags> > > Timothy Orme wrote:> > > > > > But no value > was displayed. This is because I should have written:> > > > value="itemCost" />> > > > As that was the bean property in my action. It's > a simple fix, but, > > this took me a bit to find it. What I'm wondering is > if theres a way to > > have Struts 2 tags throw errors [...]> > This has > been brought up before; I'm not sure what the current status of > any > patches are, however.> > > Ideally, I'd like to have my JSP not even compile > if it hits a> > bad tag like this. Anyone know if this is possible?> > I'm > sure anything's possible, but not compiling the JSP is unlikely, for > the > same reason a Java class will still compile when using String values > in > reflective/Spring-bean-ish code, even if they're wrong.> > > As an > alternative, anyone know of an eclipse plugin that would point > > these > mistakes out (maybe even through intellisense!)?> > Unlikely for the same > reason.> > Dave> > > > -> To > unsubscribe, e-mail: user-unsubscr...@struts.apache.org> For additional > commands, e-mail: user-h...@struts.apache.org> > _ > Windows Live™ Hotmail(R): Chat. Store. Share. Do more with mail. > > http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t1_hm_justgotbetter_howitworks_012009 >
OGNL exceptions are swallowed by struts2
Hi, Is there anyway to get better error message there's an error occurring in ognl? Everytime there's an exception in ognl it's swallowed. And I ran into some "No Result Found for XxxAction" error. It's extremely hard to debug, because there's no any useful information in it. All of them seem to be converter related problem. Is there anyway to make struts 2 easier to debug? There's an article complaining about this issue: http://raibledesigns.com/rd/entry/does_struts_2_suck Thanks, Vincent
[s2]Runtime exception in a bean setter
I'm using struts 2.0.9. I have a bean in a action. The setter of the bean will throw a RuntimeException when the value is not a legal value. But when I submitted the form with the illegal value, and the RuntimeException was thrown. Nothing happens to struts 2 container. The exception disappeared and is not displayed in log. What I expected is a Error 500 page, but it seems nothing happen at all except the value is not set to the bean. The behavior is quite different from struts 1. Is this a feature of struts 2? Hide the exception of setter of bean? Or can I turn this off in struts.properties or struts.xml? Thanks! Vincent Lin
Re: [S2] Preselected option in tag
I just checked jira and found this: https://issues.apache.org/struts/browse/WW-1711 It's a bug and has been fixed in 2.0.7. I migrated my struts library to 2.0.9 and the problem was gone. Thanks. On 7/26/07, Vincent Lin <[EMAIL PROTECTED]> wrote: The generated html content of is: -- 741501 741406 741405 741404 741403 741402 741200 741156 741155 741154 741153 741152 741151 1050 50 There is no comma in the numeric value. On 7/26/07, Laurie Harper <[EMAIL PROTECTED]> wrote: > > My bet is that it's a bug. If the limit is at 1000, I'm guessing the > problem is that the value is being rendered as 1,000 (i.e. with a comma > separator), and that's what causes the problem. You can verify this by > viewing the HTML source of the rendered page. If that is indeed the > case, a JIRA issue would be a good idea :-) > > L. > > Vincent Lin wrote: > > But I already specified name="adminGroupMapData.adminRid " in the tag. > > Shouldn't the preselected option be the value of > > "adminGroupMapData.adminRid > > "? > > If the preselected option won't be the value of the attribute 'name', > why > > does it work when the value is less than 1000? > > > > On 7/26/07, yitzle <[EMAIL PROTECTED]> wrote: > >> > >> On 7/25/07, Vincent Lin < [EMAIL PROTECTED]> wrote: > >> > I found some people are discussing this problem. > >> > When the data type of the attribute is Integer, the value can't be > too > >> > large. > >> > We can use toString() to make pre-selecting work. > >> > So I changed my tag to: > >> > > >> > >> > headerKey="" headerValue="--" > >> > list="adminList" listKey="adminRid" > >> > listValue="adminRid" > >> > value="%{adminGroupMapData.adminRid.toString > ()}" > >> /> > >> > > >> > And it works now. > >> > Is this a bug of struts 2.0.6??? > >> > > >> > On 7/25/07, Vincent Lin <[EMAIL PROTECTED]> wrote: > >> > >> The 'value' property/parameter: > >> > value="%{ adminGroupMapData.adminRid.toString > ()}" > >> /> > >> is what sets what is selected, or what gets 'jumped' to. > >> > >> - > > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: [S2] Preselected option in tag
The generated html content of is: -- 741501 741406 741405 741404 741403 741402 741200 741156 741155 741154 741153 741152 741151 1050 50 There is no comma in the numeric value. On 7/26/07, Laurie Harper <[EMAIL PROTECTED]> wrote: My bet is that it's a bug. If the limit is at 1000, I'm guessing the problem is that the value is being rendered as 1,000 (i.e. with a comma separator), and that's what causes the problem. You can verify this by viewing the HTML source of the rendered page. If that is indeed the case, a JIRA issue would be a good idea :-) L. Vincent Lin wrote: > But I already specified name="adminGroupMapData.adminRid" in the tag. > Shouldn't the preselected option be the value of > "adminGroupMapData.adminRid > "? > If the preselected option won't be the value of the attribute 'name', why > does it work when the value is less than 1000? > > On 7/26/07, yitzle <[EMAIL PROTECTED]> wrote: >> >> On 7/25/07, Vincent Lin <[EMAIL PROTECTED]> wrote: >> > I found some people are discussing this problem. >> > When the data type of the attribute is Integer, the value can't be too >> > large. >> > We can use toString() to make pre-selecting work. >> > So I changed my tag to: >> > >> > > > headerKey="" headerValue="--" >> > list="adminList" listKey="adminRid" >> > listValue="adminRid" >> > value="%{adminGroupMapData.adminRid.toString ()}" >> /> >> > >> > And it works now. >> > Is this a bug of struts 2.0.6??? >> > >> > On 7/25/07, Vincent Lin <[EMAIL PROTECTED]> wrote: >> >> The 'value' property/parameter: >> > value="%{adminGroupMapData.adminRid.toString ()}" >> /> >> is what sets what is selected, or what gets 'jumped' to. >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Preselected option in tag
But I already specified name="adminGroupMapData.adminRid" in the tag. Shouldn't the preselected option be the value of "adminGroupMapData.adminRid "? If the preselected option won't be the value of the attribute 'name', why does it work when the value is less than 1000? On 7/26/07, yitzle <[EMAIL PROTECTED]> wrote: On 7/25/07, Vincent Lin <[EMAIL PROTECTED]> wrote: > I found some people are discussing this problem. > When the data type of the attribute is Integer, the value can't be too > large. > We can use toString() to make pre-selecting work. > So I changed my tag to: > >headerKey="" headerValue="--" > list="adminList" listKey="adminRid" > listValue="adminRid" > value="%{adminGroupMapData.adminRid.toString()}" /> > > And it works now. > Is this a bug of struts 2.0.6??? > > On 7/25/07, Vincent Lin <[EMAIL PROTECTED]> wrote: The 'value' property/parameter: > value="%{adminGroupMapData.adminRid.toString()}" /> is what sets what is selected, or what gets 'jumped' to. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Preselected option in tag
I found some people are discussing this problem. When the data type of the attribute is Integer, the value can't be too large. We can use toString() to make pre-selecting work. So I changed my tag to: And it works now. Is this a bug of struts 2.0.6??? On 7/25/07, Vincent Lin <[EMAIL PROTECTED]> wrote: Hi! I am using struts 2.0.6 and I encountered a problem in tag today. In my JSP: In my Action, I have a method: public List getAdminGroupList() { return this.adminGroupList; } The data bean of the list has a get method: public Integer getAdminGroupRid() { return this.adminGroupRid; } But in my web page the value of the drop-down list generate by sometimes can't jump to the value of adminGroupRid in the data bean (adminGroupMapData.adminGroupRid). I found a rule of thumb that when the value of adminGroupMapData.adminGroupRid is less than 1000, it works. But when the value is greater than 1000, it doesn't work. Why? Is there any way to solve this problem? Thanks, Vincent Lin
[S2] Preselected option in tag
Hi! I am using struts 2.0.6 and I encountered a problem in tag today. In my JSP: In my Action, I have a method: public List getAdminGroupList() { return this.adminGroupList; } The data bean of the list has a get method: public Integer getAdminGroupRid() { return this.adminGroupRid; } But in my web page the value of the drop-down list generate by sometimes can't jump to the value of adminGroupRid in the data bean (adminGroupMapData.adminGroupRid). I found a rule of thumb that when the value of adminGroupMapData.adminGroupRid is less than 1000, it works. But when the value is greater than 1000, it doesn't work. Why? Is there any way to solve this problem? Thanks, Vincent Lin
Re: [S2] Chinese encoding problem
Chris, Thank you. I solved this problem finally. I use a CharacterEncodingFilter you mentioned to set character encoding to UTF-8. Actually I've tried this filter before, but it didn't work. The reason why it didn't work is the order of fitler mapping is incorrect in my web.xml. This filter must be in front of struts 2 filter like this: SetCharacterEncoding /* struts2 /* But it sitll strange that I've traced the struts 2.0.6 source code and found that id does change the encoding of HttpServletRequest in Dispatcher.java(line 650): public void prepare(HttpServletRequest request, HttpServletResponse response) { String encoding = null; if (defaultEncoding != null) { encoding = defaultEncoding; } Locale locale = null; if (defaultLocale != null) { locale = LocalizedTextUtil.localeFromString(defaultLocale, request.getLocale()); } if (encoding != null) { try { request.setCharacterEncoding(encoding); } catch (Exception e) { LOG.error("Error setting character encoding to '" + encoding + "' - ignoring.", e); } } if (locale != null) { response.setLocale(locale); } if (paramsWorkaroundEnabled) { request.getParameter("foo"); // simply read any parameter (existing or not) to "prime" the request } } And there is a setDefaultEncoding() method in line 227: @Inject(value=StrutsConstants.STRUTS_LOCALE, required=false) public static void setDefaultLocale(String val) { defaultLocale = val; } It seems to get encoding parameter from struts.propertes with key struts.i18n.encoding in struts.properties file. But somehow it doesn't work in my app. The filter has solved this problem. But I think in struts 2, we shouldn't do this filter? It makes the code a bit ugly. The behaviors in IE and Firefox are different really confuses me. Why the browser affect the character encoding in HttpServletRequest? On 6/27/07, Christopher Schultz <[EMAIL PROTECTED]> wrote: Vincent, Vincent Lin wrote: > I use POST in my form. :( You mentioned that MSIE seems to fail, while Mozilla Firefox works. Is this behavior consistent? Does ff always work? Does MSIE always fail? Can you check to see what character encoding (in the HTTP headers) is being sent from the client when things work? What about the failure situation? It's possible that MSIE is not sending the correct request encoding (or, more likely,not sending it at all). If you know your clients will (or should) be sending UTF-8 all the time, you could use the CharacterEncodingFilter mentioned on this list several times to simply override the default encoding used when the browser sends no encoding (or override it unconditionally). This might work. -chris
Re: [S2] Chinese encoding problem
I use POST in my form. On 6/27/07, Christopher Schultz <[EMAIL PROTECTED]> wrote: Vincent, Vincent Lin wrote: > I'm having problem to submit Chinese characters from browser to web server. GET, POST, or both? If it's only failing for GET, check to make sure that your app server knows to expect UTF-8 strings in URLs (in Tomcat, for instance, this is specified in the element of your configuration). -chris
Re: [S2] Chinese encoding problem
But why does it works in Firefox while it doesn't work in IE? I think it might be caused by different http request header made by IE and Firefox. There might be an Interceptor or servlet filter in struts2 which change the character encoding according to the header of http request. On 6/27/07, Emilia Ipate <[EMAIL PROTECTED]> wrote: There is no interceptor, from what I know. You should try to found where exactly lies the problem: - is struts doing something wrong or the request got from the client is already bad. You can check that by looking in the HttpRequest object, in the debug mode Emilia -Original Message- From: Vincent Lin [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 27, 2007 1:30 PM To: Struts Users Mailing List Subject: Re: [S2] Chinese encoding problem Emilia, I've tried -Dclient.encoding.override=UTF-8, it doesn't seem to change anything. It's really wired that when I use IE, the Chinese characters will be scramble. But when I use firefox, it works correctly. The funny thing is that the browser language setting of my IE is "zh_TW" while the setting in firefox is "en". Is there any interceptor in S2 changing the encoding of request? On 6/27/07, Emilia Ipate <[EMAIL PROTECTED]> wrote: > > Vincent, > Your server must have as a Java VM Argument this line: > -Dclient.encoding.override=UTF-8 > > (search on google client.encoding.override and you will find more) > Emilia > > > > > > -Original Message- > From: Vincent Lin [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 27, 2007 12:56 PM > To: Struts Users Mailing List > Subject: Re: [S2] Chinese encoding problem > > By the way the settings in my JSP: > > <%@ page contentType="text/html; charset=UTF-8" %> > > > > Did I miss anything else? > > On 6/27/07, Vincent Lin <[EMAIL PROTECTED]> wrote: > > > > Hi > > > > I'm having problem to submit Chinese characters from browser to web > > server. > > > > I have the following settings in struts.properties: > > > > struts.locale=zh_TW > > struts.i18n.encoding=UT8 > > > > But when I submit Chinese characters to web server. > > It gets scrambled characters. > > (The wierd thing is that sometimes the server gets correct Chinese > > characters.) > > > > I've tried to use an interceptor to do > req.setCharacterEncoding("UTF-8"). > > It doesn't work. > > > > I've tried to use Servlet Filter to do > req.setCharacterEncoding("UTF-8") > > too. > > (It's the way we solve Chinese problem in struts 1 environment). > > It still doesn't work. > > > > Does anyone know how to solve this problem? > > > > Thanks a lot! > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Chinese encoding problem
Emilia, I've tried -Dclient.encoding.override=UTF-8, it doesn't seem to change anything. It's really wired that when I use IE, the Chinese characters will be scramble. But when I use firefox, it works correctly. The funny thing is that the browser language setting of my IE is "zh_TW" while the setting in firefox is "en". Is there any interceptor in S2 changing the encoding of request? On 6/27/07, Emilia Ipate <[EMAIL PROTECTED]> wrote: Vincent, Your server must have as a Java VM Argument this line: -Dclient.encoding.override=UTF-8 (search on google client.encoding.override and you will find more) Emilia -----Original Message- From: Vincent Lin [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 27, 2007 12:56 PM To: Struts Users Mailing List Subject: Re: [S2] Chinese encoding problem By the way the settings in my JSP: <%@ page contentType="text/html; charset=UTF-8" %> Did I miss anything else? On 6/27/07, Vincent Lin <[EMAIL PROTECTED]> wrote: > > Hi > > I'm having problem to submit Chinese characters from browser to web > server. > > I have the following settings in struts.properties: > > struts.locale=zh_TW > struts.i18n.encoding=UT8 > > But when I submit Chinese characters to web server. > It gets scrambled characters. > (The wierd thing is that sometimes the server gets correct Chinese > characters.) > > I've tried to use an interceptor to do req.setCharacterEncoding("UTF-8"). > It doesn't work. > > I've tried to use Servlet Filter to do req.setCharacterEncoding("UTF-8") > too. > (It's the way we solve Chinese problem in struts 1 environment). > It still doesn't work. > > Does anyone know how to solve this problem? > > Thanks a lot! > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Chinese encoding problem
By the way the settings in my JSP: <%@ page contentType="text/html; charset=UTF-8" %> Did I miss anything else? On 6/27/07, Vincent Lin <[EMAIL PROTECTED]> wrote: Hi I'm having problem to submit Chinese characters from browser to web server. I have the following settings in struts.properties: struts.locale=zh_TW struts.i18n.encoding=UT8 But when I submit Chinese characters to web server. It gets scrambled characters. (The wierd thing is that sometimes the server gets correct Chinese characters.) I've tried to use an interceptor to do req.setCharacterEncoding("UTF-8"). It doesn't work. I've tried to use Servlet Filter to do req.setCharacterEncoding("UTF-8") too. (It's the way we solve Chinese problem in struts 1 environment). It still doesn't work. Does anyone know how to solve this problem? Thanks a lot!
[S2] Chinese encoding problem
Hi I'm having problem to submit Chinese characters from browser to web server. I have the following settings in struts.properties: struts.locale=zh_TW struts.i18n.encoding=UT8 But when I submit Chinese characters to web server. It gets scrambled characters. (The wierd thing is that sometimes the server gets correct Chinese characters.) I've tried to use an interceptor to do req.setCharacterEncoding("UTF-8"). It doesn't work. I've tried to use Servlet Filter to do req.setCharacterEncoding("UTF-8") too. (It's the way we solve Chinese problem in struts 1 environment). It still doesn't work. Does anyone know how to solve this problem? Thanks a lot!
Re: [S2] onsubmit in tag
Hi Dave, Thank you. You are right. There is an error in my validateFields() function. It works now. The "return true" in onsubmit has nothing to do with my problem. Vincent On 6/26/07, Dave Newton <[EMAIL PROTECTED]> wrote: --- Vincent Lin <[EMAIL PROTECTED]> wrote: > If you try it in a plain html form, you will know > the difference. That's really useful to use > onsubmit="return (validateFields())" in form > tag, Um... Yeah, I understand that. What I'm saying is: onsubmit="return validateFields(); return true;" will always return the value of the validateFields() function call; the trailing "return true;" will never happen. d. Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] onsubmit in tag
If you try it in a plain html form, you will know the difference. That's really useful to use onsubmit="return (validateFields())" in form tag, and validate all fields in validateFields() function (If you are not using validators.). Return true in validateFields() if all validations are passed. Return false when there is something wrong in your input. On 6/26/07, Dave Newton <[EMAIL PROTECTED]> wrote: --- Vincent Lin <[EMAIL PROTECTED]> wrote: > For example, onsubmit="return (validateFields())" is > specified in html tag. If the javascript > function validateFields() return true, the form will > submit, otherwise it won't. > > It works fine in struts 1. > But struts2 always add 'return true' in onsubmit > event. That causes validateFields() useless. Why / how? Once it hits a return it doesn't make any difference what's after it. d. Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. http://farechase.yahoo.com/promo-generic-14795097 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] How do I create a client side validator?
Thanks for your help. But I only see how to configure client side validators. What I want is to create a customized client side validator. The build in validators can't meet our requirements such as validating the length of Chinese characters. On 6/26/07, Dave Newton <[EMAIL PROTECTED]> wrote: --- Vincent Lin <[EMAIL PROTECTED]> wrote: > Is there any document talking about how to create a > client side validator in struts2? Yes, it's one of the links under the "validation" section on the wiki. http://struts.apache.org/2.x/docs/validation.html http://struts.apache.org/2.x/docs/client-validation.html d. Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] onsubmit in tag
I usually use onsubmit in form tag to do javascript validation. For example, onsubmit="return (validateFields())" is specified in html tag. If the javascript function validateFields() return true, the form will submit, otherwise it won't. It works fine in struts 1. But struts2 always add 'return true' in onsubmit event. That causes validateFields() useless. On 6/26/07, yitzle <[EMAIL PROTECTED]> wrote: Um... Firstly, it does the same thing. I think if you move the code to the submit button it renders it as expected. On 6/26/07, Dave Newton <[EMAIL PROTECTED]> wrote: > --- Vincent Lin <[EMAIL PROTECTED]> wrote: > > Why it renders onsubmit="return (validateFields()); > > return true;" > > instead of onsubmit="return (validateFields())" ? > > Can I make renders onsubmit="return > > (validateFields())" only? > > Probably that's what's in the template. I'm not sure > that it really matters, though. > > d. > > > > > > Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. > http://smallbusiness.yahoo.com/webhosting > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S2] How do I create a client side validator?
Is there any document talking about how to create a client side validator in struts2? Thanks!
[S2] onsubmit in tag
Hi! I wrote in my JSP, but struts 2 rendered the following html: Why it renders onsubmit="return (validateFields()); return true;" instead of onsubmit="return (validateFields())" ? Can I make renders onsubmit="return (validateFields())" only? Thanks!
[S2] datetimepicker reset value to 00:00 when type="time" after submitting page
I have a datetimepicker in my JSP to let user select time: When user select 10:15 and submit to webserver, after the web page refreshes the value becomes 00:00. Is this another datetimepicker bug? I have a type converter for converting time the format string is "HH:mm": public class TimeConverter extends StrutsTypeConverter { private static Logger log = Logger.getLogger(TimeConverter.class); public Object convertFromString(Map context, String[] values, Class toClass) { log.debug("entering convertFromString() values[0]='" + values[0] + "'"); if (StringUtil.isEmpty(values[0])) { return null; } try { Date dt = TimeUtil.getGuiTimeFormat().parse(values[0]); Object rtn = new java.sql.Time(dt.getTime()); log.debug("rtn=" + rtn); return rtn; } catch (Exception e) { log.error(e, e); } return null; } public String convertToString(Map context, Object o) { log.debug("entering convertToString() o=" + o); String str = null; if ( o != null ) { str = TimeUtil.getGuiTimeFormat().format(o); log.debug("entering convertToString() str=" + str); } return str; } } But the debug log shows the time str is 10:15. Thanks!
Re: FormFile: Catching IllegalArgumentException
Do you have this setting in your form? enctype="multipart/form-data" On 6/8/07, Eric Jain <[EMAIL PROTECTED]> wrote: I have a form with a FormFile field, which works great, except that when someone submits a plain string for this field (e.g. a spammer crawling the site and doing random submissions) I get an ugly stack trace logged... I wonder is there a way to catch this? 2007-06-08 16:04 org.apache.commons.beanutils.PropertyUtils ERROR: Method invocation failed. java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod( PropertyUtilsBean.java:1773) at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty( PropertyUtilsBean.java:1759) at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty( PropertyUtilsBean.java:1648) at org.apache.commons.beanutils.PropertyUtilsBean.setProperty( PropertyUtilsBean.java:1677) at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java :1022) at org.apache.commons.beanutils.BeanUtilsBean.populate( BeanUtilsBean.java:811) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java :298) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java :451) at org.apache.struts.chain.commands.servlet.PopulateActionForm.populate( PopulateActionForm.java:45) at org.apache.struts.chain.commands.AbstractPopulateActionForm.execute( AbstractPopulateActionForm.java:57) at org.apache.struts.chain.commands.ActionCommandBase.execute( ActionCommandBase.java:48) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java :190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java :304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java :190) at org.apache.struts.chain.ComposableRequestProcessor.process( ComposableRequestProcessor.java:280) at org.apache.struts.action.ActionServlet.process( ActionServlet.java:1858) at org.apache.struts.action.ActionServlet.doPost( ActionServlet.java:459) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s2] How to get the value of dojo datetimepicker object
Thanks Musachy, it works. The javascript error I had is caused by wrong element id. But it's wierd that when I used the wrong id, the alert(obj) give me a dojo object name. When I call obj.gatValue(), I got a javascript error. On 6/7/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: The setter methods are specific to 2.1, but the getter ones are available on 2.0.x: http://struts.apache.org/2.x/docs/ajax-and-javascript-recipes.html#AjaxandJavaScriptRecipes-DateandTimepicker musachy On 6/7/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: > > I posted this not long ago on this list. Basically you have to use > "getDate()" to get a JavaScript date object and getValue() to get the text > entered in the datepicker. > > musachy > > On 6/7/07, Vincent Lin <[EMAIL PROTECTED]> wrote: > > > > I am trying to get the value inputed by the user from datetimepicker > > object. > > I have the following javascript in my JSP: > > > > var obj = dojo.widget.byId("createTimeTm"); > > alert(obj); > > alert( obj.getValue()); > > > > But "alert(obj.getValue())" encounter a javsacript error. > > > > Can anyone tell me the correct syntax of the javascript to retrieve the > > value of datetimepicker object? > > > > Thanks! > > > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd -- "Hey you! Would you help me to carry the stone?" Pink Floyd
[s2] How to get the value of dojo datetimepicker object
I am trying to get the value inputed by the user from datetimepicker object. I have the following javascript in my JSP: var obj = dojo.widget.byId("createTimeTm"); alert(obj); alert(obj.getValue()); But "alert(obj.getValue())" encounter a javsacript error. Can anyone tell me the correct syntax of the javascript to retrieve the value of datetimepicker object? Thanks!
Re: datetimepicker & S2 validation
Is struts 2.1 available for downloading? I only find struts 2.0.6 in apache website. On 6/7/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: sorry. 2.1 is the one. musachy On 6/6/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > It is getting to the action! Can you tell me if a new version is > available? > > On 6/6/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: > > > > Datetimepicker is buggy on 2.0.6, I would first make sure that the value > > is > > getting to the action, without any validation at all. > > > > musachy > > > > On 6/6/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > I have a datetimepicker on a screen with the key=" > > > payrollUpdate.effectiveDate". I have a > > > PayrollUpdateAction-validation.xmlfile that corresponds to the Action > > > associated with this web page. Inside > > > the validation file I have the following field validation: > > > > > > > > > > > > > > > > > > > > > > > > After entering a date or selecting one from the calendar, I get the > > > validation error that Effective Date is required! It is as though I > > have > > > not entered anything! Any ideas? > > > > > > -- > > > Scott > > > [EMAIL PROTECTED] > > > > > > > > > > > -- > > "Hey you! Would you help me to carry the stone?" Pink Floyd > > > > > > -- > Scott > [EMAIL PROTECTED] > -- "Hey you! Would you help me to carry the stone?" Pink Floyd
Re: [S2] issues
What is the data type of autoridade.orgao.codObjeto and autoridade.cargo.codObjeto? On 6/7/07, Rafael Dittberner <[EMAIL PROTECTED]> wrote: This is my code: Someone please explain to me why in the first one i had to use toString() to make it work, but the second one works perfectly as is? -- Rafael Dittberner Brasília (DF) - Brasil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cannot reset dynavalidatorform in struts 1.2.9
Could you check the generated HTML code? (Use the view source function of your browser) If the html of the field has value="x", the reset button won't clear it. It just reset the value to original value. Did you set the properties to your DynaActionForm? Or the form has default values? On 6/6/07, Ambaris Mohanty <[EMAIL PROTECTED]> wrote: Hi, I'm using a simple DynaValidatorForm for my login form. The problem is. the reset button doesn't reset the fields to blank state which I want. Can anybody help? AM
Re: display current date in header
You can write a base action and have every action extends it. And do this in your execute() method: Calendar cal = Calendar.getInstance(); Date currDate = cal.getTime(); SimpleDateFormat df = new SimpleDateFormat("dd.MM."); String showDate = df.format(currDate); request.setAttribute("showDate", showDate); If you think use a base action make your code ugly you can write a servlet filter and configured it in web.xml. And write a bean:write tag in your JSP: On 6/6/07, Raghupathy, Gurumoorthy <[EMAIL PROTECTED]> wrote: http://jakarta.apache.org/taglibs/doc/datetime-doc/intro.html -Original Message- From: Ambaris Mohanty [mailto:[EMAIL PROTECTED] Sent: 06 June 2007 08:54 To: 'Struts Users Mailing List' Subject: RE: display current date in header Thanks for your solution. It works fine. But I want to do it without using scrip lets. How to do? AM -Original Message- From: Norbert Hirneisen [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 06, 2007 12:01 PM To: 'Struts Users Mailing List' Subject: RE: display current date in header In your jsp: <%@ page import="java.util.Calendar"%> <%@ page import="java.util.Date"%> <%@ page import="java.text.*"%> <% // current Date Calendar cal = Calendar.getInstance(); Date currDate = cal.getTime(); SimpleDateFormat df = new SimpleDateFormat("dd.MM."); String showDate = df.format(currDate); %> In the html-body: <%=showDate%> Regards, Norbert Norbert Hirneisen science4you Online-Monitoring Please visit us: http://www.science4you.org (in German) Norbert Hirneisen Science & Communications von-Müllenark-Str. 19 53179 Bonn phone +49-228-6194930 -Ursprüngliche Nachricht- Von: Ambaris Mohanty [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 6. Juni 2007 07:26 An: 'Struts Users Mailing List' Betreff: display current date in header Hi all, I'm using struts 1.2.9 along with Tiles. I want to display current date in the header page. Can anybody tell me the best approach to do so? Thank you, AM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S2] Is Action thread-safe in struts 2?
Hi I am a newbie in struts2. I have a fundamental question abut s2. We all know that a Servlet is not a thread-safe object unless it implements SingleThreadModel. Is Action in s2 thread-safe or not? Container will create a new Action instance for each new request? Thanks!
[s2] Is there a tag similar to in s1
Hi! Is there a tag in struts 2 which has similar function to in struts1 ? Thanks.
Quetsions about tag
Hi, I've tried tag in my JSP. It's really a cool tag which render a date selection javascript control. But I have some quetsions about this tag: 1. Can I select date and time simultaneously in one datepicker control? Currently I map a date property in action to 2 separate datepicker in JSP: one is for date, and the other is for time. 2. Can I select second in datepicker? 3. When I first use datepicker tag in my JSP, I encounterred a type conversion problem. I got an error message like this: ERROR - ParametersInterceptor - ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'userData.createDate' with value '[Ljava.lang.String;@16b7f83' It was solved by writing an type converter and configured in xwork-conversion.properties. But I saw the document says that date converter is provided by struts2, we don't need to configure it manually. Is this problem caused by locale? I am using traditional Chinese (zh_TW). Thanks!
[S2] map to boolean property not checked
I have a java bean serviceData with a Boolean property autoActivate in my action. And I wrote a tag in my JSP: But the default radio button is not checked in my page. (While autoActivate is true the radio button of 'true' should be checked, but it isn't.) It works when I map to java 1.5 enum, but it doesn't work when I map to java.lang.Boolean. Did I do anything wrong? Thanks.
[S2] How do I disable tags generated by ?
Hi! I've done several projects with struts1 and planned to use struts2 in my new project. I am amazed the the code is so concise in struts2. But I have quetsion about the tag. When I use and , the , and tags are generated in html page. Can I disable this feature? Because it might interfere my page layout. Thanks!