Buttons and DispatchActions
Hi, We're using Dispatch Actions in our project. My question: How do you set the method? In the request after (or before) using button (submit) tag? ... I wrote a filter which assembles the proper Request (and some values, if needed) ... That looks like that on JSP html:submit property=method$$init$value value=Resource Bundle stuff/ The property value (method$$init$value) handles the method RequestHelper.getDispatchName(init) ... so my question, is there a better way, that just looks pretty ugly ... how about extending the struts tag? ... ... the filter changes it to method=init and writes the value into the request with setAttribute ... Thanks for any answers Holger Moosbauer Am Mediapark 8 50670 Köln = TECON Systems AG http://www.tecon.de [EMAIL PROTECTED] Telefon: +49 (221) 92007-68 =
Re: [OT] Ruby on rails VS Java Based Web Applications
Dave, Sorry for bothering you again, but can we go it through on an example? Lets assume I hava a very small website to build (I actually did that one, so I know the real effort and duration). A pretty simple document management system, for a small intranet, I'm sure a typical application. It contains view and edit interfaces, in the edit interface you can manage document vendors, document type (like manual, presentation, advertisement material and so), and you can upload document and assign properties to it: the type of the document, the vendor of the document and some description. The access is limited to restricted users. In the view interface you are able to select documents by type, or vendor or type and vendor, or get the full list. The view interface can be seen under http://www2.anotheria.net/konet/cms/showPage? Can you give me an estimation how long would it be to program this in java and ruby? The app is for very small number of customers, so scaleability is not a requirement, files and data are stored in the file system. Maybe with real estimations I would be able to understand the benefits :-) thanx for your time regards Leon On 2/21/06, Dave Newton [EMAIL PROTECTED] wrote: Leon Rosenberg wrote: I rather ment things like interception/reflection or/and AOP :-) Ah. Lots of reflection. AOP is being actively discussed for Ruby2. Pure-Ruby implementations for simple AOP exist but I've not used them. Pardon me for being devils advocate, but how do you measure it? Talking about the codebase, are you talking about functional code or whole code? I agree that 20-30% of java code is dump (getters/setters and so on) but dump code is generated by an IDE so it's not an issue. How fast are fast development cycles? Well, I have measured things in various ways. Codebase size: yep, my IDE will generate a lot, and this makes Java bearable. But the code is still there; just because I don't type it doesn't mean I don't have to comprehend it. Character-wise my Ruby/RoR code is about 1/3-1/2 the size of feature-comparable J2EE apps. That's a lot less stuff I have to look at even if it was auto-generated. Development time: I've coded both J2EE=RoR and RoR=J2EE. I've coded just RoR and just J2EE apps. It usually takes me about 1/2 the time to code an RoR application, but that's just an average. If I was more adept with AppFuse (or Trails, I still don't remember which is which) I suspect the timing would be more similar. As far as I understand you have no strong typing, right? That is correct at this point. Obviously you can check types within a method. Dynamic- vs. strong-typing is one of those arguments that has gone, and will go, on forever. I think strong typing is great for large, distributed teams of generally average programmers. I think dynamic typing is great for smaller, better development teams, and compiler optimization. For instance, in Common Lisp I'll often write stuff with no thought of typing then as development progresses I'll add typing info. The canonical Languages for the Masses vs. Languages for Smart People article is at: http://www.paulgraham.com/vanlfsp.html It's somewhat deliberately provocative, but interesting. Another consideration for me, at least, is that Ruby feels better. Part of that is simply personality, part of it is that it's quite a bit more like what I'm used to (SmallTalk, Lisp, Forth). I have a LOT more fun programming in Ruby than Java. This is an intangible, but an important one for me. Bear in mind that I still recommend PHP for large-scale production sites, but I am slowly using RoR for more small-ish sites. Dave - 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]
html:file clears after validate returns error
Hello, The html:file field clears after there is an error in the form's validate() method. The user then has to again select the file for upload. How do I retain the file selected by the user even after a validate error. I searched the internet but could not find anything. regards, vijay. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hosting problem , the Host provider tomcat does not understand .do
It works on my local computer in same Configuration (just it is windows machine , so my web.xml is OK or at least i think it is ok because it works on local computer.) Check for file name and xml file for case changes. Hope this will help. Let us know. Thanks and Regards, Thomas Joseph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FormFile validation
Hi all, I have a formfile html:file property=foto/ and a bean with getters and setters. When validation fails, the other fields get the values already inserted, but the file input field gets empty and must be reselected. Is this normal, or is there a way to keep the file location in the input field? thanks, Markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormFile validation
Hi Markus, For FILE type inputs, you cannot retain the value because of browser security settings and also you cannot set default values. Thanks, Raj. Markus Demetz [EMAIL PROTECTED] 02/21/2006 05:30 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Mailing List user@struts.apache.org cc Subject FormFile validation Hi all, I have a formfile html:file property=foto/ and a bean with getters and setters. When validation fails, the other fields get the values already inserted, but the file input field gets empty and must be reselected. Is this normal, or is there a way to keep the file location in the input field? thanks, Markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regarding Struts- Mysql Connection.
Hi dear there is no need to specify in any where start MySql step 1 just paste *.jar file in lib directory. step 2 specify all elements(driverClass ,url ,no of connection , user id, password) and full path of database in struts-config.xml . Now you can connect in Action Classes directely by creating DataSource Object. Try it if You r not able to do so. tell me Regards Dharmendra Singh On 2/17/06, C. Grobmeier [EMAIL PROTECTED] wrote: I am beginner for struts.now I have developed one simple application using Struts 1.24 with Mysql 4.1.I have created all the tables successfully.and Program is also correct.And I have copied the mm.mysql-2.0.6.jar into lib Folder.But it Shows some database exceptions. Is there any need to configure the Database in Control Panel -Administrative tools - (DataSource) like MS Access.Plz give me solution. No, there isn't such a need. You have just to start mysql. JDBC should do the rest. If you want help you should place the exceptions within your mail. - Chris. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: validator frame work for struts Action Errors
Hi Dear there is no need to use validator framwork for ActionErrors. Strusts .jar is sufficient. just use validate() in Action Form which returns ActionErrors and use .properties file for mapping corresponding Errors. If U satisfied my Answer or U got another problem. Plz mail me. bye Dharmendra Singh On 2/20/06, vasumathi [EMAIL PROTECTED] wrote: u can use like this in validation.xml file in WEB-INF folder. form name=loginForm field property=userName depends=required,minlength,maxlength,mask arg0 key=login.enter.user/ var var-nameminlength/var-name var-value5/var-value /var var var-namemaxlength/var-name var-value12/var-value /var var var-namemask/var-name var-value^[0-9_a-zA-Z]*$/var-value /var /field field property=userPassword depends=required arg0 key=login.enter.password/ /field /form no need to use validate method in ActionForm. i think u know the use of validator-rules.xml in WEB-INF folder. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JSP expression html filter?
If I use the bean write-tag (bean:write...filter=true) I can filter html output: becomes gt; ... How can I filter output from JSP expressions (${...}) ? Is this possible? Thanks Jürgen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP expression html filter?
On 2/21/06, Jürgen Hofmann [EMAIL PROTECTED] wrote: If I use the bean write-tag (bean:write...filter=true) I can filter html output: becomes gt; ... How can I filter output from JSP expressions (${...}) ? Is this possible? snip/ ${fn:escapeXml(...)} or c:out value=${...} / -Rahul Thanks Jürgen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why my page can't redirect under Struts with Javascript?
I'm sorry, but this is a Javascript issue. If you want to use Struts, use Struts. Create an ActionForm to get your value from the drop-down list and then redirect to any number of Actions from your Action. I believe that is the easiest way, and a LOT less time consuming then sending all of these emails. Gary [EMAIL PROTECTED] 2/20/2006 9:53:33 PM I try follows: function goURL(tmp){ document.forms[0].submit(); } I debug the Javascript,when running the statement document.forms[0].submit(); Javascript raise a error: Microsoft JScript running error:object can't support this attribute or method Why? On 2/21/06, Dave Newton [EMAIL PROTECTED] wrote: red phoenix wrote: I tried follows: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=First); document.forms[0].submit(); } and function goURL(tmp){ document.forms[0].action=eval(/log.do?action=First); document.forms[0].submit(); } My page also can't redirect! Why are you eval-ing a string? Since /log.do?action=First is not a valid JavaScript statement, this will fail. Pay attention to JavaScript errors. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Confidentiality Statement: This email/fax, including attachments, may include confidential and/or proprietary information and may be used only by the person or entity to which it is addressed. If the reader of this email/fax is not the intended recipient or his or her agent, the reader is hereby notified that any dissemination, distribution or copying of this email/fax is prohibited. If you have received this email/fax in error, please notify the sender by replying to this message and deleting this email or destroying this facsimile immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP expression html filter?
thanks Rahul. - Original Message - From: Rahul Akolkar [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, February 21, 2006 2:23 PM Subject: Re: JSP expression html filter? On 2/21/06, Jürgen Hofmann [EMAIL PROTECTED] wrote: If I use the bean write-tag (bean:write...filter=true) I can filter html output: becomes gt; ... How can I filter output from JSP expressions (${...}) ? Is this possible? snip/ ${fn:escapeXml(...)} or c:out value=${...} / -Rahul Thanks Jürgen - 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]
Action Oriented Framework Rendering Mode
Hi All What is the state of play with WebWork / Struts Action 2.0? I am trying to come up with a design / architecture / proposal for a new aspect of an enterprise project. I have been reading the WebWork in Action book, and I have come to the conclusion that it is best to start a brand Action-Oriented framework using WebWork 2.2. I found the design decisions in the book to really solid, and not fanciful. Especially like the decision to use OGNL as the EL. I have a requirement to possibly build a new web application to support portlets and also be displayable in a standard Java EE webapp server in the future. Does WebWork 2.2 support portlets? Basically it looks like the web application has to support two view styles. One style is the classical Tiles and regionalisation of the JSP view. For instance you would have a corporate header, footer, a navigation menu and a content area. This is something that every web developer like myself has done over the last five years. The other style is to chuck all the extra tiles stuff away like the header, portal and menu system. For the portlet view just render the content region. The content view is the same as it would with the Tiles regions. What I want to know is this architecturally possible to develop with WebWork now or is this on the book of work to do? I have called this a ``style'', but now I come to think of it ought to be called a ``mode'' as in mode of (render) employment. Thoughts are most welcome, even from the Component-oriented people. Thanks in advance -- Peter Pilgrim :: J2EE Software Development Architecture Operations/IT - Credit Suisse Group - One Bank, Floor 15, 5 Canada Square, London E14 4QJ, United Kingdom Tel: +44-(0)207-883-4497 peter dot pilgrim at credit-suisse.com == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Ruby on rails VS Java Based Web Applications
Leon Rosenberg wrote: A pretty simple document management system, for a small intranet, I'm sure a typical application. It contains view and edit interfaces, in the edit interface you can manage document vendors, document type (like manual, presentation, advertisement material and so), and you can upload document and assign properties to it: the type of the document, the vendor of the document and some description. The access is limited to restricted users. If I have time in the next day or two I'll just do it and see. Without making the UI pretty I'd say we're talking 15-30 minutes, but that's assuming you don't have user access code that already exists. The unit and functional tests that RoR creates for you would not fully exercise the system; if you added on another 30 minutes you could have very broad coverage. In the view interface you are able to select documents by type, or vendor or type and vendor, or get the full list. The view interface can be seen under http://www2.anotheria.net/konet/cms/showPage? The view side would take longer because I don't know Russian ;) The search part by itself would be about 5-10 minutes. http://www.italiannewjersey.com/ is a site that I _re_wrote using RoR as an experiment. I duplicated and extended the functionality in under 4 hours, including reproducing the style/layout/etc. and breaking up the presentation side into more manageable chunks. (RoR has custom tags but they're called partials, as in a partial template. Using them in an RHTML (our JSP) is still inside a scriptlet :( The vast majority of my time (about 3 hrs) was spent within the view side, as the source HTML was really crappy. Also, I had a working implementation to code from; if I had done it from scratch the view side would have taken me much longer as I really suck at design. There are some sections to the site that are not dynamic that should be; as an experiment I converted one static section to being dynamic and it took approximately 10 minutes without unit/functional tests. Also, it was my first real RoR application; a more knowledgeable RoR person would probably have been quicker. I am _far_ from an expert at RoR, but I get by. I've attempted to append a chunk of a comparison spreadsheet I made up; I doubt the formatting will work well so I apologize in advance. Caveats: - The J2EE version uses some weird older stuff the original app designers used, so the numbers may be inflated about 2-5% - The J2EE version includes no unit or functional tests; the RoR version has minimal tests (I have numbers for both) - The J2EE JavaScript includes a complete WYSIWIG HTML editor, the RoR version includes the complete prototype.js library which is not used. - The RoR version includes functionality not present in the J2EE version: three static sections were converted to dynamic (including the admin side) and there are more games being played with dynamic content inside the pages. HTH, Dave Lines Words Chars J2EE JSP 1775620559142 JAVA43 123 1561 HTM 106 413 4715 SHTML 1703830593937 TEM 718 220128420 XML 17 26 619 JS 486817325 161706 Total 923034598 350100 Total-JS436217273 188394 RoR RB 1107288428196 RHTML 998 444044158 YML 40 107 927 JS 395810851 126538 Total 610318282 199819 Total-JS2145743173281 Total-JS-Test 1600618260130 Total-JS-Test-Helpers 1579613759743 RoR % of J2EE (All) 66% 53% 57% RoR % of J2EE (Just App)36% 36% 32%
Re: Action Oriented Framework Rendering Mode
below. /Ian -- From Down Around, Inc. Innovative IT Solutions Software Architecture * Design * Development ~ web: www.fdar.com email [EMAIL PROTECTED] phone:617.821.5430 ~ Pilgrim, Peter wrote: Hi All What is the state of play with WebWork / Struts Action 2.0? I am trying to come up with a design / architecture / proposal for a new aspect of an enterprise project. I have been reading the WebWork in Action book, and I have come to the conclusion that it is best to start a brand Action-Oriented framework using WebWork 2.2. I found the design decisions in the book to really solid, and not fanciful. Especially like the decision to use OGNL as the EL. I have a requirement to possibly build a new web application to support portlets and also be displayable in a standard Java EE webapp server in the future. Does WebWork 2.2 support portlets? Yes - action can be used as portlets in various web containers. This is realitively new, so check the wiki at wiki.opensymphony.com for the latest information. Basically it looks like the web application has to support two view styles. One style is the classical Tiles and regionalisation of the JSP view. For instance you would have a corporate header, footer, a navigation menu and a content area. This is something that every web developer like myself has done over the last five years. The other style is to chuck all the extra tiles stuff away like the header, portal and menu system. For the portlet view just render the content region. The content view is the same as it would with the Tiles regions. What I want to know is this architecturally possible to develop with WebWork now or is this on the book of work to do? I'm not a tiles expert, so I can't help you there. But using sitemesh, I believe you can specify a URL parameter that sitemesh can interpet and change the decoration of the page to a plain / non-decorated look. Alternatively, you could provide a secondary mapping in the configuration files for the portlet view - this would be good for if the portlets are a subset, otherwise it may be alot of work. I have called this a ``style'', but now I come to think of it ought to be called a ``mode'' as in mode of (render) employment. Thoughts are most welcome, even from the Component-oriented people. Thanks in advance -- Peter Pilgrim :: J2EE Software Development Architecture Operations/IT - Credit Suisse Group - One Bank, Floor 15, 5 Canada Square, London E14 4QJ, United Kingdom Tel: +44-(0)207-883-4497 peter dot pilgrim at credit-suisse.com == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == - 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] Ruby on rails VS Java Based Web Applications
Very interesting numbers, please allow me a question, you have only 43 lines of java code in your application, but 1107 lines ruby code... but are talking about smaller code base with ror? :-) leon On 2/21/06, Dave Newton [EMAIL PROTECTED] wrote: Leon Rosenberg wrote: A pretty simple document management system, for a small intranet, I'm sure a typical application. It contains view and edit interfaces, in the edit interface you can manage document vendors, document type (like manual, presentation, advertisement material and so), and you can upload document and assign properties to it: the type of the document, the vendor of the document and some description. The access is limited to restricted users. If I have time in the next day or two I'll just do it and see. Without making the UI pretty I'd say we're talking 15-30 minutes, but that's assuming you don't have user access code that already exists. The unit and functional tests that RoR creates for you would not fully exercise the system; if you added on another 30 minutes you could have very broad coverage. In the view interface you are able to select documents by type, or vendor or type and vendor, or get the full list. The view interface can be seen under http://www2.anotheria.net/konet/cms/showPage? The view side would take longer because I don't know Russian ;) The search part by itself would be about 5-10 minutes. http://www.italiannewjersey.com/ is a site that I _re_wrote using RoR as an experiment. I duplicated and extended the functionality in under 4 hours, including reproducing the style/layout/etc. and breaking up the presentation side into more manageable chunks. (RoR has custom tags but they're called partials, as in a partial template. Using them in an RHTML (our JSP) is still inside a scriptlet :( The vast majority of my time (about 3 hrs) was spent within the view side, as the source HTML was really crappy. Also, I had a working implementation to code from; if I had done it from scratch the view side would have taken me much longer as I really suck at design. There are some sections to the site that are not dynamic that should be; as an experiment I converted one static section to being dynamic and it took approximately 10 minutes without unit/functional tests. Also, it was my first real RoR application; a more knowledgeable RoR person would probably have been quicker. I am _far_ from an expert at RoR, but I get by. I've attempted to append a chunk of a comparison spreadsheet I made up; I doubt the formatting will work well so I apologize in advance. Caveats: - The J2EE version uses some weird older stuff the original app designers used, so the numbers may be inflated about 2-5% - The J2EE version includes no unit or functional tests; the RoR version has minimal tests (I have numbers for both) - The J2EE JavaScript includes a complete WYSIWIG HTML editor, the RoR version includes the complete prototype.js library which is not used. - The RoR version includes functionality not present in the J2EE version: three static sections were converted to dynamic (including the admin side) and there are more games being played with dynamic content inside the pages. HTH, Dave Lines Words Chars J2EE JSP 1775620559142 JAVA43 123 1561 HTM 106 413 4715 SHTML 1703830593937 TEM 718 220128420 XML 17 26 619 JS 486817325 161706 Total 923034598 350100 Total-JS436217273 188394 RoR RB 1107288428196 RHTML 998 444044158 YML 40 107 927 JS 395810851 126538 Total 610318282 199819 Total-JS2145743173281 Total-JS-Test 1600618260130 Total-JS-Test-Helpers 1579613759743 RoR % of J2EE (All) 66% 53% 57% RoR % of J2EE (Just App)36% 36% 32% - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Ruby on rails VS Java Based Web Applications
Leon Rosenberg wrote: Very interesting numbers, please allow me a question, you have only 43 lines of java code in your application, but 1107 lines ruby code... but are talking about smaller code base with ror? :-) Forgot to mention. The developers that preceded me put all their code in JSP files rather than Java source files. The TEM files are what we would normally put in JSP files, so they have a combination of HTML, SHTML, and TEM. If you add the Java and JSP counts it will be more accurate, again remembering that there's quite a bit more functionality in the RoR version from both the test and dynamic-content admin points of view. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
(possible O/T) question on jsf-demo
Good Morning All- I was experiencing some difficulty getting the jsf demo 'jsf-demo' to work under Tomcat 5.5.7 I birthed greeting.jsp to a separate webapp to attempt to more accurately diagnose the situation and see org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsf/html cannot be resolved in either web.xml or the jar files deployed with this application org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:114) org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:316) org.apache.jasper.compiler.TagLibraryInfoImpl.init(TagLibraryInfoImpl.java:147) org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418) org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483) org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539) org.apache.jasper.compiler.Parser.parse(Parser.java:126) org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211) org.apache.jasper.compiler.ParserController.parse(ParserController.java:100) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146) org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) org.apache.jasper.compiler.Compiler.compile(Compiler.java:267) org.apache.jasper.compiler.Compiler.compile(Compiler.java:255) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)Any advice?Thank You,Martin-
RequestProcessor processPopulate heavily increases memory usage
Hi, Last week we migrated our Struts 1.0 application to 1.2.8. As far as we can tell, we correctly followed the migration steps inbetween. Since the migration we have noticed the following weird behaviour: upon submitting a form from a jsp to as struts form/action, the method processPopulate of RequestProcessor will increase memory usage on our windows box by some 30M for each call. Unfortunately, this extra memory is not freed, not even after waiting more than say one hour. After a few such requests, needless to say, this produces OutOfMemoryErrors. I pinpointed the memory usage to this method by setting log4j.logger.org.apache.struts=DEBUG in my log4j.properties. In the log, after form submission, the following info appears: DEBUG: RequestUtils.createActionForm.300 - -- [EMAIL PROTECTED] (21 feb 2006 17:59:31,156) DEBUG: RequestProcessor.processActionForm.327 - Storing ActionForm bean instance in scope 'request' under attribute key 'incidentForm' (21 feb 2006 17:59:31,156) DEBUG: RequestProcessor.processPopulate.793 - Populating bean properties from this request (21 feb 2006 17:59:35,616) DEBUG: CommonsMultipartRequestHandler.getRepositoryPath.388 - File upload temp dir: C:\dev\workspace-reconstruct-hibernate\Attend\work\org\apache\jsp (21 feb 2006 17:59:35,772) What could be the cause of this excessive memory increase? Could it be that the entire Struts config is accidentally reloaded because of a problem in our configuration? Thanks, Willem
[shale] Add getMessage() method to AbstractViewController?
Hello everyone, I have a simple feature request. Can we get a method added to the AbstractViewController class that gets a message out of the applications configured message bundle? Something as simple as: protected String getMessage (String messageKey) { ResourceBundle rb = ResourceBundle.getBundle (getApplication ().getMessageBundle (), getFacesContext ().getViewRoot ().getLocale ()); return rb.getString (messageKey); } Something that might also be useful is one that takes an optional Object[] as parameters and then uses MessageFormat to format the message: protected String getMessage (String messageKey, Object[] params) { String messageBundleName = getApplication ().getMessageBundle (); Locale locale = getFacesContext ().getViewRoot ().getLocale (); ResourceBundle rb = ResourceBundle.getBundle (messageBundleName, locale); String msgPattern = rb.getString (messageKey); String message; if (params != null) { message = MessageFormat.format (msgPattern, params); } else { message = msgPattern; } return message; } I've found this to be of tremendous help in simplifying error handling code, or when I want to display a success message or something like that. It makes things so much cleaner. What do you think? Thanks, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Change status code returned when validate fails
Hello everybody, In our app we would like to return another status code when the validation fails in the ActionForm. Instead of forwarding to the error page and return 200 we would like to return 202 in some cases. Is it possible to do this? In the execute of the Action is possible because it includes the response as a parameter, but this is not the case with the ActionForm. Any help would be greatly appreciated. Thank you very much for your time, Manuel Valladares - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
drop down list box question.
I have users list created in my dispatch action and populated in request. in my form this works. tr td class=tdLabelfmt:message key=label.endDate/:/td tdhtml:text property=endDate size=40/ html:errors property=endDate//td /tr tr td class=tdLabelfmt:message key=label.oddLotOwnerUserName/:/td td html:select property=oddLotOwnerUserId c:forEach var=user items=${users} html:option value=${user.userId} c:out value=${user.userNameShort}/ /html:option /c:forEach /html:select /td /tr ... But This DOESN'T work. tr td class=tdLabelfmt:message key=label.endDate/:/td tdhtml:text property=endDate size=40/ html:errors property=endDate//td /tr tr td class=tdLabelfmt:message key=label.oddLotOwnerUserName/:/td html:select property=oddLotOwnerUserId html:optionsCollection property=users value=${user.userId} label=${user.userNameShort} / /html:select /tr What am I doing wrong ?? Thanks: Digant This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates.
Re: drop down list box question.
On 2/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have users list created in my dispatch action and populated in request. in my form this works. tr td class=tdLabelfmt:message key=label.endDate/:/td tdhtml:text property=endDate size=40/ html:errors property=endDate//td /tr tr td class=tdLabelfmt:message key=label.oddLotOwnerUserName/:/td td html:select property=oddLotOwnerUserId c:forEach var=user items=${users} html:option value=${user.userId} c:out value=${user.userNameShort}/ /html:option /c:forEach /html:select /td /tr ... But This DOESN'T work. tr td class=tdLabelfmt:message key=label.endDate/:/td tdhtml:text property=endDate size=40/ html:errors property=endDate//td /tr tr td class=tdLabelfmt:message key=label.oddLotOwnerUserName/:/td html:select property=oddLotOwnerUserId html:optionsCollection property=users value=${user.userId} label=${user.userNameShort} / /html:select /tr What am I doing wrong ?? What exactly does not work? Do you use JSP 2.x container? Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Buttons and DispatchActions
See here: http://issues.apache.org/bugzilla/show_bug.cgi?id=38343 Use this: http://issues.apache.org/bugzilla/attachment.cgi?id=17724 Michael. On 2/21/06, Holger Moosbauer [EMAIL PROTECTED] wrote: Hi, We're using Dispatch Actions in our project. My question: How do you set the method? In the request after (or before) using button (submit) tag? ... I wrote a filter which assembles the proper Request (and some values, if needed) ... That looks like that on JSP html:submit property=method$$init$value value=Resource Bundle stuff/ The property value (method$$init$value) handles the method RequestHelper.getDispatchName(init) ... so my question, is there a better way, that just looks pretty ugly ... how about extending the struts tag? ... ... the filter changes it to method=init and writes the value into the request with setAttribute ... Thanks for any answers Holger Moosbauer Am Mediapark 8 50670 Köln = TECON Systems AG http://www.tecon.de [EMAIL PROTECTED] Telefon: +49 (221) 92007-68 = - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Action Oriented Framework Rendering Mode
See inter mixed -Original Message- From: Ian Roughley [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 3:58 PM To: Struts Users Mailing List Subject: Re: Action Oriented Framework Rendering Mode below. /Ian -- From Down Around, Inc. Innovative IT Solutions Software Architecture * Design * Development ~ web: www.fdar.com email [EMAIL PROTECTED] phone:617.821.5430 ~ Pilgrim, Peter wrote: Hi All What is the state of play with WebWork / Struts Action 2.0? I am trying to come up with a design / architecture / proposal for a new aspect of an enterprise project. I have been reading the WebWork in Action book, and I have come to the conclusion that it is best to start a brand Action-Oriented framework using WebWork 2.2. I found the design decisions in the book to really solid, and not fanciful. Especially like the decision to use OGNL as the EL. I have a requirement to possibly build a new web application to support portlets and also be displayable in a standard Java EE webapp server in the future. Does WebWork 2.2 support portlets? Yes - action can be used as portlets in various web containers. This is realitively new, so check the wiki at wiki.opensymphony.com for the latest information. Great Webwork can support portlets, and of course from the book it can easily divorce itself from PortletRequest and PortletResponse interfaces! Basically it looks like the web application has to support two view styles. One style is the classical Tiles and regionalisation of the JSP view. For instance you would have a corporate header, footer, a navigation menu and a content area. This is something that every web developer like myself has done over the last five years. The other style is to chuck all the extra tiles stuff away like the header, portal and menu system. For the portlet view just render the content region. The content view is the same as it would with the Tiles regions. What I want to know is this architecturally possible to develop with WebWork now or is this on the book of work to do? I'm not a tiles expert, so I can't help you there. But using sitemesh, I believe you can specify a URL parameter that sitemesh can interpet and change the decoration of the page to a plain / non-decorated look. Alternatively, you could provide a secondary mapping in the configuration files for the portlet view - this would be good for if the portlets are a subset, otherwise it may be alot of work. Tiles is the wrong way to go for a filtered look. I will look at SiteMesh. I am sure I have a big old Red Wrox Book with a chapter on SiteMesh. JSP Site Design? is the probable title and rings a bell with me. Cheers I have called this a ``style'', but now I come to think of it ought to be called a ``mode'' as in mode of (render) employment. Thoughts are most welcome, even from the Component-oriented people. Any more ideas more than welcomed. Thanks in advance -- Peter Pilgrim :: J2EE Software Development Architecture Operations/IT - Credit Suisse Group - One Bank, Floor 15, 5 Canada Square, London E14 4QJ, United Kingdom Tel: +44-(0)207-883-4497 peter dot pilgrim at credit-suisse.com == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
message-rsource access in taglib
I created a struts application and in order to keep some area clean, I have created some tags to handle some isolated logic. I have been unable to figure out how to use the message-resources in the tag. Does anyone have a link or know if this is possible? Currently I ended up hard-coding values into the tag, and I don't like to do that. Thanks for your time, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: drop down list box question.
I am using tomcat 5 which I believe has jsp 2.0 I am getting exception of users getters/setters not defined exception. it assumes users as one of the attribute of my form instead of Collection. Digant Michael Jouravlev [EMAIL PROTECTED] 02/21/2006 01:08 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: Subject:Re: drop down list box question. On 2/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have users list created in my dispatch action and populated in request. in my form this works. tr td class=tdLabelfmt:message key=label.endDate/:/td tdhtml:text property=endDate size=40/ html:errors property=endDate//td /tr tr td class=tdLabelfmt:message key=label.oddLotOwnerUserName/:/td td html:select property=oddLotOwnerUserId c:forEach var=user items=${users} html:option value=${user.userId} c:out value=${user.userNameShort}/ /html:option /c:forEach /html:select /td /tr ... But This DOESN'T work. tr td class=tdLabelfmt:message key=label.endDate/:/td tdhtml:text property=endDate size=40/ html:errors property=endDate//td /tr tr td class=tdLabelfmt:message key=label.oddLotOwnerUserName/:/td html:select property=oddLotOwnerUserId html:optionsCollection property=users value=${user.userId} label=${user.userNameShort} / /html:select /tr What am I doing wrong ?? What exactly does not work? Do you use JSP 2.x container? Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates
RE: why my page can't redirect under Struts with Javascript?
Within my javascripts, when I want to post to a different action, I use this struts tidbit: script var newAction = 'html:rewrite page=/ActionIWantToCall.do /'; document.form[x].submit(); Make sure your form is good, meaning, start form and end form. I use all different browsers/os systems, and never have trouble doing what you want. Double check the html and make sure it is valid. Also, if you want to add args, use this type of rig in your pages /* hack for the html:link to go back a level */ java.util.HashMap params = new java.util.HashMap(); params.put(loadNum, dataForm.getLoadNum()); pageContext.setAttribute(upLink, params); If you look at the rewrite, link and other tags it want a map. So simply add this in your jsp page, add params, then call it like so: html:link action=exceptionMain name=upLink Here is one of mine straight from a jsp page var url = html:rewrite page=/DataExceptionFrameset.do /; var width=600; var height=400; var left = parseInt((screen.availWidth/2) - (width/2)); var top = parseInt((screen.availHeight/2) - (height/2)); var windowFeatures = width= + width + ,height= + height + ,status=1,resizable=1,scrollbar=1,toolbar=0,menubar=0,left= + left + ,top= + top + ,screenX= + left + ,screenY= + top; var myWindow = window.open(url, DataException, windowFeatures); myWindow.focus(); If you still have trouble email me OL. scott -Original Message- From: Gary Feidt [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 7:44 AM To: user@struts.apache.org Subject: Re: why my page can't redirect under Struts with Javascript? I'm sorry, but this is a Javascript issue. If you want to use Struts, use Struts. Create an ActionForm to get your value from the drop-down list and then redirect to any number of Actions from your Action. I believe that is the easiest way, and a LOT less time consuming then sending all of these emails. Gary [EMAIL PROTECTED] 2/20/2006 9:53:33 PM I try follows: function goURL(tmp){ document.forms[0].submit(); } I debug the Javascript,when running the statement document.forms[0].submit(); Javascript raise a error: Microsoft JScript running error:object can't support this attribute or method Why? On 2/21/06, Dave Newton [EMAIL PROTECTED] wrote: red phoenix wrote: I tried follows: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=First); document.forms[0].submit(); } and function goURL(tmp){ document.forms[0].action=eval(/log.do?action=First); document.forms[0].submit(); } My page also can't redirect! Why are you eval-ing a string? Since /log.do?action=First is not a valid JavaScript statement, this will fail. Pay attention to JavaScript errors. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Confidentiality Statement: This email/fax, including attachments, may include confidential and/or proprietary information and may be used only by the person or entity to which it is addressed. If the reader of this email/fax is not the intended recipient or his or her agent, the reader is hereby notified that any dissemination, distribution or copying of this email/fax is prohibited. If you have received this email/fax in error, please notify the sender by replying to this message and deleting this email or destroying this facsimile immediately. - 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] Add getMessage() method to AbstractViewController?
On 2/21/06, Richard Wallace [EMAIL PROTECTED] wrote: Hello everyone, I have a simple feature request. Can we get a method added to the AbstractViewController class that gets a message out of the applications configured message bundle? Something as simple as: protected String getMessage (String messageKey) { ResourceBundle rb = ResourceBundle.getBundle (getApplication ().getMessageBundle (), getFacesContext ().getViewRoot ().getLocale ()); return rb.getString (messageKey); } Something that might also be useful is one that takes an optional Object[] as parameters and then uses MessageFormat to format the message: protected String getMessage (String messageKey, Object[] params) { String messageBundleName = getApplication ().getMessageBundle (); Locale locale = getFacesContext ().getViewRoot ().getLocale (); ResourceBundle rb = ResourceBundle.getBundle (messageBundleName, locale); String msgPattern = rb.getString (messageKey); String message; if (params != null) { message = MessageFormat.format (msgPattern, params); } else { message = msgPattern; } return message; } I've found this to be of tremendous help in simplifying error handling code, or when I want to display a success message or something like that. It makes things so much cleaner. You can do something similar in spirit to this with the existing org.apache.shale.util.Messages class. The javadocs describe how to define an application scope managed bean, configured for a particuar resource bundle. Let's say you stored this under managed bean name messages. Now, you can generate formatted messages with it: Messages messages = (Messages) getBean(messages); Locale locale = context.getViewRoot().getLocale(); String localizedMessage = messages.getMessage(message.key, locale, new Object[] { ... parameters ... }); Is that close enough to what you are after? What do you think? Thanks, Rich Craig
Re: drop down list box question.
On 2/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am using tomcat 5 which I believe has jsp 2.0 I am getting exception of users getters/setters not defined exception. it assumes users as one of the attribute of my form instead of Collection. See here: http://wiki.apache.org/struts/StrutsWidgets Use name instead of property. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestProcessor processPopulate heavily increases memory usage
Do you have a session scoped form with one or more FormFile properties? Consider switching the scope to request, or alternatively, using the controller element to reduce the size of the in-memory file representation before the data is written to disk (see the memFileSize attribute described at http://struts.apache.org/struts-action/userGuide/configuration.html#controller_config ) Joe At 6:12 PM +0100 2/21/06, [EMAIL PROTECTED] wrote: Hi, Last week we migrated our Struts 1.0 application to 1.2.8. As far as we can tell, we correctly followed the migration steps inbetween. Since the migration we have noticed the following weird behaviour: upon submitting a form from a jsp to as struts form/action, the method processPopulate of RequestProcessor will increase memory usage on our windows box by some 30M for each call. Unfortunately, this extra memory is not freed, not even after waiting more than say one hour. After a few such requests, needless to say, this produces OutOfMemoryErrors. I pinpointed the memory usage to this method by setting log4j.logger.org.apache.struts=DEBUG in my log4j.properties. In the log, after form submission, the following info appears: DEBUG: RequestUtils.createActionForm.300 - -- [EMAIL PROTECTED] (21 feb 2006 17:59:31,156) DEBUG: RequestProcessor.processActionForm.327 - Storing ActionForm bean instance in scope 'request' under attribute key 'incidentForm' (21 feb 2006 17:59:31,156) DEBUG: RequestProcessor.processPopulate.793 - Populating bean properties from this request (21 feb 2006 17:59:35,616) DEBUG: CommonsMultipartRequestHandler.getRepositoryPath.388 - File upload temp dir: C:\dev\workspace-reconstruct-hibernate\Attend\work\org\apache\jsp (21 feb 2006 17:59:35,772) What could be the cause of this excessive memory increase? Could it be that the entire Struts config is accidentally reloaded because of a problem in our configuration? Thanks, Willem -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action Oriented Framework Rendering Mode
On 2/21/06, Pilgrim, Peter [EMAIL PROTECTED] wrote: I have a requirement to possibly build a new web application to support portlets and also be displayable in a standard Java EE webapp server in the future. Do you mean any portlets or JSR-168 portlets? Basically it looks like the web application has to support two view styles. One style is the classical Tiles and regionalisation of the JSP view. For instance you would have a corporate header, footer, a navigation menu and a content area. This is something that every web developer like myself has done over the last five years. The other style is to chuck all the extra tiles stuff away like the header, portal and menu system. For the portlet view just render the content region. The content view is the same as it would with the Tiles regions. I have called this a ``style'', but now I come to think of it ought to be called a ``mode'' as in mode of (render) employment. Thoughts are most welcome, even from the Component-oriented people. Any more ideas more than welcomed. How about this as food for thought: http://jspcontrols.sourceforge.net Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Change status code returned when validate fails
On 2/21/06, Jose Manuel Valladares [EMAIL PROTECTED] wrote: Hello everybody, In our app we would like to return another status code when the validation fails in the ActionForm. Instead of forwarding to the error page and return 200 we would like to return 202 in some cases. Is it possible to do this? In the execute of the Action is possible because it includes the response as a parameter, but this is not the case with the ActionForm. Any help would be greatly appreciated. Do not use automatic validation, set validate=false in your action mapping. Do not use input attribute of an action mapping. By turning autovalidation off your Action.execute() will always get called, so you can return whatever you like. Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestProcessor processPopulate heavily increases memory usage
Session-scoped form can affect memory footprint on the first load and barely on update. He gets +30M on each load. I doubt that reasonably designed session-scoped form can be at fault here. It would sit there, but it would not grow that fast. There should be something else that he allocates. BTW, his log shows request-scoped form. Willem, try to create an empty action/form pair and test it. I suppose this is something that you create. Michael. On 2/21/06, Joe Germuska [EMAIL PROTECTED] wrote: Do you have a session scoped form with one or more FormFile properties? Consider switching the scope to request, or alternatively, using the controller element to reduce the size of the in-memory file representation before the data is written to disk (see the memFileSize attribute described at http://struts.apache.org/struts-action/userGuide/configuration.html#controller_config ) Joe At 6:12 PM +0100 2/21/06, [EMAIL PROTECTED] wrote: Hi, Last week we migrated our Struts 1.0 application to 1.2.8. As far as we can tell, we correctly followed the migration steps inbetween. Since the migration we have noticed the following weird behaviour: upon submitting a form from a jsp to as struts form/action, the method processPopulate of RequestProcessor will increase memory usage on our windows box by some 30M for each call. Unfortunately, this extra memory is not freed, not even after waiting more than say one hour. After a few such requests, needless to say, this produces OutOfMemoryErrors. I pinpointed the memory usage to this method by setting log4j.logger.org.apache.struts=DEBUG in my log4j.properties. In the log, after form submission, the following info appears: DEBUG: RequestUtils.createActionForm.300 - -- [EMAIL PROTECTED] (21 feb 2006 17:59:31,156) DEBUG: RequestProcessor.processActionForm.327 - Storing ActionForm bean instance in scope 'request' under attribute key 'incidentForm' (21 feb 2006 17:59:31,156) DEBUG: RequestProcessor.processPopulate.793 - Populating bean properties from this request (21 feb 2006 17:59:35,616) DEBUG: CommonsMultipartRequestHandler.getRepositoryPath.388 - File upload temp dir: C:\dev\workspace-reconstruct-hibernate\Attend\work\org\apache\jsp (21 feb 2006 17:59:35,772) What could be the cause of this excessive memory increase? Could it be that the entire Struts config is accidentally reloaded because of a problem in our configuration? Thanks, Willem - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [shale] Add getMessage() method to AbstractViewController?
Craig McClanahan wrote: On 2/21/06, Richard Wallace [EMAIL PROTECTED] wrote: Hello everyone, I have a simple feature request. Can we get a method added to the AbstractViewController class that gets a message out of the applications configured message bundle? Something as simple as: protected String getMessage (String messageKey) { ResourceBundle rb = ResourceBundle.getBundle (getApplication ().getMessageBundle (), getFacesContext ().getViewRoot ().getLocale ()); return rb.getString (messageKey); } Something that might also be useful is one that takes an optional Object[] as parameters and then uses MessageFormat to format the message: protected String getMessage (String messageKey, Object[] params) { String messageBundleName = getApplication ().getMessageBundle (); Locale locale = getFacesContext ().getViewRoot ().getLocale (); ResourceBundle rb = ResourceBundle.getBundle (messageBundleName, locale); String msgPattern = rb.getString (messageKey); String message; if (params != null) { message = MessageFormat.format (msgPattern, params); } else { message = msgPattern; } return message; } I've found this to be of tremendous help in simplifying error handling code, or when I want to display a success message or something like that. It makes things so much cleaner. You can do something similar in spirit to this with the existing org.apache.shale.util.Messages class. The javadocs describe how to define an application scope managed bean, configured for a particuar resource bundle. Let's say you stored this under managed bean name messages. Now, you can generate formatted messages with it: Messages messages = (Messages) getBean(messages); Locale locale = context.getViewRoot().getLocale(); String localizedMessage = messages.getMessage(message.key, locale, new Object[] { ... parameters ... }); Is that close enough to what you are after? I didn't realize there was a component that already wrapped the message formatting and all, that is pretty cool. But it's not exactly what I was looking for. I'm looking for something dead simple with minimal extra lines of code. I'm always forgetting what params I need to create the message bundle and where to look them up from. I always find myself just copying the same bits of code from one place to another. So I just want something that would give me a one-liner that I have to remember to get the message I need. Before I started using Shale and the AbstractViewController I had an abstract class that all my backing beans extended that simply provided these kinds of ease of use methods. The only one that I've found missing in the AbstractViewController is this getMessage() method. If nothing else I'll just change by abstract class to extend the AbstractViewController and just add the getMessage() methods, but I thought others might find it useful as well so thought I'd bring it up. What do you think? Thanks, Rich Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [shale] Add getMessage() method to AbstractViewController?
On 2/21/06, Richard Wallace [EMAIL PROTECTED] wrote: Craig McClanahan wrote: On 2/21/06, Richard Wallace [EMAIL PROTECTED] wrote: Hello everyone, I have a simple feature request. Can we get a method added to the AbstractViewController class that gets a message out of the applications configured message bundle? Something as simple as: protected String getMessage (String messageKey) { ResourceBundle rb = ResourceBundle.getBundle (getApplication ().getMessageBundle (), getFacesContext ().getViewRoot ().getLocale ()); return rb.getString (messageKey); } Something that might also be useful is one that takes an optional Object[] as parameters and then uses MessageFormat to format the message: protected String getMessage (String messageKey, Object[] params) { String messageBundleName = getApplication ().getMessageBundle (); Locale locale = getFacesContext ().getViewRoot ().getLocale (); ResourceBundle rb = ResourceBundle.getBundle(messageBundleName, locale); String msgPattern = rb.getString (messageKey); String message; if (params != null) { message = MessageFormat.format (msgPattern, params); } else { message = msgPattern; } return message; } I've found this to be of tremendous help in simplifying error handling code, or when I want to display a success message or something like that. It makes things so much cleaner. You can do something similar in spirit to this with the existing org.apache.shale.util.Messages class. The javadocs describe how to define an application scope managed bean, configured for a particuar resource bundle. Let's say you stored this under managed bean name messages. Now, you can generate formatted messages with it: Messages messages = (Messages) getBean(messages); Locale locale = context.getViewRoot().getLocale(); String localizedMessage = messages.getMessage(message.key, locale, new Object[] { ... parameters ... }); Is that close enough to what you are after? I didn't realize there was a component that already wrapped the message formatting and all, that is pretty cool. But it's not exactly what I was looking for. I'm looking for something dead simple with minimal extra lines of code. I'm always forgetting what params I need to create the message bundle and where to look them up from. I always find myself just copying the same bits of code from one place to another. So I just want something that would give me a one-liner that I have to remember to get the message I need. Before I started using Shale and the AbstractViewController I had an abstract class that all my backing beans extended that simply provided these kinds of ease of use methods. The only one that I've found missing in the AbstractViewController is this getMessage() method. If nothing else I'll just change by abstract class to extend the AbstractViewController and just add the getMessage() methods, but I thought others might find it useful as well so thought I'd bring it up. I like the basic idea ... the challenge is finding the right balance between simplicity and flexibility when you add helper methods like this. For example, your code looks up the message bundle defined in faces-config.xml(yay simplicity!), but doesn't let me use more than one resource bundle (boo flexibiolity!). :-) Craig What do you think? Thanks, Rich Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
application resources on iplanet
Hi i am deploying on tomcat, but now i need to move to my production environment iPlanetTM Web Server, Enterprise Edition 6.0, and i having problems with the application resource properties, the same war works fine on tomcat and sun one app server 6.1 SP4, but with this server (iplanet 6.0) it seems like the properties is not found. I have this on my struts-config.xml message-resources parameter=resources.portal null=false/ and i am getting the key as result on iplanet (on tomcat is ok) like ???es.registro.formularioRegistro.nombreEmpresa.nombreVacio??? thanks for your help... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: application resources on iplanet
Since you are not using a package for the resources.portal bundle, are you sure that the resource.portal is in IPlanets classpath? If not, it will not find it. -Original Message- From: Raúl Eduardo Plata [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 2:01 PM To: Struts Users Mailing List Subject: application resources on iplanet Hi i am deploying on tomcat, but now i need to move to my production environment iPlanetTM Web Server, Enterprise Edition 6.0, and i having problems with the application resource properties, the same war works fine on tomcat and sun one app server 6.1 SP4, but with this server (iplanet 6.0) it seems like the properties is not found. I have this on my struts-config.xml message-resources parameter=resources.portal null=false/ and i am getting the key as result on iplanet (on tomcat is ok) like ???es.registro.formularioRegistro.nombreEmpresa.nombreVacio??? thanks for your help... - 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: application resources on iplanet
But the properties is on WEB-INF/classes/resources/portal.properties, is this path on the classpath by default, isn´t? It´s a war file and the classes within WEB-INF/classes are found. Thanks, Raúl Scott Purcell escribió: Since you are not using a package for the resources.portal bundle, are you sure that the resource.portal is in IPlanets classpath? If not, it will not find it. -Original Message- From: Raúl Eduardo Plata [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 2:01 PM To: Struts Users Mailing List Subject: application resources on iplanet Hi i am deploying on tomcat, but now i need to move to my production environment iPlanetTM Web Server, Enterprise Edition 6.0, and i having problems with the application resource properties, the same war works fine on tomcat and sun one app server 6.1 SP4, but with this server (iplanet 6.0) it seems like the properties is not found. I have this on my struts-config.xml message-resources parameter=resources.portal null=false/ and i am getting the key as result on iplanet (on tomcat is ok) like ???es.registro.formularioRegistro.nombreEmpresa.nombreVacio??? thanks for your help... - 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: application resources on iplanet
Yes, I believe you are correct. If the classes are found so should the resources. . We use IPlanet and I have never seen that issue. I will seek information from our system admin, and will email back. -Original Message- From: Raúl Eduardo Plata [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 2:26 PM To: Struts Users Mailing List Subject: Re: application resources on iplanet But the properties is on WEB-INF/classes/resources/portal.properties, is this path on the classpath by default, isn´t? It´s a war file and the classes within WEB-INF/classes are found. Thanks, Raúl Scott Purcell escribió: Since you are not using a package for the resources.portal bundle, are you sure that the resource.portal is in IPlanets classpath? If not, it will not find it. -Original Message- From: Raúl Eduardo Plata [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 2:01 PM To: Struts Users Mailing List Subject: application resources on iplanet Hi i am deploying on tomcat, but now i need to move to my production environment iPlanetTM Web Server, Enterprise Edition 6.0, and i having problems with the application resource properties, the same war works fine on tomcat and sun one app server 6.1 SP4, but with this server (iplanet 6.0) it seems like the properties is not found. I have this on my struts-config.xml message-resources parameter=resources.portal null=false/ and i am getting the key as result on iplanet (on tomcat is ok) like ???es.registro.formularioRegistro.nombreEmpresa.nombreVacio??? thanks for your help... - 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]
using tiles and setting a cookie
I'm having a problem setting a cookie inside of a Controller class. My custom controller extends from the base Controller class. Inside of my class, I'm simply trying to set a cookie to the HttpServletResponse. Inside of a Strut Action class, it's been working just fine. But in the controller, the response.addCookie method seems to do nothing. Using a debugger I see no value change. No exception is thrown and the application seems to progress as if nothing happened. Any ideas? Did I forget to configure something? Is it a poor practice to set a cookie in a Controller in the first place? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to retain form data when disabling input in html:text
I have html:text property=bucketName disabled=true size=40/ I populate html:text with data from DB. I want to disable input for this property, but when I get form data back in Action form bean does not have data for this property bucketName How do i retain data after disabling input in html:text. Thanks. This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates
Re: [shale] Add getMessage() method to AbstractViewController?
Craig McClanahan wrote: On 2/21/06, Richard Wallace [EMAIL PROTECTED] wrote: Craig McClanahan wrote: On 2/21/06, Richard Wallace [EMAIL PROTECTED] wrote: Hello everyone, I have a simple feature request. Can we get a method added to the AbstractViewController class that gets a message out of the applications configured message bundle? Something as simple as: protected String getMessage (String messageKey) { ResourceBundle rb = ResourceBundle.getBundle (getApplication ().getMessageBundle (), getFacesContext ().getViewRoot ().getLocale ()); return rb.getString (messageKey); } Something that might also be useful is one that takes an optional Object[] as parameters and then uses MessageFormat to format the message: protected String getMessage (String messageKey, Object[] params) { String messageBundleName = getApplication ().getMessageBundle (); Locale locale = getFacesContext ().getViewRoot ().getLocale (); ResourceBundle rb = ResourceBundle.getBundle(messageBundleName, locale); String msgPattern = rb.getString (messageKey); String message; if (params != null) { message = MessageFormat.format (msgPattern, params); } else { message = msgPattern; } return message; } I've found this to be of tremendous help in simplifying error handling code, or when I want to display a success message or something like that. It makes things so much cleaner. You can do something similar in spirit to this with the existing org.apache.shale.util.Messages class. The javadocs describe how to define an application scope managed bean, configured for a particuar resource bundle. Let's say you stored this under managed bean name messages. Now, you can generate formatted messages with it: Messages messages = (Messages) getBean(messages); Locale locale = context.getViewRoot().getLocale(); String localizedMessage = messages.getMessage(message.key, locale, new Object[] { ... parameters ... }); Is that close enough to what you are after? I didn't realize there was a component that already wrapped the message formatting and all, that is pretty cool. But it's not exactly what I was looking for. I'm looking for something dead simple with minimal extra lines of code. I'm always forgetting what params I need to create the message bundle and where to look them up from. I always find myself just copying the same bits of code from one place to another. So I just want something that would give me a one-liner that I have to remember to get the message I need. Before I started using Shale and the AbstractViewController I had an abstract class that all my backing beans extended that simply provided these kinds of ease of use methods. The only one that I've found missing in the AbstractViewController is this getMessage() method. If nothing else I'll just change by abstract class to extend the AbstractViewController and just add the getMessage() methods, but I thought others might find it useful as well so thought I'd bring it up. I like the basic idea ... the challenge is finding the right balance between simplicity and flexibility when you add helper methods like this. For example, your code looks up the message bundle defined in faces-config.xml(yay simplicity!), but doesn't let me use more than one resource bundle (boo flexibiolity!). :-) That's the problem with trying to define any API though, isn't it? Trying to find the right balance of simplicity and flexibility. From the books I've read on JSF it seems that users are expected to define their error and other messages in a bundle and tell the web application about it using faces-config.xml. That's been my interpretation at least, and seems to be the way most other people lean. So, I'm not sure flexibility is a big concern. That being said, I wouldn't be entirely opposed to another form for the method, that being getMessage (String messageKey, String messageBundle). Of course, that does add some concern of an increasingly complex interface, but that always seems to happen when you add flexibility. Rich Craig What do you think? Thanks, Rich Craig - 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: How to retain form data when disabling input in html:text
On 2/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have html:text property=bucketName disabled=true size=40/ I populate html:text with data from DB. I want to disable input for this property, but when I get form data back in Action form bean does not have data for this property bucketName How do i retain data after disabling input in html:text. Short answer ... you cannot. By defintion in HTML, disabled fields are not sent to the server, so the server has no opportunity to keep them for you. On the other hand, if you make the field read only instead of disabled, the value *will* be sent to the server ... but the user will not be able to edit it. Thanks. Craig This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates
Re: How to retain form data when disabling input in html:text
Thanks Craig: I worked for what I wanted to achieve. Only with read-only property setting, it does not grey out input text field. I have to find out what to set so that it changes appearance when read-only property is set. Thanks. Digant Craig McClanahan [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 02/21/2006 05:14 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: Subject:Re: How to retain form data when disabling input in html:text On 2/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have html:text property=bucketName disabled=true size=40/ I populate html:text with data from DB. I want to disable input for this property, but when I get form data back in Action form bean does not have data for this property bucketName How do i retain data after disabling input in html:text. Short answer ... you cannot. By defintion in HTML, disabled fields are not sent to the server, so the server has no opportunity to keep them for you. On the other hand, if you make the field read only instead of disabled, the value *will* be sent to the server ... but the user will not be able to edit it. Thanks. Craig This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates.
Struts Message Resources
I have a struts application in which I use the message resources for most of my view pages. Using bean:message, etc. All is good. But I have created some tag libraries, in which run in the same struts app, and I need to get to them. I know you can get the properties from an action class through the struts api ... but is there anyway to get them from the application context, when you are in a tag. When I look through the struts api, it looks like struts is storing it in the application context ... but I am not sure where or how I can get them. In Mesage Resources Configurtion it shows this: key - ServletContext attribute key to store this bundle. [org.apache.struts.action.MESSAGE] (optional) But it was my knowledge tht key was just another property file, and you can use the key when using the property. Any help would be appreciated. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: application resources on iplanet
I checked with my Admin who managers our IPLanet, and he says there is no additional classpath configuration. That IPlanet creates the classpath from /WEB-INF/classes automatically. Scott On 2/21/06, Scott Purcell [EMAIL PROTECTED] wrote: Yes, I believe you are correct. If the classes are found so should the resources. . We use IPlanet and I have never seen that issue. I will seek information from our system admin, and will email back. -Original Message- From: Raúl Eduardo Plata [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 2:26 PM To: Struts Users Mailing List Subject: Re: application resources on iplanet But the properties is on WEB-INF/classes/resources/portal.properties, is this path on the classpath by default, isn´t? It´s a war file and the classes within WEB-INF/classes are found. Thanks, Raúl Scott Purcell escribió: Since you are not using a package for the resources.portal bundle, are you sure that the resource.portal is in IPlanets classpath? If not, it will not find it. -Original Message- From: Raúl Eduardo Plata [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 2:01 PM To: Struts Users Mailing List Subject: application resources on iplanet Hi i am deploying on tomcat, but now i need to move to my production environment iPlanetTM Web Server, Enterprise Edition 6.0, and i having problems with the application resource properties, the same war works fine on tomcat and sun one app server 6.1 SP4, but with this server (iplanet 6.0) it seems like the properties is not found. I have this on my struts-config.xml message-resources parameter=resources.portal null=false/ and i am getting the key as result on iplanet (on tomcat is ok) like ???es.registro.formularioRegistro.nombreEmpresa.nombreVacio??? thanks for your help... - 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: using tiles and setting a cookie
Brian, When and where are you looking for a value change with your debugger? You do know that the cookie won't be seen until the response ends, right? The NEW cookie is given to the client's browser and won't be seen by the server until the client's next request. Can you give the controller method and some relevant code pieces? Regards, David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 4:47 PM To: user@struts.apache.org Subject: using tiles and setting a cookie I'm having a problem setting a cookie inside of a Controller class. My custom controller extends from the base Controller class. Inside of my class, I'm simply trying to set a cookie to the HttpServletResponse. Inside of a Strut Action class, it's been working just fine. But in the controller, the response.addCookie method seems to do nothing. Using a debugger I see no value change. No exception is thrown and the application seems to progress as if nothing happened. Any ideas? Did I forget to configure something? Is it a poor practice to set a cookie in a Controller in the first place? - 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: How to retain form data when disabling input in html:text
On 2/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have html:text property=bucketName disabled=true size=40/ I populate html:text with data from DB. I want to disable input for this property, but when I get form data back in Action form bean does not have data for this property bucketName How do i retain data after disabling input in html:text. Use session-scoped form or reload this value each time from the database. Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to retain form data when disabling input in html:text
That is display problem. You can use css to make the field gray or red etc. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 3:57 PM To: Struts Users Mailing List Cc: [EMAIL PROTECTED]; Struts Users Mailing List Subject: Re: How to retain form data when disabling input in html:text Thanks Craig: I worked for what I wanted to achieve. Only with read-only property setting, it does not grey out input text field. I have to find out what to set so that it changes appearance when read-only property is set. Thanks. Digant Craig McClanahan [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 02/21/2006 05:14 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: Subject:Re: How to retain form data when disabling input in html:text On 2/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have html:text property=bucketName disabled=true size=40/ I populate html:text with data from DB. I want to disable input for this property, but when I get form data back in Action form bean does not have data for this property bucketName How do i retain data after disabling input in html:text. Short answer ... you cannot. By defintion in HTML, disabled fields are not sent to the server, so the server has no opportunity to keep them for you. On the other hand, if you make the field read only instead of disabled, the value *will* be sent to the server ... but the user will not be able to edit it. Thanks. Craig This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
error-page design question
Our app currently throws a custom UnavailableException from a couple of places inside our Action handlers when the app is offline doing end-of-day processing. We thought we had this situation covered from the UI perspective, as we'd configured the following mapping in our web.xml: error-page exception-typeUnavailableException/exception-type location/unavailable.jsp/location /error-page However, our end-of-day processing now shuts down our web server, which causes the webapp to unload, and the unavailable.jsp to become inaccessible. The problem I've got is that if the user tries to access the webapp between the time it has started unloading and the time the web server goes down, instead of our unavailable.jsp, the user sees an ugly HTTP 500 error and a stack trace. What I'd like to do, as it affects the smallest amount of code, is something like the following: error-page exception-typeUnavailableException/exception-type error-code503/error-code /error-page That is, if the container catches the UnavailableException, generate a standard HTTP 503 error back to the browser. Is something like this possible to do in web.xml? (I don't see it in the DTD.) Or is my only option to catch the exception myself and do something like HttpServletResponse.sendError(SC_SERVICE_UNAVAILABLE) in the code? Thanks. Jay | Jay Burgess [Vertical Technology Group] | http://www.vtgroup.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using tiles and setting a cookie
I was unaware of that actually. But, even outside of the debugger the cookie isn't seen on the client side. And it isn't seen on the next request. Here's some of the code - In the controller class (it's an abstract class): public void execute(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception { Object someObj= someAbstractMethod(componentContext,request,response,servletContext); // set a cookie Cookie cookie = new Cookie(cookieName,cookieValue); cookie.setDomain(.mysite.com); cookie.setMaxAge(-1); response.addCookie(cookie); } Later on, in another request, I try to get the cookie using - Cookie[] cookies = request.getCookies() But my new cookie is nowhere to be found. As I said in the original post, in my application it's working fine when I set the cookies in Actions, but not in Controllers. On 2/21/06, David G. Friedman [EMAIL PROTECTED] wrote: Brian, When and where are you looking for a value change with your debugger? You do know that the cookie won't be seen until the response ends, right? The NEW cookie is given to the client's browser and won't be seen by the server until the client's next request. Can you give the controller method and some relevant code pieces? Regards, David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 4:47 PM To: user@struts.apache.org Subject: using tiles and setting a cookie I'm having a problem setting a cookie inside of a Controller class. My custom controller extends from the base Controller class. Inside of my class, I'm simply trying to set a cookie to the HttpServletResponse. Inside of a Strut Action class, it's been working just fine. But in the controller, the response.addCookie method seems to do nothing. Using a debugger I see no value change. No exception is thrown and the application seems to progress as if nothing happened. Any ideas? Did I forget to configure something? Is it a poor practice to set a cookie in a Controller in the first place? - 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: using tiles and setting a cookie
Have you tried it without the domain setting to ensure that your chosen domain of .mysite.com isn't interfering with the cookie handoff? There is the possibility that the browser is configured to accept anything other than the exact hostname, though you have probably looked into that and tried that already. I made that suggestion since I've previously read of problems like that on this list. Regards, David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 6:42 PM To: Struts Users Mailing List Subject: Re: using tiles and setting a cookie I was unaware of that actually. But, even outside of the debugger the cookie isn't seen on the client side. And it isn't seen on the next request. Here's some of the code - In the controller class (it's an abstract class): public void execute(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception { Object someObj= someAbstractMethod(componentContext,request,response,servletContext); // set a cookie Cookie cookie = new Cookie(cookieName,cookieValue); cookie.setDomain(.mysite.com); cookie.setMaxAge(-1); response.addCookie(cookie); } Later on, in another request, I try to get the cookie using - Cookie[] cookies = request.getCookies() But my new cookie is nowhere to be found. As I said in the original post, in my application it's working fine when I set the cookies in Actions, but not in Controllers. On 2/21/06, David G. Friedman [EMAIL PROTECTED] wrote: Brian, When and where are you looking for a value change with your debugger? You do know that the cookie won't be seen until the response ends, right? The NEW cookie is given to the client's browser and won't be seen by the server until the client's next request. Can you give the controller method and some relevant code pieces? Regards, David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 4:47 PM To: user@struts.apache.org Subject: using tiles and setting a cookie I'm having a problem setting a cookie inside of a Controller class. My custom controller extends from the base Controller class. Inside of my class, I'm simply trying to set a cookie to the HttpServletResponse. Inside of a Strut Action class, it's been working just fine. But in the controller, the response.addCookie method seems to do nothing. Using a debugger I see no value change. No exception is thrown and the application seems to progress as if nothing happened. Any ideas? Did I forget to configure something? Is it a poor practice to set a cookie in a Controller in the first place? - 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: using tiles and setting a cookie
Yeah that doesn't seem to be the problem, and the .mysite.com is working with an Action anyway... setting the cookie the same exact way. I'm wondering if this is some trouble with tiles. I see using my debugger that the internals of the Response object in a Controller seem different then it does in an Action. On 2/21/06, David G. Friedman [EMAIL PROTECTED] wrote: Have you tried it without the domain setting to ensure that your chosen domain of .mysite.com isn't interfering with the cookie handoff? There is the possibility that the browser is configured to accept anything other than the exact hostname, though you have probably looked into that and tried that already. I made that suggestion since I've previously read of problems like that on this list. Regards, David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 6:42 PM To: Struts Users Mailing List Subject: Re: using tiles and setting a cookie I was unaware of that actually. But, even outside of the debugger the cookie isn't seen on the client side. And it isn't seen on the next request. Here's some of the code - In the controller class (it's an abstract class): public void execute(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception { Object someObj= someAbstractMethod(componentContext,request,response,servletContext); // set a cookie Cookie cookie = new Cookie(cookieName,cookieValue); cookie.setDomain(.mysite.com); cookie.setMaxAge(-1); response.addCookie(cookie); } Later on, in another request, I try to get the cookie using - Cookie[] cookies = request.getCookies() But my new cookie is nowhere to be found. As I said in the original post, in my application it's working fine when I set the cookies in Actions, but not in Controllers. On 2/21/06, David G. Friedman [EMAIL PROTECTED] wrote: Brian, When and where are you looking for a value change with your debugger? You do know that the cookie won't be seen until the response ends, right? The NEW cookie is given to the client's browser and won't be seen by the server until the client's next request. Can you give the controller method and some relevant code pieces? Regards, David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 4:47 PM To: user@struts.apache.org Subject: using tiles and setting a cookie I'm having a problem setting a cookie inside of a Controller class. My custom controller extends from the base Controller class. Inside of my class, I'm simply trying to set a cookie to the HttpServletResponse. Inside of a Strut Action class, it's been working just fine. But in the controller, the response.addCookie method seems to do nothing. Using a debugger I see no value change. No exception is thrown and the application seems to progress as if nothing happened. Any ideas? Did I forget to configure something? Is it a poor practice to set a cookie in a Controller in the first place? - 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: using tiles and setting a cookie
Brian, Are your logs showing any errors about the reponse already being committed? If the headers have already been sent then adding cookies after that would be a useless task. But I think you would probably have seen Java Exceptions at that point. -David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 6:59 PM To: Struts Users Mailing List Subject: Re: using tiles and setting a cookie Yeah that doesn't seem to be the problem, and the .mysite.com is working with an Action anyway... setting the cookie the same exact way. I'm wondering if this is some trouble with tiles. I see using my debugger that the internals of the Response object in a Controller seem different then it does in an Action. On 2/21/06, David G. Friedman [EMAIL PROTECTED] wrote: Have you tried it without the domain setting to ensure that your chosen domain of .mysite.com isn't interfering with the cookie handoff? There is the possibility that the browser is configured to accept anything other than the exact hostname, though you have probably looked into that and tried that already. I made that suggestion since I've previously read of problems like that on this list. Regards, David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 6:42 PM To: Struts Users Mailing List Subject: Re: using tiles and setting a cookie I was unaware of that actually. But, even outside of the debugger the cookie isn't seen on the client side. And it isn't seen on the next request. Here's some of the code - In the controller class (it's an abstract class): public void execute(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception { Object someObj= someAbstractMethod(componentContext,request,response,servletContext); // set a cookie Cookie cookie = new Cookie(cookieName,cookieValue); cookie.setDomain(.mysite.com); cookie.setMaxAge(-1); response.addCookie(cookie); } Later on, in another request, I try to get the cookie using - Cookie[] cookies = request.getCookies() But my new cookie is nowhere to be found. As I said in the original post, in my application it's working fine when I set the cookies in Actions, but not in Controllers. On 2/21/06, David G. Friedman [EMAIL PROTECTED] wrote: Brian, When and where are you looking for a value change with your debugger? You do know that the cookie won't be seen until the response ends, right? The NEW cookie is given to the client's browser and won't be seen by the server until the client's next request. Can you give the controller method and some relevant code pieces? Regards, David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 4:47 PM To: user@struts.apache.org Subject: using tiles and setting a cookie I'm having a problem setting a cookie inside of a Controller class. My custom controller extends from the base Controller class. Inside of my class, I'm simply trying to set a cookie to the HttpServletResponse. Inside of a Strut Action class, it's been working just fine. But in the controller, the response.addCookie method seems to do nothing. Using a debugger I see no value change. No exception is thrown and the application seems to progress as if nothing happened. Any ideas? Did I forget to configure something? Is it a poor practice to set a cookie in a Controller in the first place? - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using tiles and setting a cookie
No, I'm not seeing an exception for that. I'm starting to think now that perhaps I'm doing this in the wrong place. After all the purpose of a controller should simply be to prepare data for rendering in a JSP tile. I'm wondering though if this is the case what the purpose is of having the HttpServletRequest as a parameter to a Controller? I'm now considering moving my database code into an action, and then setting the cookie in there before handing off to a slimmed-down controller. On 2/21/06, David G. Friedman [EMAIL PROTECTED] wrote: Brian, Are your logs showing any errors about the reponse already being committed? If the headers have already been sent then adding cookies after that would be a useless task. But I think you would probably have seen Java Exceptions at that point. -David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 6:59 PM To: Struts Users Mailing List Subject: Re: using tiles and setting a cookie Yeah that doesn't seem to be the problem, and the .mysite.com is working with an Action anyway... setting the cookie the same exact way. I'm wondering if this is some trouble with tiles. I see using my debugger that the internals of the Response object in a Controller seem different then it does in an Action. On 2/21/06, David G. Friedman [EMAIL PROTECTED] wrote: Have you tried it without the domain setting to ensure that your chosen domain of .mysite.com isn't interfering with the cookie handoff? There is the possibility that the browser is configured to accept anything other than the exact hostname, though you have probably looked into that and tried that already. I made that suggestion since I've previously read of problems like that on this list. Regards, David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 6:42 PM To: Struts Users Mailing List Subject: Re: using tiles and setting a cookie I was unaware of that actually. But, even outside of the debugger the cookie isn't seen on the client side. And it isn't seen on the next request. Here's some of the code - In the controller class (it's an abstract class): public void execute(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception { Object someObj= someAbstractMethod(componentContext,request,response,servletContext); // set a cookie Cookie cookie = new Cookie(cookieName,cookieValue); cookie.setDomain(.mysite.com); cookie.setMaxAge(-1); response.addCookie(cookie); } Later on, in another request, I try to get the cookie using - Cookie[] cookies = request.getCookies() But my new cookie is nowhere to be found. As I said in the original post, in my application it's working fine when I set the cookies in Actions, but not in Controllers. On 2/21/06, David G. Friedman [EMAIL PROTECTED] wrote: Brian, When and where are you looking for a value change with your debugger? You do know that the cookie won't be seen until the response ends, right? The NEW cookie is given to the client's browser and won't be seen by the server until the client's next request. Can you give the controller method and some relevant code pieces? Regards, David -Original Message- From: brian papa [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 4:47 PM To: user@struts.apache.org Subject: using tiles and setting a cookie I'm having a problem setting a cookie inside of a Controller class. My custom controller extends from the base Controller class. Inside of my class, I'm simply trying to set a cookie to the HttpServletResponse. Inside of a Strut Action class, it's been working just fine. But in the controller, the response.addCookie method seems to do nothing. Using a debugger I see no value change. No exception is thrown and the application seems to progress as if nothing happened. Any ideas? Did I forget to configure something? Is it a poor practice to set a cookie in a Controller in the first place? - 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,
Does return null from Action class send 200 OK response?
Does return null from Action class send 200 OK response? If not, how do I do it? TIA, Brian Barnett Broadband interface (RIA) + mail box saftey = http://Struts_User_List.roomity.com *Your* clubs, no sign up to read, ad supported; try broadband internet.
Re: Does return null from Action class send 200 OK response?
On 2/21/06, ooper [EMAIL PROTECTED] wrote: Does return null from Action class send 200 OK response? Generally, no. If not, how do I do it? return null means that you took care of response. This means that you set up response headers and response content whatever you feel appropriate, and you instructed Struts not to mess with it. Response object is sent to Action.execute() method as parameter. Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles on Tomcat 5.0.30
Hi All I have used tiles in while this week and when I look at Tiles user guide, it says If you are using Struts 1.2.x you will need to also make sure you are using the |org.apache.struts.tiles.TilesRequestProcessor| or a |RequestProcessor| class that extends it. My application is working fine without it. Can you please explain the reasons for this? Thanks in advance for any replies. anil I am using struts 1.2.8. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Message Resources
Jim Reynolds wrote: All is good. But I have created some tag libraries, in which run in the same struts app, and I need to get to them. I know you can get the properties from an action class through the struts api ... but is there anyway to get them from the application context, when you are in a tag. I honestly don't remember how I did that, but I do know I figured it out by looking at the source code for the message tag. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using tiles and setting a cookie
brian papa wrote: I'm starting to think now that perhaps I'm doing this in the wrong place. After all the purpose of a controller should simply be to prepare data for rendering in a JSP tile. I'm wondering though if this is the case what the purpose is of having the HttpServletRequest as a parameter to a Controller? So you can put the data you just prepared into the request for rendering in a JSP tile? ;) Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using tiles and setting a cookie
Oops, meant to question the presence of the Response there. On 2/21/06, Dave Newton [EMAIL PROTECTED] wrote: brian papa wrote: I'm starting to think now that perhaps I'm doing this in the wrong place. After all the purpose of a controller should simply be to prepare data for rendering in a JSP tile. I'm wondering though if this is the case what the purpose is of having the HttpServletRequest as a parameter to a Controller? So you can put the data you just prepared into the request for rendering in a JSP tile? ;) Dave - 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]
Reg: DynaActionforms and ActionForms
Hi, I want some information regarding the difference between DynaActionforms and ActionForms and advantages of DynaActionforms over ActionForms. I need the code of subclassing the dynaforms and using it. For example, I am having a BaseForm with the variables pageno( page number), action (action to be performed like save, update, delete, create). This form I have declared in struts-config.xml. Now all the other forms I am creating should extend my BaseForm. How can I do this using DynaActionForms in struts-config.xml? Kindly reply to this mail as soon as possible as it is bit urgent. Thanks and Regards Shasi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Sorting paging search results with delete button for each row?
Hello All, What is the best way to sort and page search results, (with delete button for each row) using Struts? Are there are any open source tag libraries to achieve this? Looked at displaytag. I want to retrieve data from the database using hibernate. Many Thanks!!
Disabling Back Button in IE
Hi Anyone can tell how to disable the Back button in IE through our Code. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Disabling Back Button in IE
Can't (and shouldn't) be done. The closest you're likely to get it open your app in a popup window with no menu, though the user can still hit backspace. A better idea is to fix the (assumed) re-post issues in your application. -Josh -- His comrades fought beside him, Van Owen and the rest... But of all the thompson gunners- Roland was the best. Josh McDonald Analyst Programmer Information Technology Ph: 61 7 3006 6460 Email: [EMAIL PROTECTED] [EMAIL PROTECTED] 22/02/2006 3:19:22 pm Hi Anyone can tell how to disable the Back button in IE through our Code. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *** Messages included in this e-mail and any of its attachments are those of the author unless specifically stated to represent WorkCover Queensland. The contents of this message are to be used for the intended purpose only and are to be kept confidential at all times. This message may contain privileged information directed only to the intended addressee/s. Accidental receipt of this information should be deleted promptly and the sender notified. This e-mail has been scanned by Sophos for known viruses. However, no warranty nor liability is implied in this respect.
RE: Disabling Back Button in IE
try using this in your jsp if you are in java platform script history.forward(); /script -Original Message- From: vasumathi [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 22, 2006 10:49 AM To: user@struts.apache.org Subject: Disabling Back Button in IE Hi Anyone can tell how to disable the Back button in IE through our Code. - 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]