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 lukasz.len...@googlemail.com: 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 vincent.lin...@gmail.com: 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 kenshin...@gmail.com 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 vincent.lin...@gmail.comwrote: 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
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
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 andrh...@hotmail.com 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: s:property value=itemeCost /But no value was displayed. This is because I should have written:s:property 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
[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 s:select/ 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 s:select/ is: select name=adminGroupMapData.adminRid id=AdminGroupMap_create_adminGroupMapData_adminRid option value= --/option option value=741501741501/option option value=741406741406/option option value=741405741405/option option value=741404741404/option option value=741403741403/option option value=741402741402/option option value=741200741200/option option value=741156741156/option option value=741155741155/option option value=741154741154/option option value=741153741153/option option value=741152741152/option option value=741151741151/option option value=10501050/option option value=5050/option /select 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 s:select/ tag to: s:select name=adminGroupMapData.adminRid 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]
[S2] Preselected option in s:select/ tag
Hi! I am using struts 2.0.6 and I encountered a problem in s:select/ tag today. In my JSP: s:select name=adminGroupMapData.adminGroupRid headerKey= headerValue=-- list=adminGroupList listKey=adminGroupRid listValue=adminGroupRid/ In my Action, I have a method: public ListAdminGroupEbo 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 s:select/ 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] Preselected option in s:select/ 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 s:select/ tag to: s:select name=adminGroupMapData.adminRid 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: Hi! I am using struts 2.0.6 and I encountered a problem in s:select/ tag today. In my JSP: s:select name=adminGroupMapData.adminGroupRid headerKey= headerValue=-- list=adminGroupList listKey=adminGroupRid listValue=adminGroupRid/ In my Action, I have a method: public ListAdminGroupEbo 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 s:select/ 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] Preselected option in s:select/ tag
The generated html content of s:select/ is: select name=adminGroupMapData.adminRid id=AdminGroupMap_create_adminGroupMapData_adminRid option value= --/option option value=741501741501/option option value=741406741406/option option value=741405741405/option option value=741404741404/option option value=741403741403/option option value=741402741402/option option value=741200741200/option option value=741156741156/option option value=741155741155/option option value=741154741154/option option value=741153741153/option option value=741152741152/option option value=741151741151/option option value=10501050/option option value=5050/option /select 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 s:select/ tag to: s:select name=adminGroupMapData.adminRid 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 s:select/ 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 s:select/ tag to: s:select name=adminGroupMapData.adminRid 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]
[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] Chinese encoding problem
By the way the settings in my JSP: %@ page contentType=text/html; charset=UTF-8 % meta http-equiv=Content-Type content=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!
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 % meta http-equiv=Content-Type content=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
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 % meta http-equiv=Content-Type content=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
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 Connector element of your configuration). -chris
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: filter-mapping filter-nameSetCharacterEncoding/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namestruts2/filter-name url-pattern/*/url-pattern /filter-mapping 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
[S2] onsubmit in s:form tag
Hi! I wrote s:form action=Admin_create onsubmit=return (validateFields()) in my JSP, but struts 2 rendered the following html: form id=Admin_create name=Admin_create onsubmit=return (validateFields()); return true; ... Why it renders onsubmit=return (validateFields()); return true; instead of onsubmit=return (validateFields()) ? Can I make renders onsubmit=return (validateFields()) only? Thanks!
[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!
Re: [S2] onsubmit in s:form tag
I usually use onsubmit in form tag to do javascript validation. For example, onsubmit=return (validateFields()) is specified in html form 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]
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 s:form 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 form 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] onsubmit in s:form 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]
[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: s:datetimepicker name=searchBean.createTimeTmTo language=en_US type=time displayFormat=HH:mm / 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]
[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: [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] Is there a tag similar to html:base/ in s1
Hi! Is there a tag in struts 2 which has similar function to html:base/ in struts1 ? Thanks.
[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!
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: bean:write name=showDate / 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: p%=showDate%/p 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]
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: [S2] s:select 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: s:select name=autoridade.orgao.codObjeto list=orgaos listKey=codObjeto listValue=nome label=Orgão value=%{autoridade.orgao.codObjeto.toString()} / s:select name=autoridade.cargo.codObjeto list=cargos listKey=codObjeto listValue=nome label=Cargo value=%{autoridade.cargo.codObjeto} / 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: 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: field name=payrollUpdate.effectiveDate field-validator type=requiredstring message key=requiredstring /field-validator field 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
[S2] How do I disable tabletrtd tags generated by s:form ?
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 s:form tag. When I use s:form and s:textfield, the table, tr and td tags are generated in html page. Can I disable this feature? Because it might interfere my page layout. Thanks!
[S2] s:radio/ map to boolean property not checked
I have a java bean serviceData with a Boolean property autoActivate in my action. And I wrote a s:radio/ tag in my JSP: s:radio label=autoActivate name=serviceData.autoActivate list=#{'true':'true', 'false':'false'} / 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 s:select/ to java 1.5 enum, but it doesn't work when I map s:radio to java.lang.Boolean. Did I do anything wrong? Thanks.
Re: Unable to Download Struts2
Is there someplace else where i can download this? Thanks! Matt Wendy Smoak wrote: On 10/24/06, Matthew J. Vincent [EMAIL PROTECTED] wrote: I get a connection timeout everytime I try to download: http://people.apache.org/builds/struts/2.0.1/struts-2.0.1-all.zip Anyone else getting this? Yes, that server was part of some infrastructure work that started on Saturday. The original estimate was Monday, but it's taking longer than expected. There is a monitoring page, though there is no further information about people.apache.org on it: http://monitoring.apache.org/status/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Unable to Download Struts2
Hi all, I get a connection timeout everytime I try to download: http://people.apache.org/builds/struts/2.0.1/struts-2.0.1-all.zip Anyone else getting this? Thanks! Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Shale] Old form values still there after Cancel button.
Hi all, For the life of me I can't get JSF to stinkn forget values that were entered on a form. The view controller is request scope. If I start to enter data in a form and then click the Cancel button, which has immediate=true, the values entered by the user reappear in the form when I return to the page. The action of the Cancel button returns home which maps to a navigational rule to the home page that is a redirect. I've tried these two things which haven't worked: 1) traverse the ViewRoot looking for UIInputs and setting the submitted value to null. 2) set the value binding to the VC managed bean to null. I had read that JSF will reuse evaluated expressions if they aren't null. Any help is greatly appreciated. Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Shale startup - without Spring.
Hi there, Perhaps my error are unrealted, but... I was trying to get get rid of Spring from my classpath - as it is so stinkn huge when it is unzipped. From what I read in the Shale doc'o, spring is only needed if I was instantiating POJO objects outside the JSF config file. So... I tried to eliminate the Spring jars from my classpath. Before I attempted to remove Spring, I would occasionally get some server 500 errors like this... java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext(FacesContextUtils.java:79) So ... After the removal, at Tomcat startup, I'm now getting: 2006-05-16 08:51:16,703 [main] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mac] - org.apache.shale.component.Subview javax.faces.FacesException: Can't instantiate class: 'org.apache.shale.component.Subview'. at com.sun.faces.application.ApplicationImpl.newThing(ApplicationImpl.java:728) ... 2006-05-16 08:51:16,718 [main] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mac] - org.apache.shale.component.Token javax.faces.FacesException: Can't instantiate class: 'org.apache.shale.component.Token'. at com.sun.faces.application.ApplicationImpl.newThing(ApplicationImpl.java:728) ... 2006-05-16 08:51:16,718 [main] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mac] - org.apache.shale.component.ValidatorScript javax.faces.FacesException: Can't instantiate class: 'org.apache.shale.component.ValidatorScript'. at com.sun.faces.application.ApplicationImpl.newThing(ApplicationImpl.java:728) ... 2006-05-16 08:51:16,796 [main] ERROR com.sun.faces.config.ConfigureListener - One or more confgured application objects could not be created. Check your web application logs for details. 2006-05-16 08:51:16,796 [main] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mac] - Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener javax.faces.FacesException: One or more confgured application objects could not be created. Check your web application logs for details. at com.sun.faces.config.ConfigureListener.verifyObjects(ConfigureListener.java:1152) Am I missing something from my web.xml file? Thanks, Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Shale: onclick=disabled='true'; not calling Action Method. (stopping double click)
Hi all, My project spec is asking me to disable form buttons once they are clicked. It seemed easy to me, just add onclick=disabled='true' to the commandButton. But as anything I've found with JSF, it isn't that easy. When I do this, the action method isn't being called after it passes validation. If I remove the onclick attribute, the form works fine; so I know it isn't a logic failure in the ViewController. I noticed that JSF inserts some of its own onclick logic to the button too. So I thought I'd try to disable the button by using the onsubmit attribute of the form tag. This also had the same behavior. What is going on here? Is disabling the button changing the submitted request parameters? Thanks all, Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Shale: onclick=disabled='true'; not calling Action Method. (stopping double click)
hmmm that isn't going to solve my issue. I don't want the button disabled on reload. I only want it to be disabled from the time the user clicked the button, until the time the server is able to send back a response. Here is an example: On a login form... enter username and pwd and click the submit button. While the server is processing the login form (the IE globe is spinning) the button becomes disabled so that the user can't resubmit the same login form. I'm more curious about how setting a DOM property on a element would change the way it is handled on the server side. Thanks for the try though, Jason On 5/11/06, James Reynolds [EMAIL PROTECTED] wrote: The first thought that occurs to me is, how about binding the button's JSF 'disabled' attribute to a boolean property on your backing bean? As part of the button's action method, you could set the boolean to true, thereby disabling the button when the page reloads. -Original Message- From: Jason Vincent [mailto:[EMAIL PROTECTED] Sent: Thursday, May 11, 2006 10:42 AM To: user@struts.apache.org Subject: Shale: onclick=disabled='true'; not calling Action Method. (stopping double click) Hi all, My project spec is asking me to disable form buttons once they are clicked. It seemed easy to me, just add onclick=disabled='true' to the commandButton. But as anything I've found with JSF, it isn't that easy. When I do this, the action method isn't being called after it passes validation. If I remove the onclick attribute, the form works fine; so I know it isn't a logic failure in the ViewController. I noticed that JSF inserts some of its own onclick logic to the button too. So I thought I'd try to disable the button by using the onsubmit attribute of the form tag. This also had the same behavior. What is going on here? Is disabling the button changing the submitted request parameters? Thanks all, Jason - 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]
Re: Shale: onclick=disabled='true'; not calling Action Method. (stopping double click)
Thanks Craig... that explains it. thanks, Jason On 5/11/06, Jason Vincent [EMAIL PROTECTED] wrote: hmmm that isn't going to solve my issue. I don't want the button disabled on reload. I only want it to be disabled from the time the user clicked the button, until the time the server is able to send back a response. Here is an example: On a login form... enter username and pwd and click the submit button. While the server is processing the login form (the IE globe is spinning) the button becomes disabled so that the user can't resubmit the same login form. I'm more curious about how setting a DOM property on a element would change the way it is handled on the server side. Thanks for the try though, Jason On 5/11/06, James Reynolds [EMAIL PROTECTED] wrote: The first thought that occurs to me is, how about binding the button's JSF 'disabled' attribute to a boolean property on your backing bean? As part of the button's action method, you could set the boolean to true, thereby disabling the button when the page reloads. -Original Message- From: Jason Vincent [mailto:[EMAIL PROTECTED] Sent: Thursday, May 11, 2006 10:42 AM To: user@struts.apache.org Subject: Shale: onclick=disabled='true'; not calling Action Method. (stopping double click) Hi all, My project spec is asking me to disable form buttons once they are clicked. It seemed easy to me, just add onclick=disabled='true' to the commandButton. But as anything I've found with JSF, it isn't that easy. When I do this, the action method isn't being called after it passes validation. If I remove the onclick attribute, the form works fine; so I know it isn't a logic failure in the ViewController. I noticed that JSF inserts some of its own onclick logic to the button too. So I thought I'd try to disable the button by using the onsubmit attribute of the form tag. This also had the same behavior. What is going on here? Is disabling the button changing the submitted request parameters? Thanks all, Jason - 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]
Best Practice - Correct usage???
Hello all, I have an application to edit some data stored in the database. I have 2 situations. 1. When a user clicks New or Edit Mouse, the user is brought to a form that either displays an empty form or one that is pre-populated. This is done with the following mapping: pre action path = /mouseAction type = org.jax.mgi.mtb.jaxpathwi.actions.MouseDispatchAction name = MouseSubmitForm scope = request validate = true parameter = dispatch input = mouse.jsp forward name=setupSuccess path=/WEB-INF/jsp/mouse.jsp/ forward name=insertSuccess path=/WEB-INF/jsp/mouse.jsp/ forward name=updateSuccess path=/WEB-INF/jsp/mouse.jsp/ /action /pre This works fine, but upon successful insert why couldn't I just forward it back to the setupSuccess portion? Like the following: pre action path = /mouseAction type = org.jax.mgi.mtb.jaxpathwi.actions.MouseDispatchAction name = MouseSubmitForm scope = request validate = true parameter = dispatch input = mouse.jsp forward name=setupSuccess path=/WEB-INF/jsp/mouse.jsp/ forward name=insertSuccess path=/mouseAction.do/ forward name=updateSuccess path=/WEB-INF/jsp/mouse.jsp/ /action /pre Do I have to do something different in my Action class? It is running in an infinite loop and eventually running out of memory. 2. When a user updates a mouse, I want them to be directed to a summary screen of the mouse which has the following mapping: pre action path = /mouseSummary type = org.jax.mgi.mtb.jaxpathwi.actions.MouseSummaryAction scope=request forward name=success path=/WEB-INF/jsp/mouseSummary.jsp/ /action /pre would I change my action mapping to the following pre action path = /mouseAction type = org.jax.mgi.mtb.jaxpathwi.actions.MouseDispatchAction name = MouseSubmitForm scope = request validate = true parameter = dispatch input = mouse.jsp forward name=setupSuccess path=/WEB-INF/jsp/mouse.jsp/ forward name=insertSuccess path=/mouseAction.do/ forward name=updateSuccess path=/mouseSummary.do/ /action /pre But how does one pass in the variables that mouse summary needs to know like the id of the mouse? Am I making any sense to anyone? Thanks! Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can't figure out how to do if then else with Struts logic tags
Not sure if this is a solution for you or not, but you could also put your JSPs under WEB-INF directory so that they cannot be directly accessed by a user. They would instead have to go through an Action first. Filters may be your best bet (and yes, that is the URL to look at). As far as JST syntax, you could use something like: c:choose c:when test=${numberOfResults==0} !-- DO SOMETHING -- /c:when c:otherwise !-- DO SOMETHING ELSE -- /c:otherwise /c:choose Hope that helps! Matt [EMAIL PROTECTED] wrote: Dave, I totally agree with you about doing this kind of checking in an action class and I AM doing it there. However, the problem is that I still need a way to prevent a user from going to the jsp w/o first logging in. Let's say the user logged in during a previous session and bookmarked the jsp. They can get back to it w/o having to login. I know that once they submit the form the action class will catch that they're not logged in and send them back to login page. But I'd rather catch it before then. I hate to have the user fill in a bunch of information, submit form and THEN get redirected to login. I'll look into JSTL. Are you saying it has if-then-else type of processing? Could you point me in the right direction for that and for the check if object exists in session issue? Also, I haven't used filters before. We just upgraded from Struts 1.0.2 so I'm pretty ignorant of all the features of newest version of Struts. Is this some kind of Struts filter or what is described here? http://java.sun.com/products/servlet/Filters.html Thanks again for your reply. [EMAIL PROTECTED] wrote: Is it possible to do if then else type of processing using Struts Logic tags? I don't see anything in the Struts Logic tags documentation at this link http://struts.apache.org/struts-doc-1.2.7 /userGuide/struts-logic.html Use JSTL; you'll be better off in the long run anyway, and there's essentially zero learning curve. 1) I want to put in some logic in all my jsps to check if a user has authenticated. Don't do this in the JSP; do this in either a filter, base Action class, etc. Try to use JSP pages for presentation only to keep concerns separated. One of the problems is that I also need to check if the user session object is null because a user could have tried to go directly to an internal (after login page) page using a bookmark. How can I check for the presence of an object in the session? Again, if you're doing this outside of a JSP (highly recommended) it's trivial. Otherwise you could always use a JSTL tag to check for a value in the appropriate session scope attribute key. Als0-Dave David - The information contained in this message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately, and delete the original message. - 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]
Strecks?
I saw this on TSS today: http://www.theserverside.com/news/thread.tss?thread_id=39840 Strecks, a set of open source extensions to the Struts framework aimed at Java 5 users, has been released. Strecks (which stands for Struts Extensions) is built on the existing Struts 1.2.x code base. Basically Struts + a whole lot of @annotation candy? Thoughts? -- The most beautiful thing we can experience is the mysterious. It is the source of all true art and science. - Albert Einstein - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Display Struts Configuration
Hello all, Last week I saw a blog which showed how to display information at the beginning of your JSP about Struts such as which action the request was mapped to, the form being used, and associated information like the request headers. I should have bookmarked it, but I didn't. I have checked my history, googled for it, etc., but cannot find it again. Does anyone know what I am talking about and/or can they post a link for this information? Or does anyone have something similar? Thanks for your help. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Display Struts Configuration
This is helpful, but not *exactly* what I am looking for. What I am looking for is used for debugging purposes during runtime. Anyone? Thanks again Don. Matt Don Brown wrote: I don't know if this is what you are looking for, but I've found it useful in the past: http://struts.sourceforge.net/strutsdoc/index.html Basically, it is Javadoc for Struts, Tiles, and stxx configuration. Struts Action 2 (and WebWork) has: - SiteGraph http://www.opensymphony.com/webwork/wikidocs/SiteGraph.html - Config Browser http://www.opensymphony.com/webwork/wikidocs/Config%20Browser.html If you have any other ideas of tools that would be useful, let us know. Don On 4/13/06, Matthew J. Vincent [EMAIL PROTECTED] wrote: Hello all, Last week I saw a blog which showed how to display information at the beginning of your JSP about Struts such as which action the request was mapped to, the form being used, and associated information like the request headers. I should have bookmarked it, but I didn't. I have checked my history, googled for it, etc., but cannot find it again. Does anyone know what I am talking about and/or can they post a link for this information? Or does anyone have something similar? Thanks for your help. Matt - 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: Display Struts Configuration
Wendy - This is excellent and very close to what I am looking for. The only thing missing from this is the *Struts* specific information such as which action the request was mapped to, the form being used, etc. Is there anyone who has this information or an idea of how to retrieve it? Thanks! Matt Wendy Smoak wrote: On 4/13/06, Matthew J. Vincent [EMAIL PROTECTED] wrote: This is helpful, but not *exactly* what I am looking for. What I am looking for is used for debugging purposes during runtime. Anyone? I keep 'debug.jsp' around, and include it at the bottom of my main (Tiles) layout during development. It uses JSTL and the implicit objects to print out everything in request/session/application scope. http://wiki.wsmoak.net/cgi-bin/wiki.pl?DebugJSP HTH, -- Wendy - 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: Display Struts Configuration
This is nice for config before the application is running, I want to know during runtime. Thanks! Matt [EMAIL PROTECTED] wrote: Maybe this is what you are referring to? http://marc.theaimsgroup.com/?l=struts-userm=114406604109454w=2 http://www.jamesholmes.com/struts/console/ http://exadel.com/web/portal/products/ExadelStudio http://www.m7.com/ -Dennis Matthew J. Vincent [EMAIL PROTECTED] 04/13/2006 10:38 AM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject Re: Display Struts Configuration This is helpful, but not *exactly* what I am looking for. What I am looking for is used for debugging purposes during runtime. Anyone? Thanks again Don. Matt Don Brown wrote: I don't know if this is what you are looking for, but I've found it useful in the past: http://struts.sourceforge.net/strutsdoc/index.html Basically, it is Javadoc for Struts, Tiles, and stxx configuration. Struts Action 2 (and WebWork) has: - SiteGraph http://www.opensymphony.com/webwork/wikidocs/SiteGraph.html - Config Browser http://www.opensymphony.com/webwork/wikidocs/Config%20Browser.html If you have any other ideas of tools that would be useful, let us know. Don On 4/13/06, Matthew J. Vincent [EMAIL PROTECTED] wrote: Hello all, Last week I saw a blog which showed how to display information at the beginning of your JSP about Struts such as which action the request was mapped to, the form being used, and associated information like the request headers. I should have bookmarked it, but I didn't. I have checked my history, googled for it, etc., but cannot find it again. Does anyone know what I am talking about and/or can they post a link for this information? Or does anyone have something similar? Thanks for your help. Matt - 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]
Re: [OT] Filter Help!
Hello everyone, If this is not the right place to post this could you please let me know where. I have searched the forums and Google and cannot find an answer. I have a Servlet filter that checks to see the content length of the request. long contentLength = request.getContentLength(); If contentLength is greater than some configurable size, I would like to stop the request and send back a response saying that the request is to large. This is being used for a file upload Everything is working, except it seems like the ENTIRE request (or file) is sent BEFORE my redirect is happening. My logs are showing the correct information at the appropriate times, but the entire request is being processed before I can send a request back. Is there a way to immediately cut off the request and return a response? Is there a better way to do this? Request Size Filter: REQUEST LENGTH=401458785 Request Size Filter: CONTENT TYPE=multipart/form-data; boundary=---85421569618919 Request Size Filter: REQUEST = /jaxpathwi/imageAction.do Request Size Filter: REFERER = http://deva2231:8080/jaxpathwi/imageAction.do?dispatch=setupmouseKey=1diagnosisKey=1 Request Size Filter: Request is to be filtered and checked for size Request Size Filter: REQUEST LENGTH [401458785] = ALLOWABLE CONTENT LENGTH [500] Request Size Filter: NOT Allowing request Request Size Filter: Redirecting to - http://deva2231.8080/jaxpathwi/imageAction.do?dispatch=setupmouseKey=1diagnosisKey=1 I have posted a modified version of my code to show you. Thanks! Matt code package filters; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; package filters; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class RequestSizeFilter implements Filter { public static final String REDIRECT = redirect; public static final String LENGTH = length; private FilterConfig filterConfig = null; private static boolean bInitialized = false; private String strRedirectURL = null; private long lContentLength = -1l; private boolean bRedirect = false; public void init(FilterConfig config) throws ServletException { this.filterConfig = config; ServletContext servletContext = filterConfig.getServletContext(); String strRedirect = filterConfig.getInitParameter(REDIRECT); String strLength = filterConfig.getInitParameter(LENGTH); if ((strLength != null) (strLength.length() 0)) { bInitialized = true; } // configure the redirect URL if ((strRedirect != null) (strRedirect.length() 0)) { strRedirectURL = new String(strRedirect); // configure redirect or forward bRedirect = strRedirect.startsWith(HTTP://) || strRedirect.startsWith(HTTPS://) || strRedirect.startsWith(http://;) || strRedirect.startsWith(https://;); } else { bRedirect = true; } // configure the content length try { lContentLength = Long.parseLong(strLength); } catch (NumberFormatException nfe) { bInitialized = false; nfe.printStackTrace(); } } public void destroy() { this.filterConfig = null; } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { long lRequestLength = request.getContentLength(); String strRequestURI = ((HttpServletRequest)request).getRequestURI(); String strReferer = ((HttpServletRequest)request).getHeader(Referer); log(REQUEST = + strRequestURI); log(REFERER = + strReferer); String strURL = strReferer; if ((strRedirectURL != null) (strRedirectURL.length() 0)) { strURL = strRedirectURL; } if (lRequestLength = lContentLength) { if(bRedirect) { HttpServletResponse httpResponse = (HttpServletResponse)response; httpResponse.sendRedirect(strURL); } else { RequestDispatcher dispatcher = filterConfig.getServletContext().getRequestDispatcher(strURL); dispatcher.forward(request, response); } } else { chain.doFilter(request, response); } } private void log(String strMessage) { if (strMessage != null) { StringBuffer sb = new StringBuffer(Request Size Filter: ); sb.append(strMessage); this.filterConfig.getServletContext().log(sb.toString()); System.out.println(sb.toString()); sb = null; } } } /code - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts EJB 3 tutorial
Actually, it's been my understanding that struts is pretty much a BYOM (Bring Your Own Model) kind of framework. Tutorials that show workable ways of abstracting out persistence to DAOs and such are always welcome to me. Like Ricks struts-spring-ibatis tutorial: http://www.learntechnology.net/struts-spring-ibatis.do for example. In fact I'd love to see stuff like this for hibernate, cayenne, ODB and all the rest of 'em in a centralized location. Planet Struts, perhaps? Leon Rosenberg wrote: Not Found The requested URL /download/first-ejb3-ant-tutorial-en.pdf was not found on this server. however, I don't have a clear understanding why should someone need an ejb3.0 struts tutorial? It's like offering a tutorial on driving and shopping. If you are able to do both of the actions standalone, you'd be able to combine it. If you misses the basic knowledge, you should first learn the basics, and then combine them. Learning both together will only suggest to the people that both things, which has nothing in common, except that they can be used together, belong together, and they are not. /2cents Leon On 3/17/06, Sebastian Hennebrueder [EMAIL PROTECTED] wrote: Hello, I have just finished a EJB 3 - Struts tutorial and put it on my website. It is available for free as HTML and PDF at http://www.laliluna.de/EJB-3-tutorials.html As far as I remember, I have not yet announced tutorials in this mailing list. The smart-questions site and your mailing list information did not explain if I am allowed to announce free tutorials. Please, contact me if this is not appreciated by the common sense and I will refrain from further anouncements. -- The most beautiful thing we can experience is the mysterious. It is the source of all true art and science. - Albert Einstein - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FRIDAY] Re: has struts reached the saturation
:0 * ^From: [EMAIL PROTECTED] /dev/null Dakota Jack wrote: Here is a JSF big gun. At least now we know what this surprising new committer who seems to know nothing about Struts does; he reads motivational books. On 3/19/06, Gary VanMatre [EMAIL PROTECTED] wrote: From: Alexandre Poitras [EMAIL PROTECTED] You keep saying Tapesty does what JSF wants to do better than JSF does it. I have looked into the two from a technical point of view and I prefered JSF. How about giving some technical arguments for once since you are complaing about logic fallacies? Is it because it isn't a standard? *I* think this is really an argument about moving the cheese (http://en.wikipedia.org/wiki/Who_Moved_My_Cheese). Gary -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Stay Ghetto : http://www.ghettojava.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Shale: UIDataTable to output delimited plain text.
Hi all, I'd like to have a tab (or comma) delimited text page outputed for a JSF request. When I click the link on the previous page, it asks me to save the tab delimited text file to my harddrive. I was thinking that I could extend the DataTable renderer, or something like that on a custom component. Is that the right path? Has someone done this yet? Perhaps someone could list the steps I'd need to take to extend an existing component - or point me to some doc-o's to that I could RT#M. Is there something in Shale that could help change the view type from html to text? Thanks, Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Shale] Property in ViewController Backing Bean is null
I think you may running into a simular problem that I ran into. I have the following scenario: page 1 has the user choose from a list of options. On page 2, the form saves the selected option of page 1 in a hidden field in its form. In addition the selected value from page 1 is used to populate a pull down on page 2. So the user hits the submit button on page 2 to save the changes and KA-BLAMMO, I get a NPE. What was happening was the JSF was attempting to Validate the pulldown values in the Validation phase. This was before any of the hidden fields were set. So because the hidden fields weren't set, the retrieve of the pulldown was failing. I saw 1 of 2 solutions: 1) Turn off the validation of the pulldown. Because, hey... why would I need to validate a pulldown? - it isn't like a user can mistype something. OR 2) somehow get the hidden fields to be set before any retrieval of the pulldown is made. The JSF mailing list from Sun gave no help for turning off the validator for the pulldown. So I had to do the following, for which I give myself a big Capital H for HACK. In the contructor of the backing bean, I grabbed the request parameters myself and called the setters from there for the values that were needed to get through the validation of the pulldown. Perhaps someone here can help turn off the need to retrieve the pulldown values in the validation phase. I hope this will help your situation, as well. Cheers, Jason On 2/14/06, Gary VanMatre [EMAIL PROTECTED] wrote: From: Peter Goetz [EMAIL PROTECTED] Hi again, I tried the whole weekend, but I didn't get any results other than those mentioned in the email below. Shall I send some code to illustrate the problem or is it really so unusual, what I'm trying to do? Make sure that you have a navigation rule setup to handle the immediate command button. Try adding a rule that directs you to the target viewid (sounds like the page you are submitting from). If you don't have a navigation case, I think the veiw is just restored using the submitted values. navigation-rule from-view-id/somepage.jsp/from-view-id navigation-case from-outcomeedit/from-outcome to-view-id/somepage.jsp/to-view-id /navigation-case /navigation-rule Thanks a lot for any help! Peter Gary - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Shale: postRender method?
Hi All, I was wondering if there is an easy way to get a postRender method to be called in my Shale ViewController. Is a new Phase Listener the only / best option? Perhaps I can extend a Shale class to also call a postRender method? Here is my scenario: I have the concept of an ErrorEventCollector in the ViewController. Basically, the collector is passed around in the model calls to capture errors during the model execution. This might include errors caused by validation checks on the retrieved data from the DB, as well as any exceptions. These events can be generated in any phase - init, validation, application, or render. In my BaseViewController - I want to have the event collector checked for any events. If there are events in the collector, then I want to create FacesMessages for each event. I tried putting the check in the Shale destroy method, but the messages weren't being displayed by the JSP. So It seems I need to have this check as the last step in the render_response phase. Thanks for any help. Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Shale: postRender method?
Hmm... I guess a phase listener wouldn't work for me. From what you say, it appears that the outcome of the phase is already determined before the afterPhase listener is triggered. Is there a another place for me to plug into the steps taken during a phase, that is, before the final steps in the phase are completed? Or at least, I just need the FacesMessages to not get processed until the last step of the render phase. Thanks, Jason On 2/14/06, Craig McClanahan [EMAIL PROTECTED] wrote: On 2/14/06, Jason Vincent [EMAIL PROTECTED] wrote: Hi All, I was wondering if there is an easy way to get a postRender method to be called in my Shale ViewController. Is a new Phase Listener the only / best option? Perhaps I can extend a Shale class to also call a postRender method? Doesn't the destroy() method do what you want? It is called after rendering. Here is my scenario: I have the concept of an ErrorEventCollector in the ViewController. Basically, the collector is passed around in the model calls to capture errors during the model execution. This might include errors caused by validation checks on the retrieved data from the DB, as well as any exceptions. These events can be generated in any phase - init, validation, application, or render. In my BaseViewController - I want to have the event collector checked for any events. If there are events in the collector, then I want to create FacesMessages for each event. I tried putting the check in the Shale destroy method, but the messages weren't being displayed by the JSP. So It seems I need to have this check as the last step in the render_response phase. Hmm ... destroy() *is* called by an afterPhase listener for the Render Response phase, so something else must be going on here. Note, of course, that any messages you *add* in the destroy() method will, of course, not be rendered -- precisely because rendering *has* ben completed. Craig Thanks for any help. Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Shale: postRender method?
ok... I got it to show the messages... I did what you suggested and moved the h:messages to the end of my page - THANKS! But the method to convert my ErrorEvents into FacesMessages still needed to be called. So I made it return true and set it as the render attribute for the messages tag. AHHH! It worked, but ew. :) I could change my design so that the FacesMessages are created immediately when the events are added to the collecor. That would eliminate the need for the render attribute. BUT, I'll need to beg for forgiveness from my UI designers when I tell them that the h:messages tag MUST be at the end of the page. I guess the original intent of the FacesMessages was to be used during the Validation phase. Hmmm. Is it a sign of mis-use of the JSF framework if my getter methods in the render phase can produce FacesMessages? HMMM Perhaps I could override/extend the responseComplete method to do my custom stuff first, and then call super.responseComplete??? Is this a good approach or even possible or even the right method to override? It seems like a path to the dark side. Thanks for the help. Jason On 2/14/06, Craig McClanahan [EMAIL PROTECTED] wrote: On 2/14/06, Jason Vincent [EMAIL PROTECTED] wrote: Hmm... I guess a phase listener wouldn't work for me. From what you say, it appears that the outcome of the phase is already determined before the afterPhase listener is triggered. Is there a another place for me to plug into the steps taken during a phase, that is, before the final steps in the phase are completed? I don't see how that would really help you ... what you seem to be needing is that the messages get generated before the h:messages component itself is rendered. Or at least, I just need the FacesMessages to not get processed until the last step of the render phase. Put your h:messages component last??? Thanks, Jason Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Shale] a command btn within a conditionally rendered form not getting actionListener.
hmm... ok I tried your suggestion, but it still no worky. I even just had the action=home and that didn't work either, instead of evaluating some expression to call. It is my understanding that the only difference between actionListener and action is that an action call will make use of the navigation mapping, while the actionListener will just go back to the requesting view. Could the rendered attribute be throwing something off? Is there a way for me to see the phases that the JSF lifecycle is going through? Perhaps that can point to the problem area. The scopes of all my objects are request, and the Faces Context is stored on the Server. Thanks a bunch, Jason On 2/6/06, Emily Gu (egu) [EMAIL PROTECTED] wrote: Don't use actionListener but just simply use action. All you want should be working as expected. h:commandButton action=#{pulldownTest.handleChangeItem} value=Submit/ public String handleChangeItem() { LOGGER.debug(handleChangeItem()); return success; } Emily -Original Message- From: Jason Vincent [mailto:[EMAIL PROTECTED] Sent: Monday, February 06, 2006 4:14 PM To: Struts Users Mailing List Subject: Re: [Shale] a command btn within a conditionally rendered form not getting actionListener. I put the messages tag in there, but I'm getting nothing from that tag. I've witnessed JSF swallowing exceptions before. Is there a way to get JSF to log the stacktraces to my logger? I've really simplified my test case and I'm still seeing the problem. I have a pull down at the top with a submit btn. When the submit button is clicked, it called the actionListener as expected. The page is rerendered with the second part of the page showing the item selected with another button. When the 2nd button is clicked, no actionListener is called. Here is the sample code: public class PulldownTest { private static final Log LOGGER = LogFactory.getLog(PulldownTest.class); private String selectedFilterValue; public SelectItem[] getFilterPulldown() { SelectItem[] items = new SelectItem[3]; items[0] = new SelectItem(,); items[1] = new SelectItem(1,1); items[2] = new SelectItem(2,2); return items; } public String getSelectedFilterValue() { return selectedFilterValue; } public void setSelectedFilterValue(String selectedFilterValue) { this.selectedFilterValue = selectedFilterValue; } public boolean isItemSelected() { boolean isItemSelected = null != selectedFilterValue !.equals(selectedFilterValue); LOGGER.debug(isItemSelected=+isItemSelected); return isItemSelected; } public void handleSelectItem(ActionEvent event) { LOGGER.debug(handleSelectItem()); } public void handleChangeItem(ActionEvent event) { LOGGER.debug(handleChangeItem()); } } Here is the JSP: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; %@ page contentType=text/html;charset=UTF-8 language=java % %@ taglib prefix=f uri=http://java.sun.com/jsf/core; % %@ taglib prefix=h uri=http://java.sun.com/jsf/html; % f:loadBundle var=messages basename=Messages/ META HTTP-EQUIV=Pragma CONTENT=no-cache/ META HTTP-EQUIV=Expires CONTENT=-1/ f:view html xmlns=http://www.w3.org/1999/xhtml; body h:form h:messages/ h:outputText value=Choose Item:/ h:selectOneMenu id=spPlat value=#{pulldownTest.selectedFilterValue} f:selectItems value=#{pulldownTest.filterPulldown}/ /h:selectOneMenu h:commandButton actionListener=#{pulldownTest.handleSelectItem} value=Submit/ h:panelGrid columns=1 rendered=#{pulldownTest.itemSelected} h:outputText value=Item Selected = #{pulldownTest.selectedFilterValue}/ h:commandButton actionListener=#{pulldownTest.handleChangeItem} value=Submit/ /h:panelGrid /h:form /body /html /f:view Any futher help is greatly appreciated. Jason On 2/5/06, Craig McClanahan [EMAIL PROTECTED] wrote: On 2/5/06, Jason Vincent [EMAIL PROTECTED] wrote: Hi all, For some reason a cmd btn of mine isn't calling its actionListener method when it is clicked. Here is the situation. I have a pull down at the top of my page which chooses the item that I want to edit below. I hit the submit button next to the pulldown, and the second half of the page is rendered. I used the rendered attribute on the table containing the rest of the form. So when I change a few items in the second half, I hit an update submit button to save the changes and POOF... nothing - the page just refreshes. the actionListener is never called. Infact no action or action listener
Re: [Shale] a command btn within a conditionally rendered form not getting actionListener.
I have discovered something: Instead of using the rendered attribute on the table, I put a c:if around it and it called the actionEvent as expected. What the heck! I'd prefer not to mix JSTL with JSF, so I'd like to hear what is going on here. It seems to me, if I was able to click the button, it should call the event. Why does it need to check the rendered flag again? That is, it should process the input data for the state in which it was rendered, before using data dealing with how it is viewed. Here are the logs generated from clicking the second button: PulldownTestVC - isItemSelected=false PulldownTestVC - isItemSelected=false PulldownTestVC - setSelectedFilterValue()2 PulldownTestVC - isItemSelected=true PulldownTestVC - isItemSelected=true PulldownTestVC - isItemSelected=true PulldownTestVC - isItemSelected=true PulldownTestVC - isItemSelected=true PulldownTestVC - isItemSelected=true PulldownTestVC - isItemSelected=true PulldownTestVC - isItemSelected=true my guess is that one of the first two calls is the check for the commandButton. I haven't gotten to the PhaseListener yet, but I'll give it a shot. Just out of curiousity, is there a particular reason you want to use an actionListener instead of an action? The latter is generally easier to deal with. I choose actionListener because I read that the actions was ment for navigational events. In my case, I'm just updating data on the same screen. It seemed like the right choice, for the time being. What I didn't really get is why not also have the action methods take a ActionEvent parameter. It seems like a useful parameter - as different buttons could, in theory (not that I'd do it), call the same listener, and then you can switch on which event was received - not unlike the execute method of Struts-Action. Cheers, Jason On 2/6/06, Craig McClanahan [EMAIL PROTECTED] wrote: On 2/6/06, Jason Vincent [EMAIL PROTECTED] wrote: hmm... ok I tried your suggestion, but it still no worky. I even just had the action=home and that didn't work either, instead of evaluating some expression to call. It is my understanding that the only difference between actionListener and action is that an action call will make use of the navigation mapping, while the actionListener will just go back to the requesting view. The action listener also receives an ActionEvent, but you're correct that it cannot feed an outcome directly into the navigation system. You can, however, fake it by doing something like this: NavigationHandler nh = context.getApplication().getNavigationHandler(); String outcome = ...; // Some outcome string to pretend occurred String action = #{...}; // Some action to pretend was called (this would // normally be the expression for the action attribute nh.handleNavigation(context, action, outcome); context.renderResponse(); Could the rendered attribute be throwing something off? If the button is not rendered (rendered=false) then it won't be able to fire any actions, but that doesn't appear to be the case in your sample code. Just out of curiousity, is there a particular reason you want to use an actionListener instead of an action? The latter is generally easier to deal with. Is there a way for me to see the phases that the JSF lifecycle is going through? Perhaps that can point to the problem area. One way would be to create a simple phase listener class that listens to all phases, and logs the before and after events: public class DebugPhaseListener implements PhaseListener { public static final Log LOGGER = LogFactory.getLog(DebugPhaseListener.class); public PhaseId getPhaseId() { return PhaseId.ANY_PHASE; } public void beforePhase(PhaseEvent event) { LOGGER.debug(beforePhase( + event.getPhaseId() + )); } public void afterPhase(PhaseEvent event) { LOGGER.debug(afterPhase( + event.getPhaseId() + )); } } Register this in a faces-config.xml file like this: lifecycle phase-listenercom.mycompany.mypackage.DebugPhaseListener /phase-listener /lifecycle The clue you are looking for is if Invoke Application is reached. That's where actions are invoked (assuming immediate is not set). If that phase is being skipped, it'll likely be: * A validation error * An exception during update model values * Some other code that called FacesContext.renderResponse() to proceed directly to the rendering phase Craig The scopes of all my objects are request, and the Faces Context is stored on the Server. Thanks a bunch, Jason On 2/6/06, Emily Gu (egu) [EMAIL PROTECTED] wrote: Don't use actionListener but just simply use action. All you want should be working as expected. h:commandButton action=#{pulldownTest.handleChangeItem} value=Submit
[Shale] a command btn within a conditionally rendered form not getting actionListener.
Hi all, For some reason a cmd btn of mine isn't calling its actionListener method when it is clicked. Here is the situation. I have a pull down at the top of my page which chooses the item that I want to edit below. I hit the submit button next to the pulldown, and the second half of the page is rendered. I used the rendered attribute on the table containing the rest of the form. So when I change a few items in the second half, I hit an update submit button to save the changes and POOF... nothing - the page just refreshes. the actionListener is never called. Infact no action or action listener. Why isn't the action listener called? I've also tried having two forms on the page, where the second form had a hidden field of the selected item of the first form. This would help the situation where the user changes the selected item in the filter form, but also has made changes to the previously viewed item. I'd want to make sure the changes goto the right item. When I tried this, for some reason the getter methods to retrieve the items data was called before the set method for the hidden field was called which gave me NPE's since the item to get the data from hadn't been loaded yet - which is what the set method of the hidden field would have done. Is there a way to control the ordering of which UI objects are processed first? I tried the immediate attribute of the hidden field to get that to go first, but it did nothing. BTW, for the 2 form scenario, when I got the NPE's I would hit the back button to go back to the form, it is then that I would notice that it would call my update Information eventListener method. arg. What is going on here? Thanks, Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [shale] subview not talking to a backing bean
Thanks for the response. The header.jsp does indeed have the page directive at the top. %@ page contentType=text/html;charset=UTF-8 language=java % %@ include file=include.jsp % the include.jsp has the taglib includes in it. There are other items in the header.jsp that are using the JSF-EL to access attributes in the session that are rendering fine, so I know the JSP is getting rendered as a jsp. h. for your other suggestion, using the include directive would may not work for me as the header file is included by other jsps that are in different levels of directories. I had chossen to do the jsp:include over the directive, because of previous relative urls in the header, that are now gone. I'll give it a shot - but I'd prefer to figure out why the jsp:include isn't working as expected. I think my issue is that the backing bean isn't getting instantiated on the request for the subview. Is there some rule about how subviews can't talk to different backing beans? Perhaps Shale is doing something to the request? Any further ideas? Jason On 1/31/06, Gary VanMatre [EMAIL PROTECTED] wrote: From: Jason Vincent [EMAIL PROTECTED] Hey there, I have a header.jsp file that is included in all my jsps: or if the including jsp was in a subdirectory... inside the header.jsp I'm trying to call a request scope backing bean to call a method to dynamically build some javascript. Here is my managed bean definition: header com.prenet.cpt.presentation.Header request The problem is that the header.isAdmin() method is not being called. And futhermore the default constructor for the Header.java class isn't being called. the Header class is not a ViewController as it doesn't match the url-to-bean mapping for whatever page I'm on. What could be going on here? Is there something speacial that has to be done in a subview? It doesn't sound like the target page is defined as a JSP page. Since you are using a jsp include, the target page needs to have the jsp page directive at the top of the file. If you are using the older style it would look like this: [EMAIL PROTECTED] contentType=text/html;charset=UTF-8% %@ taglib prefix=f uri=http://java.sun.com/jsf/core; % %@ taglib prefix=h uri=http://java.sun.com/jsf/html; % %@ taglib prefix=s uri=http://struts.apache.org/shale/core; % You could try using the include directive which will merge the pages into one unit. [EMAIL PROTECTED] file=header.jsp% Thanks, Jason Gary - 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: [shale] subview not talking to a backing bean
Again... thanks for the quick replies... I found a fix to my problem. Apparently header is a reserved word and cannot be used as the name of the managed bean. Originally this was my bean definition: managed-bean managed-bean-nameheader/managed-bean-name managed-bean-classcom.prenet.cpt.presentation.Header/managed-bean-class managed-bean-scoperequest/managed-bean-scope /managed-bean When I renamed it to header123... managed-bean managed-bean-nameheader123/managed-bean-name managed-bean-classcom.prenet.cpt.presentation.Header/managed-bean-class managed-bean-scoperequest/managed-bean-scope /managed-bean Things all started working. Sheesh! I wish JSF would have complained more loudly about the misconfiguration. Thanks, Jason On 2/1/06, Gary VanMatre [EMAIL PROTECTED] wrote: From: Jason Vincent [EMAIL PROTECTED] Thanks for the response. The header.jsp does indeed have the page directive at the top. the include.jsp has the taglib includes in it. There are other items in the header.jsp that are using the JSF-EL to access attributes in the session that are rendering fine, so I know the JSP is getting rendered as a jsp. h. for your other suggestion, using the include directive would may not work for me as the header file is included by other jsps that are in different levels of directories. I had chossen to do the jsp:include over the directive, because of previous relative urls in the header, that are now gone. I'll give it a shot - but I'd prefer to figure out why the jsp:include isn't working as expected. Oh, I didn't know what level you were on. I was hoping it was something simple. I think my issue is that the backing bean isn't getting instantiated on the request for the subview. Is there some rule about how subviews can't talk to different backing beans? Perhaps Shale is doing something to the request? There is no restriction on the number of backing beans for a view/subview. I don't think that Shale has anything to do with this issue and I suspect that if you removed Shale you would still have the same issue. You should be seeing an exception if JSF can't find the managed bean. That's why I asked about the quality of the JSP you are dynamically including. Is here a parent JSP tag that is not visible, rendered=false? If a parent tag is not visible, the children will not be renderered and your callback won't be invoked. Gary Any further ideas? Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[shale] subview not talking to a backing bean
Hey there, I have a header.jsp file that is included in all my jsps: f:subview id=header_include jsp:include page=header.jsp/ /f:subview or if the including jsp was in a subdirectory... f:subview id=header_include jsp:include page=../header.jsp/ /f:subview inside the header.jsp I'm trying to call a request scope backing bean to call a method to dynamically build some javascript. script type=text/javascript h:outputText rendered=#{header.admin} var showAdmin = true; /h:outputText /script Here is my managed bean definition: managed-bean managed-bean-nameheader/managed-bean-name managed-bean-classcom.prenet.cpt.presentation.Header/managed-bean-class managed-bean-scoperequest/managed-bean-scope /managed-bean The problem is that the header.isAdmin() method is not being called. And futhermore the default constructor for the Header.java class isn't being called.the Header class is not a ViewController as it doesn't match the url-to-bean mapping for whatever page I'm on. What could be going on here? Is there something speacial that has to be done in a subview? Thanks, Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Shale: not calling prerender or preprocess, and Navigation issue
Hey there, I've got some unexpected navigation stuff going on, that I was hoping someone can help explain. Here is my use-case: 1) Home page is requested. 2) user isn't logged in, so redirect to login url. 3) after login, navigate to home. In my logs, I'm seeing this behavior, which is wierd... This is just the initial request to the home page, I didn't hit the login button, just yet. HomeVC.init(), requestURI=/cpt/home.jsf HomeVC.prerender(), requestURI=/cpt/home.jsf BaseViewController - /cpt/home.jsf is a secure url and not logged in, redirecting to login: /login/login.jsf HomeVC.destroy(), requestURI=/cpt/home.jsf HomeVC.init(), requestURI=/cpt/home.jsf HomeVC.prerender(), requestURI=/cpt/home.jsf BaseViewController - /cpt/home.jsf is a secure url and not logged in, redirecting to login: /login/login.jsf HomeVC.destroy(), requestURI=/cpt/home.jsf The init,prerender,destroy are not called for LoginVC - Why not? The wierd part is that the browser behavior is working as expected - up to a point. Once I hit the login button, the user is logged in, but the navigation rule in faces-config, isn't sending the browser to the home url. Another interesting thing... after the login form is displayed, and I Manually enter the login URL - the init,prerender, and destroy methods are not called by ANY ViewController. PS... I do have no-cache meta tags in the jsps, and I also set the headers in my baseViewControler.prerender method - so at least the browser shouldn't be caching anything. Can anyone explain what is going on? Any help is appreciated. Thanks, Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Shale redirect to login page for secured pages
Hi there, I'd like to setup this usecase, in Shale/JSF... 1) user requests a url that is configured as secured. 2) system checks for logged in user. 3) if the user is not logged in, then redirect to the login page. 4) on successfull login, redirect to orginally requested URL. currently I just have a index.jsp that forwards to home.jsf. In my faces-config, I have !--home navigation rule-- navigation-rule from-view-id*/from-view-id navigation-case from-action#{login.checkAuthenticated}/from-action from-outcomeunauthenticated/from-outcome to-view-id/login/login.jsf/to-view-id /navigation-case navigation-case from-action#{login.checkAuthenticated}/from-action from-outcomeauthenticated/from-outcome to-view-id/home.jsf/to-view-id /navigation-case /navigation-rule the checkAuthenticated method isn't even being called when the home.jsf page is called. anybody know what I'm missing?
Re: Where to search on old messages?
Because I'm anal today: http://marc.theaimsgroup.com/?l=struts-userr=1w=2 Michael Jouravlev wrote: How about googling for: 'struts mailing (list OR lists) archive' before posting? ;-) I personally like MARC: Mailing list ARChives, marc.theaimsgroup.com -- The most beautiful thing we can experience is the mysterious. It is the source of all true art and science. - Albert Einstein - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: nested c:forEach and html-el:link
I have removed struts-el.jar, replaced jstl.jar and standard.jar with those from jakarta-taglibs-standard-1.1.2 and replaced the html-el:link tag with the html:link one. That does not make a difference, html:link does not find the bean either. Best regards Vincent -Original Message- From: Karr, David [mailto:[EMAIL PROTECTED] Sent: jeudi 8 septembre 2005 15:49 To: Struts Users Mailing List Subject: RE: nested c:forEach and html-el:link If you're using Tomcat 5, a JSP 2.0 container, you shouldn't use Struts-EL. Just use the plain Struts jar, and make sure your web.xml uses the Servlet 2.4 schema. -Original Message- From: Lombart Vincent (DBB) [mailto:[EMAIL PROTECTED] Does anybody know why the following JSP code does not work: table border=1 cellspacing=0 tbody c:forEach items=${monitorBean.rows} var=irow tr c:forEach items=${irow.columns} var=icol tdhtml-el:link action=monitor paramId=monitorName paramName=icol c:out value=${icol}//html-el:link/td /c:forEach /tr /c:forEach /tbody /table monitorBean contains rows, and each row contains columns (of type String). The JSP code should build a table from this bean, displaying one String in each cell, with a hyperlink of the type .../monitor.do?monitorName=xxx. However, I get the error: 2005-09-08 11:54:47,082 ERROR InsertTag - ServletException in '/WEB-INF/jsp/multimonitor.jsp': Cannot find bean icol in any scope javax.servlet.ServletException: Cannot find bean icol in any scope at org.apache.jasper.runtime.PageContextImpl.doHandlePageExceptio n(PageContextImpl.java:825) at org.apache.jasper.runtime.PageContextImpl.handlePageException( PageContextImpl.java:758) at org.apache.jsp.WEB_002dINF.jsp.multimonitor_jsp._jspService(mu ltimonitor_jsp.java:83) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) ... I have tried to modify icol to be a bean with a String property rather than a simple String, but it does not work either. If I remove the html-el:link part, everything works perfectly, i.e. c:out is able to find icol. I have put some code before the html-el:link that shows that icol is defined in page scope. I have used html-el:link ... paramName=irow and it finds irow, although irow is defined just like icol. I am using Tomcat 5.0.25 and Struts 1.2.7 with the included struts-el.jar. Thanks in advance to anybody who can give me an answer... Best regards -- Dexia Bank disclaimer : http://www.dexia.be/maildisclaimer.htm -- - 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] -- Dexia Bank disclaimer : http://www.dexia.be/maildisclaimer.htm -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
nested c:forEach and html-el:link
Dear all, Does anybody know why the following JSP code does not work: table border=1 cellspacing=0 tbody c:forEach items=${monitorBean.rows} var=irow tr c:forEach items=${irow.columns} var=icol tdhtml-el:link action=monitor paramId=monitorName paramName=icol c:out value=${icol}//html-el:link/td /c:forEach /tr /c:forEach /tbody /table monitorBean contains rows, and each row contains columns (of type String). The JSP code should build a table from this bean, displaying one String in each cell, with a hyperlink of the type .../monitor.do?monitorName=xxx. However, I get the error: 2005-09-08 11:54:47,082 ERROR InsertTag - ServletException in '/WEB-INF/jsp/multimonitor.jsp': Cannot find bean icol in any scope javax.servlet.ServletException: Cannot find bean icol in any scope at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825) at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758) at org.apache.jsp.WEB_002dINF.jsp.multimonitor_jsp._jspService(multimonitor_jsp.java:83) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) ... I have tried to modify icol to be a bean with a String property rather than a simple String, but it does not work either. If I remove the html-el:link part, everything works perfectly, i.e. c:out is able to find icol. I have put some code before the html-el:link that shows that icol is defined in page scope. I have used html-el:link ... paramName=irow and it finds irow, although irow is defined just like icol. I am using Tomcat 5.0.25 and Struts 1.2.7 with the included struts-el.jar. Thanks in advance to anybody who can give me an answer... Best regards -- Dexia Bank disclaimer : http://www.dexia.be/maildisclaimer.htm -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: nested c:forEach and html-el:link
That's the kind of solution I was looking at, although using c:url with included c:param might be more robust. But I would prefer to use the action name rather than the direct url. Regards Vincent -Original Message- From: Brandon Mercer [mailto:[EMAIL PROTECTED] Sent: jeudi 8 septembre 2005 15:35 To: Struts Users Mailing List Subject: Re: nested c:forEach and html-el:link Lombart Vincent (DBB) wrote: Dear all, Does anybody know why the following JSP code does not work: table border=1 cellspacing=0 tbody c:forEach items=${monitorBean.rows} var=irow tr c:forEach items=${irow.columns} var=icol tdhtml-el:link action=monitor paramId=monitorName paramName=icol c:out value=${icol}//html-el:link/td /c:forEach /tr /c:forEach /tbody /table table border=1 cellspacing=0 tbody c:forEach items=${monitorBean.rows} var=irow tr c:forEach items=${irow.columns} var=icol tda href=monitor.do?monitorName=${icol.monitor}${icol.monitor}/a/td /c:forEach /tr /c:forEach /tbody /table What about something more like that?? Brandon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Dexia Bank disclaimer : http://www.dexia.be/maildisclaimer.htm -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cannot retrieve definition for form bean null disaster
Shouldn't it be? : action path=/Survey ---name=surveyForm --- forward=/pages/Survey.jsp/ Gareth Meyrick wrote: hi, i'm at a loss.. i've verified the usual suspects, checked the usual places, but still can't find an answer. background: /Login - /LoginSubmit - /Survey - /SurveySubmit from struts-config.xml (IMHO unrelelated stuff elided): form-beans form-bean name=surveyForm type=com.w3elements.form.SurveyForm/ /form-beans global-forwards forward name=survey path=/Survey.do/ /global-forwards action-mappings action path=/Survey forward=/pages/Survey.jsp/ /action-mappings the first time everything works. the next time tomcat bails with: snip - Root Cause - javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null on action /Survey /snip and won't work again unless you restart tomcat. well.. it's just a forward hiding a JSP. Survey.jsp contains a form that forwards to /SurveySubmit (which _is_ associated with a form bean.. yup.. also works the first time). software: tomcat 5.0.19 struts 1.2.6 i'm probably doing something incredibly stupid.. any comments or suggestions appreciated. TIA -gm - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- The most beautiful thing we can experience is the mysterious. It is the source of all true art and science. - Albert Einstein - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using struts forms as Value Objects: your opinion?
Hi, I'm currently designing and developping an enterprise J2EE application based on Struts. In this application there's a layer of Data Access Object which abstract the underlying persistent storage. For populating my struts' *Form I've imagined first a transfert between forms and DAO based on Value Object, associated with helper classes for translating from one type to another. And I realized that struts Form can be in some situations quite good transfert objects, and by doing so we economize development of both helper classes and VO classes. What do you thing about using forms as VO? Do you think it's a dirty solution? Forms are often mirrors of the database's table. Thank you for your opinion. Vincent. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:errors does not display
Hi, Does simple html:errors/ with no property specified works for you ? Cause I get a similar problem - using same Java code in JSP display the fields with errors, but html:errors/ does nothing. Thanks. Vincent. Song Wang wrote: Hello everyone, I cannot display html:errors property=blah/, but if I add % ActionErrors ae = ( ActionErrors) request.getAttribute( Action.ERROR_KEY); boolean err = false; if( ae != null) { Iterator iter = ae.properties(); while(iter.hasNext()){ System.out.println((String)iter.next()); } } % I can see that blah is printed out. That being said, the errors does hold the value. Does anyone know where I should configure? Or how to check if the value is an empty string? I'm using WSAD 5.1. Thanks. Song - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Can't get html:errors/ working
Hello, I'm trying to get working html:errors/ tag but I fail in this task... The webapp has the following files: - LoginAction.java (extend Action) - LoginForm.java (extend ActionForm) - Login.jsp Here an extract of the struts-config.xml: form-beans form-bean name=loginForm type=app.LoginForm / /form-beans action-mappings action path=/login type=app.LoginAction name=loginForm scope=session validate=false forward name=Success path=/jsp/Main.jsp / forward name=Failure path=/jsp/Login.jsp / /action /action-mappings First the flow branches on the login.do action, which forward to Login.jsp (through 'Failure' forward). The form appears. After validation we fall in LoginAction.execute(), this method does a validate() on the form transmitted (a LoginForm). If validate() returns a not empty list of ActionError encapsulated in an ActionMessages, we save these errors with this.saveErrors(request, errors) (errors is the return of validate()), and we forward to Login.jsp, through 'Failure' forward. In Login.jsp, there's a html:errors/ tag, but even if 'errors' is not empty, this tag does nothing, however errors is really not empty because I can get its content with little java code in the JSP. I don't understand what is wrong. It's like html:errors/ was ignored. Container is Tomcat 5.5.9, struts is 1.2.7. Thanks in advance for help. Vincent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NestedLazy Validation: fixed
Once again, Niall Thank You. Niall Pemberton wrote: Are you using the indexedListProperty in your validation.xml? field property=myProperty indexedListProperty=nestedForm depends=... /field Niall - Original Message - From: Vincent [EMAIL PROTECTED] Sent: Wednesday, May 11, 2005 8:10 PM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Plato is my friend, Aristotle is my friend, but my greatest friend is truth. - Isaac Newton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [POLL] What do you use action forms for?
#4 Same form for input and output Vincent -- Plato is my friend, Aristotle is my friend, but my greatest friend is truth. - Isaac Newton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validating LazyValidatorForm
took the leading / in validation.xml. Works like a charm now. Thanks! Niall Pemberton wrote: If you use setPathValidation(true) it uses a key of the path name - with the leading / stripped off. Either you need to specify the form name in your validation.xml without the leading / - or in your custom class override the getValidationKey() method (rather than using the setPathValidation() method): public String getValidationKey(ActionMapping mapping, HttpServletRequest request) { return mapping.getPath(); } Niall - Original Message - From: Vincent [EMAIL PROTECTED] Sent: Tuesday, May 10, 2005 5:47 PM Hello All, As the subject says I am having some trouble trying to validate a LazyValidatorForm. Using the great examples on the LazyValidatorForm page I created a custom class with the required: setPathValidation(true) in the constructor. The Action path calling the form is /AddBoxAction and validation= true the following is from validation.xml: form name=/AddBoxAction field property=howManyNewBoxes depends=required msg key=errors.required name=required/ /field /form The above is just the latest iteration, nothing I try seems to have any effect at all on what I type in this text field. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Plato is my friend, Aristotle is my friend, but my greatest friend is truth. - Isaac Newton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Local struts developer in MD/DC/VA area?
Hello, Don't want to spam the list with job postings but... if you are in the DC Metropolitan area and are looking for a job working with struts based webapp, please email me or IM me at xaymaca2020 (AIM,MSN). Back to regularly scheduled broadcast. Thanks, Vincent -- Plato is my friend, Aristotle is my friend, but my greatest friend is truth. - Isaac Newton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
lazyBean and nested:checkbox
I was just looking at the LazyValidatorForm page. Great addition to the struts project IMO. Quick question, to use them in nested situations (I saw the NestedLazyBean example) , does one still have to implement a reset() method to reset checkboxes to false? -- Plato is my friend, Aristotle is my friend, but my greatest friend is truth. - Isaac Newton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Taglib error in SUN One Java Server version 8, PLS HELP!!!
When i deploy my application to the newly download Sun One Java System Server Platform Edition version 8, i got this error when i trying to call the first JSP page to display. The application has been running well in JBOSS Server. ANy help will be much appreciate, tq. The Error i got from the Log as follows: DetailsTimestamp: Feb 18, 2005 10:10:06.896 Log Level: SEVERE Logger: javax.enterprise.system.container.web Name-Value Pairs: _ThreadID=18; Record Number: 10067 Message ID: ApplicationDispatcher[/eApps] Servlet.service() for servlet com.ilium.jspc.invMainLayout_jsp threw exception java.lang.NullPointerException at org.apache.jasper.runtime.TagHandlerPool.get(TagHandlerPool.java Complete Message 113)at com.ilium.jspc.invMainLayout_jsp._jspService(Unknown Source) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105) at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324)at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257) at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55) at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:482) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:417) at org.apache.catalina.core.ApplicationDispatcher.access$000(ApplicationDispatcher.java:80) at org.apache.catalina.core.ApplicationDispatcher$PrivilegedForward.run(ApplicationDispatcher.java:95) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1058) at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:269) at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:249) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:303) at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)atorg.apache.struts.action.ActionServlet.process(ActionServlet.java:1420) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:502)at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324)at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257) at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55) at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at com.ilium.eapps.syswar.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:152) at
Re: struts 1.2.4 + tomcat 5.5.7 difficulties
Thanks for the info, I am not running Forrest but it could very well be a problem with the parser. I'll continue pursuing the issue with the tomcat developers. Thanks [EMAIL PROTECTED] wrote: The tlds are not in struts.jar, check the Struts distribution, it is there, but I don't remember where it is :-P Anyway I had a similar problem when I used Apache Forrest as a webapp under the same Tomcat instance, it seems that Forrest changes the default XML parser, so that Struts TLDs are not parsed correctly, generating this error. If you have Forrest installed in that Tomcat instance, undeploy it and restart Tomcat. I don't know if it helps you. Ciao Antonio Petrelli Vincent wrote: Hello All, Not sure if this is a tomcat issue or a struts one. After migrating from tomcat 5.0.30 to version 5.5.7 I get this error from my webapp when I try to do . I tried to break it up to make it more readable: WARN http-8080-Processor25 org.apache.catalina.authenticator.FormAuthenticator - Unexpected error forwarding to login page org.apache.jasper.JasperException: Unable to read TLD META-INF/tlds/struts-tiles.tld from JAR file file:/usr/local/tomcat/work/Catalina/localhost/_/WEB-INF/lib/struts.jar: org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.tiles.UseAttributeTei Can someone tell which jar file contains org.apache.struts.taglib.tiles.UseAttributeTei? because I don't see it when I unjar struts.jar Again this is struts 1.2.4 and tomcat 5.5.7 (configured for jdk 1.4.2) Thanks, Vinny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Plato is my friend, Aristotle is my friend, but my greatest friend is truth. - Isaac Newton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts 1.2.4 + tomcat 5.5.7 difficulties
Hello All, Not sure if this is a tomcat issue or a struts one. After migrating from tomcat 5.0.30 to version 5.5.7 I get this error from my webapp when I try to do . I tried to break it up to make it more readable: WARN http-8080-Processor25 org.apache.catalina.authenticator.FormAuthenticator - Unexpected error forwarding to login page org.apache.jasper.JasperException: Unable to read TLD META-INF/tlds/struts-tiles.tld from JAR file file:/usr/local/tomcat/work/Catalina/localhost/_/WEB-INF/lib/struts.jar: org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.tiles.UseAttributeTei Can someone tell which jar file contains org.apache.struts.taglib.tiles.UseAttributeTei? because I don't see it when I unjar struts.jar Again this is struts 1.2.4 and tomcat 5.5.7 (configured for jdk 1.4.2) Thanks, Vinny -- Plato is my friend, Aristotle is my friend, but my greatest friend is truth. - Isaac Newton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Thank you, Struts!
For me it's still a little early to pop the champagne but I just passed through a major milestone on our Struts app here at work. Struts performed perfectly in the demo. All that is left to do is to have some of graphics and layouts updated by the design team. I wanted to give a thanks as well to the struts development team for enabling me to feed my family. :) Thanks Guys, Vincent Vamsee Kanakala wrote: Hey folks, Well, I have been working with Struts for the past 1 month, and though the initial setup was a bit complex (the first time) and firguring out the action mappings was tough, I am slowly discovering how cool Struts is. Maybe that's why it's so popular. A heartfelt thanks to Craig and everybody who's working on Sturts, you guys make my life easier and fun :) The documentation is truly, truly excellent. When I get some time, I will surely contribute. You guys rock! Thanks for everything, -Vamsee Kanakala. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Plato is my friend, Aristotle is my friend, but my greatest friend is truth. - Isaac Newton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
examples of struts 1.2
Return Receipt Your examples of struts 1.2 document : was John Vincent/Towers Perrin received by: at: 11/19/2004 03:50:32 PM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
help to changer a code to Struts
Return Receipt Your help to changer a code to Struts document : was John Vincent/Towers Perrin received by: at: 11/19/2004 03:50:31 PM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts app to be passed a parameter (of some kind)
Need one Struts app, but must have multiple URLs. Thus http://www.jv.com/company1 http://www.jv.com/company2 actually start the same Struts app, say http://www.jv.com/myApp but must pass something into the Struts app so that it knows who, or rather, which URL invoked it. Thoughts: Write a servlet, handles multiple URLs, init-param set to a unique value for each servlet. Add a header into the http response object before issuing the redirect. Redirect to the Struts app. Where in a Struts app can I pick up the header (or other)? The Struts app, in web.xml, has a welcome file of logon.jsp. Could I get the header here? Doesn't seem to work. Any ideas? John NOTICE: This communication may contain confidential, proprietary or legally privileged information. It is intended only for the person(s) to whom it is addressed. If you are not an intended recipient, you may not use, read, retransmit, disseminate or take any action in reliance upon it. Please notify the sender that you have received it in error and immediately delete the entire communication, including any attachments. Towers Perrin does not encrypt and cannot ensure the confidentiality or integrity of external e-mail communications and, therefore, cannot be responsible for any unauthorized access, disclosure, use or tampering that may occur during transmission. This communication is not intended to create or modify any obligation, contract or warranty of Towers Perrin, unless the firm clearly expresses such an intent.
Re: Struts app to be passed a parameter (of some kind)
App Server is WebLogic 8.1. I can try SunOne Application Server also. On Tomcat, do you configure the app xml files? Or is it configured at the server level? In other words, do I need to check the app server doc or the weblogic*.xml or sun-*.xml files doc for the Struts app? John Craig McClanahan [EMAIL PROTECTED] 11/11/2004 03:27 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To Struts Users Mailing List [EMAIL PROTECTED] cc Subject Re: Struts app to be passed a parameter (of some kind) What app server are you running? The setup to accomplish this is going to be specific to that app server, if it is possible at all. The example I gave, as I stated in the response, was specific to using Tomcat. Craig On Thu, 11 Nov 2004 11:03:45 -0500, John Vincent [EMAIL PROTECTED] wrote: I am rather confused here. application.xml application display-nameAbc/display-name descriptionabc/description module web web-uriwarapp/web-uri context-rootjv1/context-root /web /module /application allows only one context root. web.xml servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class . /servlet servlet-mapping servlet-nameaction/servlet-name url-pattern*.do/url-pattern /servlet-mapping gives nothing. I do not see how I can set multiple URLs for the same Struts app. Craig McClanahan [EMAIL PROTECTED] 11/11/2004 09:33 AM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To Struts Users Mailing List [EMAIL PROTECTED] cc Subject Re: Struts app to be passed a parameter (of some kind) On Thu, 11 Nov 2004 08:14:12 -0500, John Vincent [EMAIL PROTECTED] wrote: Need one Struts app, but must have multiple URLs. Thus http://www.jv.com/company1 http://www.jv.com/company2 Why not just configure your servlet container to treat both context paths as the same app? For example, in Tomcat, you can create two Context elements with different paths but the same document base directory. actually start the same Struts app, say http://www.jv.com/myApp but must pass something into the Struts app so that it knows who, or rather, which URL invoked it. The request.getContextPath() method would tell your application which way it was invoked. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] NOTICE: This communication may contain confidential, proprietary or legally privileged information. It is intended only for the person(s) to whom it is addressed. If you are not an intended recipient, you may not use, read, retransmit, disseminate or take any action in reliance upon it. Please notify the sender that you have received it in error and immediately delete the entire communication, including any attachments. Towers Perrin does not encrypt and cannot ensure the confidentiality or integrity of external e-mail communications and, therefore, cannot be responsible for any unauthorized access, disclosure, use or tampering that may occur during transmission. This communication is not intended to create or modify any obligation, contract or warranty of Towers Perrin, unless the firm clearly expresses such an intent. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] NOTICE: This communication may contain confidential, proprietary or legally privileged information. It is intended only for the person(s) to whom it is addressed. If you are not an intended recipient, you may not use, read, retransmit, disseminate or take any action in reliance upon it. Please notify the sender that you have received it in error and immediately delete the entire communication, including any attachments. Towers Perrin does not encrypt and cannot ensure the confidentiality or integrity of external e-mail communications and, therefore, cannot be responsible for any unauthorized access, disclosure, use or tampering that may occur during transmission. This communication is not intended to create or modify any obligation, contract or warranty of Towers Perrin, unless the firm clearly expresses such an intent.
ActionForm.validate() Help
Hello all, I just downloaded the latest stable build of Struts 1.2. What is a best practice approach of handling validation in the ActionForm's validate method since ActionError was deprecated? Also, how should one display the messages in the JSP? Currently I use: logic:messagesPresent message=true html:messages id=message message=true ${message}br /html:messages /logic:messagesPresent Howver this does not display anything when I use the following code in my ActionForm because errors is obviously not populated with any data: public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (/*some error occurs*/){ ActionMessages messages = new ActionMessages(); ActionMessage message = new ActionMessage(errors.valueRequired); messages.add(ActionMessages.GLOBAL_MESSAGE, message); request.setAttribute(warnings, messages); } return errors; } However in an Action the following code will work correctly and display in the HTML rendered by the JSP code from above: ActionMessages messages = new ActionMessages(); ActionMessage message = new ActionMessage(errors.notfound); messages.add(ActionMessages.GLOBAL_MESSAGE, message); saveMessages(request, messages); Do I have to check for the existence of both messages and errors in the JSP? Thanks! Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] DAO ... where to draw the line?
LAST bump. I promise! Thanks! Hi all, Thanks for the info. Here's another issue. What if I have an employee search screen that wants to show only some of the information of an employee (not all). What do you do then? 1. Instanatiate an Employee object and only fill in the relative information? Keep in mind that this could be just employee name and location on the search results screen and then when the user chooses which employee to view I need to get all of the employee information. 2. Instantiate an Employee object and fill out all the information even though you won't be needing most of it on the search results screen? 3. Create 2 DTOs, one called Employee and one called EmployeeSearch DTO. The EmployeeSearch DTO only stores what needs to be shown on the search results screen and the EmployeeDTO holds all the information for what needs to be shown on the detail screen? 4. Something else... Another pattern, etc? Thanks! Matt Navjot Singh wrote: hi matthew, I wont say that you go with one or other of your approaches. It depends upon type of assosciation that 2 entities may share. They may have aggregation or composition relationship. Depending on that your DAO implementation will decide that you need to get ONLY id or the composite objects. Let me explain. Say you have class named ORDER ad ORDER_DETAILS. (consists-of relationship) Order without order details is nothing. So you may get the OrderDetails object as well when you get Order. Now say you have EMPLOYEE and DEPARTMENT. (has-a relationship) EMPLOYEE *may* still exists with or without department. So you may get only id of department and later fetch the department. Think in employee table, you have relationship (reports-to). If you specify this relation as composition, you may go on fetching the objects all the way up to the organization chart ;-) Do i make sense? Navjot Singh -Original Message- From: Matthew J. Vincent [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 11, 2004 8:21 AM To: Struts Users Mailing List Subject: [OT] DAO ... where to draw the line? [OFF TOPIC] I know this is a struts forum, but as struts developers using DAOs, where do your DAO implementation draw the line? For example: Let''s say I have three tables: Employee (contains employee_id, employee_name, and dept_id) Department (contains dept_id, dept_name, loc_id) Location (contains loc_id, location_name) How deep do your classes go to replicate the data? Do you do this... public class Employee { private int id; private String name; private int deptId; // just the id // .. implementation details } or do you do this public class Employee { private int id; private String name; private Department dept; // all of the data // .. implementation details } and so on and so on. Class Department has the same type of problem. Does it hold just the id for location or a variable class Location? Should DAOs just fill in the id (keys) so it is up to the application using the DAOs to get the Employee class, then the Department class, and the the Location class like: Employee emp = EmployeDAO.getEmployee(1); Department dept = DepartmentDAO.getDepartment(emp.getDeptId()); Location loc = LocationDAO.getLocation(dept.getLocId()); System.out.println(emp.getEmpName() + works in + loc.getLocationName()); or Employee emp = EmployeDAO.getEmployee(1); System.out.println(emp.getEmpName() + works in + emp.getDept().getLoc().getLocationName()); Now this is just a simple example, but where do you draw the line? It's possible to go on and on and on and cycle back to employee... Any thoughts, links, tips, best practices, whatvere would be helpful! Thanks! Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] DAO ... where to draw the line?
Hi all, Thanks for the info. Here's another issue. What if I have an employee search screen that wants to show only some of the information of an employee (not all). What do you do then? 1. Instanatiate an Employee object and only fill in the relative information? Keep in mind that this could be just employee name and location on the search results screen and then when the user chooses which employee to view I need to get all of the employee information. 2. Instantiate an Employee object and fill out all the information even though you won't be needing most of it on the search results screen? 3. Create 2 DTOs, one called Employee and one called EmployeeSearch DTO. The EmployeeSearch DTO only stores what needs to be shown on the search results screen and the EmployeeDTO holds all the information for what needs to be shown on the detail screen? 4. Something else... Thanks! Matt Navjot Singh wrote: hi matthew, I wont say that you go with one or other of your approaches. It depends upon type of assosciation that 2 entities may share. They may have aggregation or composition relationship. Depending on that your DAO implementation will decide that you need to get ONLY id or the composite objects. Let me explain. Say you have class named ORDER ad ORDER_DETAILS. (consists-of relationship) Order without order details is nothing. So you may get the OrderDetails object as well when you get Order. Now say you have EMPLOYEE and DEPARTMENT. (has-a relationship) EMPLOYEE *may* still exists with or without department. So you may get only id of department and later fetch the department. Think in employee table, you have relationship (reports-to). If you specify this relation as composition, you may go on fetching the objects all the way up to the organization chart ;-) Do i make sense? Navjot Singh -Original Message- From: Matthew J. Vincent [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 11, 2004 8:21 AM To: Struts Users Mailing List Subject: [OT] DAO ... where to draw the line? [OFF TOPIC] I know this is a struts forum, but as struts developers using DAOs, where do your DAO implementation draw the line? For example: Let''s say I have three tables: Employee (contains employee_id, employee_name, and dept_id) Department (contains dept_id, dept_name, loc_id) Location (contains loc_id, location_name) How deep do your classes go to replicate the data? Do you do this... public class Employee { private int id; private String name; private int deptId; // just the id // .. implementation details } or do you do this public class Employee { private int id; private String name; private Department dept; // all of the data // .. implementation details } and so on and so on. Class Department has the same type of problem. Does it hold just the id for location or a variable class Location? Should DAOs just fill in the id (keys) so it is up to the application using the DAOs to get the Employee class, then the Department class, and the the Location class like: Employee emp = EmployeDAO.getEmployee(1); Department dept = DepartmentDAO.getDepartment(emp.getDeptId()); Location loc = LocationDAO.getLocation(dept.getLocId()); System.out.println(emp.getEmpName() + works in + loc.getLocationName()); or Employee emp = EmployeDAO.getEmployee(1); System.out.println(emp.getEmpName() + works in + emp.getDept().getLoc().getLocationName()); Now this is just a simple example, but where do you draw the line? It's possible to go on and on and on and cycle back to employee... Any thoughts, links, tips, best practices, whatvere would be helpful! Thanks! Matt - 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]
Re: [OT] DAO ... where to draw the line?
bump Matthew J. Vincent wrote: Hi all, Thanks for the info. Here's another issue. What if I have an employee search screen that wants to show only some of the information of an employee (not all). What do you do then? 1. Instanatiate an Employee object and only fill in the relative information? Keep in mind that this could be just employee name and location on the search results screen and then when the user chooses which employee to view I need to get all of the employee information. 2. Instantiate an Employee object and fill out all the information even though you won't be needing most of it on the search results screen? 3. Create 2 DTOs, one called Employee and one called EmployeeSearch DTO. The EmployeeSearch DTO only stores what needs to be shown on the search results screen and the EmployeeDTO holds all the information for what needs to be shown on the detail screen? 4. Something else... Thanks! Matt Navjot Singh wrote: hi matthew, I wont say that you go with one or other of your approaches. It depends upon type of assosciation that 2 entities may share. They may have aggregation or composition relationship. Depending on that your DAO implementation will decide that you need to get ONLY id or the composite objects. Let me explain. Say you have class named ORDER ad ORDER_DETAILS. (consists-of relationship) Order without order details is nothing. So you may get the OrderDetails object as well when you get Order. Now say you have EMPLOYEE and DEPARTMENT. (has-a relationship) EMPLOYEE *may* still exists with or without department. So you may get only id of department and later fetch the department. Think in employee table, you have relationship (reports-to). If you specify this relation as composition, you may go on fetching the objects all the way up to the organization chart ;-) Do i make sense? Navjot Singh -Original Message- From: Matthew J. Vincent [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 11, 2004 8:21 AM To: Struts Users Mailing List Subject: [OT] DAO ... where to draw the line? [OFF TOPIC] I know this is a struts forum, but as struts developers using DAOs, where do your DAO implementation draw the line? For example: Let''s say I have three tables: Employee (contains employee_id, employee_name, and dept_id) Department (contains dept_id, dept_name, loc_id) Location (contains loc_id, location_name) How deep do your classes go to replicate the data? Do you do this... public class Employee { private int id; private String name; private int deptId; // just the id // .. implementation details } or do you do this public class Employee { private int id; private String name; private Department dept; // all of the data // .. implementation details } and so on and so on. Class Department has the same type of problem. Does it hold just the id for location or a variable class Location? Should DAOs just fill in the id (keys) so it is up to the application using the DAOs to get the Employee class, then the Department class, and the the Location class like: Employee emp = EmployeDAO.getEmployee(1); Department dept = DepartmentDAO.getDepartment(emp.getDeptId()); Location loc = LocationDAO.getLocation(dept.getLocId()); System.out.println(emp.getEmpName() + works in + loc.getLocationName()); or Employee emp = EmployeDAO.getEmployee(1); System.out.println(emp.getEmpName() + works in + emp.getDept().getLoc().getLocationName()); Now this is just a simple example, but where do you draw the line? It's possible to go on and on and on and cycle back to employee... Any thoughts, links, tips, best practices, whatvere would be helpful! Thanks! Matt - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Should every Action have an associated form?
Thanks everyone! Much appreciated. Matt Michael McGrady wrote: I have lots of actions without forms. They are useful when you don't have forms. LOL Seriously, that is the reason. Michael At 07:51 PM 8/10/2004, you wrote: Hey everyone! I hope to not get flamed, but it's getting late here and I'm tired of looking through the archives. Should every Action have an associated ActionForm? Is it a bad idea to read a parameter directly from the request in the Action? I have a page where I need to show details for a particular item in our database. People will be directed to this page via a url http://127.0.0.1/foo/bar.do?id=123. If I need an ActonForm, what's the best way to set this up in the struts-config.xml? Thoughts? Thanks in advance! Matt - 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]
[OT] DAO ... where to draw the line?
[OFF TOPIC] I know this is a struts forum, but as struts developers using DAOs, where do your DAO implementation draw the line? For example: Let''s say I have three tables: Employee (contains employee_id, employee_name, and dept_id) Department (contains dept_id, dept_name, loc_id) Location (contains loc_id, location_name) How deep do your classes go to replicate the data? Do you do this... public class Employee { private int id; private String name; private int deptId; // just the id // .. implementation details } or do you do this public class Employee { private int id; private String name; private Department dept; // all of the data // .. implementation details } and so on and so on. Class Department has the same type of problem. Does it hold just the id for location or a variable class Location? Should DAOs just fill in the id (keys) so it is up to the application using the DAOs to get the Employee class, then the Department class, and the the Location class like: Employee emp = EmployeDAO.getEmployee(1); Department dept = DepartmentDAO.getDepartment(emp.getDeptId()); Location loc = LocationDAO.getLocation(dept.getLocId()); System.out.println(emp.getEmpName() + works in + loc.getLocationName()); or Employee emp = EmployeDAO.getEmployee(1); System.out.println(emp.getEmpName() + works in + emp.getDept().getLoc().getLocationName()); Now this is just a simple example, but where do you draw the line? It's possible to go on and on and on and cycle back to employee... Any thoughts, links, tips, best practices, whatvere would be helpful! Thanks! Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Should every Action have an associated form?
Hey everyone! I hope to not get flamed, but it's getting late here and I'm tired of looking through the archives. Should every Action have an associated ActionForm? Is it a bad idea to read a parameter directly from the request in the Action? I have a page where I need to show details for a particular item in our database. People will be directed to this page via a url http://127.0.0.1/foo/bar.do?id=123. If I need an ActonForm, what's the best way to set this up in the struts-config.xml? Thoughts? Thanks in advance! Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts/Tiles/Taglib/JBoss325 Deployment Error
Hi, I'm using Jboss-3.2.5 and jakarta-struts-1.1 with J2SDK 1.4.2, WinXP I encounter the following exception : java.lang.NullPointerException at org.apache.jasper.runtime.TagHandlerPool.get(TagHandlerPool.java:153) .. java.lang.NullPointerException at org.apache.jasper.runtime.TagHandlerPool.release(TagHandlerPool.java:191) I suspect it is something related to tomcat-5.x because my application was running fine with Jboss-3.2.3 (tomcat-4.x) Could someone give me some hint on : what is the cause of this prob? how to resolve this problem? Please let me know whether there is any other information that I need to provide. Hope that someone could help me. Thank you. Regards, Vincent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]