RE: Logic Iterate tag
Logic:iterate tag helps in creating cleaner and concise code. It helps you achieve near to zero percent java scripplet code in jsp It also has a number of useful features as well information about which you can get from Struts online documentation Regards, Satish -Original Message- From: Aditya Athalye [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 10:44 AM To: [EMAIL PROTECTED] Subject: Logic Iterate tag Hi All, I am currently using for loops and iterators for traversing arrays and coolections in JSP. I am planning to use this logic : iterate tag in place of this. I need to know if there is any advantage of using this tag in terms of performance or reduction in Java code in JSP etc. Thanks and Regards Aditya - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logic Iterate tag
Hi Aditya, Performance wise the logic:iterate tag will be performance degrading(infact using any custom Tag leads to a performance degradation) but the advantages (in terms of code clarity, code mainetanance, Incremental Code change,code understandibility, code reusability) will mostly outweigh the performance aspect. Thanks, Satish -Original Message- From: Aditya Athalye [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 11:52 AM To: Kataria, Satish Subject: RE: Logic Iterate tag Hi Satish, I understand that it will avoid Java code to a great extent. But, I want to know how I can gain in terms of performance using logic:iterate. -Original Message- From: Kataria, Satish [mailto:[EMAIL PROTECTED] Sent: Tue 7/20/2004 11:34 AM To: Struts Users Mailing List; Aditya Athalye Cc: Subject: RE: Logic Iterate tag Logic:iterate tag helps in creating cleaner and concise code. It helps you achieve near to zero percent java scripplet code in jsp It also has a number of useful features as well information about which you can get from Struts online documentation Regards, Satish -Original Message- From: Aditya Athalye [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 10:44 AM To: [EMAIL PROTECTED] Subject: Logic Iterate tag Hi All, I am currently using for loops and iterators for traversing arrays and coolections in JSP. I am planning to use this logic : iterate tag in place of this. I need to know if there is any advantage of using this tag in terms of performance or reduction in Java code in JSP etc. Thanks and Regards Aditya - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multipart forms
Thanks for your answer Niall. If I can't get the parameters in the reset() method, then I don't know how to solve my problem. My ActionForm is on session and it's a wizard-like one. The jsp has tabs to go to any page at any time. What I do with non-multipart forms is something like this in the reset() method: String page = request.getParameter(page); if (page != null page.equals(1)) { String mycheckbox = request.getParameter(mycheckbox); //if mycheckbox==null,the user hasn't checked it-set the property to N mycheckbox == null ? setMycheckbox(N) : setMycheckbox(Y); } else if (page != null page.equals(2)) { ... } This works fine (I'm actually using multibox fields). I'm not using server validation in validate() method for several reasons, so I can't use it. Any idea how can I do this with a multipart form? Thanks again. You can't get them in the reset() method. Parameters in multipart requests are processed later and made available by wrapping the original request in MultipartRequestWrapper and storing the normal request parameters in that wrapper. Thats not done until the form is populated. The first chance you get to do anything is in the form's validate method. Niall - Original Message - From: Diego [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 19, 2004 3:26 PM Subject: Fwd: Multipart forms Hi! I have a problem when I want to get some parameters in the reset() method of an ActionForm. If the form is a normal form, then I simply call request.getParameter(myparameter) and the parameter is retrieved with no problem. But if the form is of type multipart, then I always get null. The parameter table seems to be filled later, on the RequestProcessor. I need to get parameters in the reset() method, specifically the page parameter, to deal with checkboxes in my wizard-style multipage form. How can I do it in the simplest way possible? Thanks in advance. This message was sent using IMP, the Internet Messaging Program. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] RTF PDF export options
fop - http://xml.apache.org/fop/index.html In my opinion better than iText - gives a bit more control. I had problems with layout in iText - it adds funny paragraph spacing (especially with big fonts). For fop - generate an XML file with data, write some XSL to translate data into fop xml, and then process. Can create one xml file, one xsl file, and translate it to what ever you want! Says it doesnt support rtf yet... This is currently not integrated with FOP but it will soon. Might be worth trying their mailing lists to see what's happening with it. With iText, you generate the whole thing programatically. With iText or fop it's easy to do from an action: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException { ByteArrayOutputStream outPDF = null; try { //... generate data here outPDF = ... // set response headers response.setHeader(Cache-Control, max-age=60); response.setContentType(application/pdf); StringBuffer cd = new StringBuffer(); cd.append(inline); cd.append(; filename=); cd.append(whatever); cd.append(.pdf); response.setHeader(Content-disposition, cd.toString()); response.setContentLength(outPDF.size()); // send pdf data ServletOutputStream sos; sos = response.getOutputStream(); outPDF.writeTo(sos); sos.flush(); // return null so it just outputs data (no forward) return null; } Hope that helps, Daniel. -Original Message- From: Barnett, Brian W. [mailto:[EMAIL PROTECTED] Sent: 19 July 2004 23:22 To: '[EMAIL PROTECTED]' Subject: [OT] RTF PDF export options Any suggestions for converting html to RTF and PDF inside an action class and then sending the RTF or PDF back to the client? Open source tools, code snippets, tips tricks, etc. ?? Thanks a bunch. Brian Barnett - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] RTF PDF export options
Did you have a look at JasperReports ( http://jasperreports.sourceforge.net/index.html) ? Jimmy -Original Message- From: Barnett, Brian W. [mailto:[EMAIL PROTECTED] Sent: 19 July 2004 23:22 To: '[EMAIL PROTECTED]' Subject: [OT] RTF PDF export options Any suggestions for converting html to RTF and PDF inside an action class and then sending the RTF or PDF back to the client? Open source tools, code snippets, tips tricks, etc. ?? Thanks a bunch. Brian Barnett - 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: Multipart forms
I can't think of anything you can do in Struts currently to get this to work in the reset method - all the relevant code is in the RequestUtils.populate() method and we would have to refactor the multipart processing to resolve this (maybe you should open an enhacement request in bugzilla for it). Having said that, your code looks like it is doing whats needed to populate your checkbox values - can't you just move this code into the Action's execute method? Niall - Original Message - From: Diego [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 8:26 AM Subject: Re: Multipart forms Thanks for your answer Niall. If I can't get the parameters in the reset() method, then I don't know how to solve my problem. My ActionForm is on session and it's a wizard-like one. The jsp has tabs to go to any page at any time. What I do with non-multipart forms is something like this in the reset() method: String page = request.getParameter(page); if (page != null page.equals(1)) { String mycheckbox = request.getParameter(mycheckbox); //if mycheckbox==null,the user hasn't checked it-set the property to N mycheckbox == null ? setMycheckbox(N) : setMycheckbox(Y); } else if (page != null page.equals(2)) { ... } This works fine (I'm actually using multibox fields). I'm not using server validation in validate() method for several reasons, so I can't use it. Any idea how can I do this with a multipart form? Thanks again. You can't get them in the reset() method. Parameters in multipart requests are processed later and made available by wrapping the original request in MultipartRequestWrapper and storing the normal request parameters in that wrapper. Thats not done until the form is populated. The first chance you get to do anything is in the form's validate method. Niall - Original Message - From: Diego [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 19, 2004 3:26 PM Subject: Fwd: Multipart forms Hi! I have a problem when I want to get some parameters in the reset() method of an ActionForm. If the form is a normal form, then I simply call request.getParameter(myparameter) and the parameter is retrieved with no problem. But if the form is of type multipart, then I always get null. The parameter table seems to be filled later, on the RequestProcessor. I need to get parameters in the reset() method, specifically the page parameter, to deal with checkboxes in my wizard-style multipage form. How can I do it in the simplest way possible? Thanks in advance. This message was sent using IMP, the Internet Messaging Program. - 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]
Multiple Resource Bundles
Hi, I try to use multiple resource bundles that get the strings from a database in an environment using JBoss, Struts and Velocity. I have defined two message-resources in struts-config.xml: message-resources factory=com.bk.web.struts.BKWebStringResourceFactory parameter=StringResources key=Strings/ message-resources factory=com.bk.web.struts.BKWebMessageResourceFactory parameter=ApplicationResources/ During startup of JBoss the createResource() method of both factories is called. But when I call a page on which the strings come from the StringResources bundle the getMessage() method of the ApplicationResources bundle is called. In the HTML code I've placed calls like this (: $msg.get(global.close, StringResources) msg is defined in toolbox.xml: tool keymsg/key classorg.apache.velocity.tools.struts.MessageTool/class /tool What's wrong with my call of $msg.get()? Did I miss anything? Best regards, Ralf. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Looking for Multiple file upload at once example
RE: Looking for Multiple file upload at once examplePaul, I'm cc'ing the list so other can learn about this. The problem is (unless it has been solved and I haven't heard about it) with the commons file uploads cannot upload multiple files as the very same form field name. Your velocity template shows the very same name, uploadedFiles, used for each file. The last time it was discussed, I believe the perp (er.. programmer. LOL) used one field and tried to upload multiple file names in that one field (which is supposedly technically allowed in file uploads, just not working in any struts-distributed commons upload version). Your way of using one file name in different fields on the page is essentially the same thing. Have you thought of changing those fields to index arrays such as: Attachment 1: input type=file name=uploadedFiles[0]/ Attachment 2: input type=file name=uploadedFiles[1]/ Attachment 3: input type=file name=uploadedFiles[2]/ Or you could name them randomly such as uploadFiles1, uploadFiles2, uploadFilesA, uploadFiles27, etc. and use the CommonsMultipartRequestHandler's getFileElements() method to iterate though file uploads without worrying about their names. I suppose it all depends on whether or not you need to I'd recommend using a form with that action, then casting the form's getMultipartRequestHandler() method a bit like so: CommonsMultipartRequestHandler handler = (CommonsMultipartRequestHandler) form.getMultipartRequestHandler(); HashTable files = handlers.getFileElements(); I haven't used it in a while so if I'm doing a typo on a method name, don't kill the messenger. :) Regards, David -Original Message- From: Perliti Scorzoni Paolo [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 3:42 AM To: [EMAIL PROTECTED] Subject: RE: Looking for Multiple file upload at once example Hi David. I'm trying to use a form to upload several files, all at once. I use Struts and Commons facilities (that is the FormFile interface). Here's my action form: public class AttachmentForm extends ActionForm { /* Files to upload */ private FormFile[] uploadedFiles; public FormFile[] getUploadedFiles() { return uploadedFiles; } public void setUploadedFiles(FormFile[] uploadedFiles) { this.uploadedFiles = uploadedFiles; } } And this is the html code I use to populate the action form (I'm using Velocity, but I don't think this is really important): html body ... form name=uploadForm method=post enctype=multipart/form-data action=(...my action...) ... Attachment 1: input type=file name=uploadedFiles/ Attachment 2: input type=file name=uploadedFiles/ Attachment 3: input type=file name=uploadedFiles/ ... /form ... /body /html Everytime I submit the form I obtain this exception: javax.servlet.ServletException: BeanUtils.populate org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254) org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:821) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) java.lang.IllegalArgumentException: argument type mismatch sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) java.lang.reflect.Method.invoke(Method.java:324) org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j ava:1789) org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j ava:1684) org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:17 13) org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019) org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:821) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) If I adjust the java source to manage one file only (ie. FileForm instead of FileForm[]) it works, but as I try to use an array I get the Exception. I use struts 1.1 on Windows XP platform and Tomcat 5.0.24. I've seen your post about this subject on the jakarta struts-user-list and I was wondering if you ever had a chance to solve a similar problem. Is it a
form display
In my form i have an integer, which cannot be initialized to null, however, it shows up in the html:text box as a 0, and i would prefer that it shows up blank when a user FIRST reaches the page. After that, i would like the variable to retain the value which the user has entered. -isaac - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: form display
I find it's better to use Strings for ActionForm attributes, which can then be validated, and copied to correctly typed attributes in DTO beans once validation has passed. This would allow you to hold your null value, as this would be an empty string. -Original Message- From: Isaac Mosquera [mailto:[EMAIL PROTECTED] Sent: 20 July 2004 15:51 To: Struts Users Mailing List Subject: form display In my form i have an integer, which cannot be initialized to null, however, it shows up in the html:text box as a 0, and i would prefer that it shows up blank when a user FIRST reaches the page. After that, i would like the variable to retain the value which the user has entered. -isaac - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For more information about Barclays Capital, please visit our web site at http://www.barcap.com. Internet communications are not secure and therefore the Barclays Group does not accept legal responsibility for the contents of this message. Although the Barclays Group operates anti-virus programmes, it does not accept responsibility for any damage whatsoever that is caused by viruses being passed. Any views or opinions presented are solely those of the author and do not necessarily represent those of the Barclays Group. Replies to this email may be monitored by the Barclays Group for operational or business reasons. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
url rewriting
Is there a way to disable the jsessionid from being appended to the url when a form is submitted? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
form focus
Can someone explain how the focus of a form can be set to one of the elements that failed validation when the form is re-displayed - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Datasource problem again..
-Original Message- From: Koon Yue Lam [mailto:[EMAIL PROTECTED] Sent: Monday, July 19, 2004 6:54 PM To: Struts Users Mailing List; Asif Rahman Subject: Re: Datasource problem again.. Yes, it helps and I know I can get it done if I set the context element in server.xml, but if I set the datasource in server.xml, do I need to set the datasource in struts-config.xml again?? If I am right, I think if datasource is setup in server.xml, it has the scope of entire Tomcat, that means all webapps can use that datasource. Also it can be retrieved by JNDI. Nope.. not right... read the tomcat documentation here: http://jakarta.apache.org/tomcat/index.html You will find that the data source can be scoped to your application, or to the server. If the datasource is setup in struts-config.xml, the scope becomes struts only and is specific to only one webapp, and it can't be retrieved by JNDI. So I can setup datasource in both ways, setup in server.xml has much more flexibilty and benifit from JNDI, why do I need to setup in struts-config.xml?? rtfm. once again, thanks, ^^ Regards - 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: Datasource problem again..
-Original Message- From: Koon Yue Lam [mailto:[EMAIL PROTECTED] Sent: Monday, July 19, 2004 7:46 PM To: Struts Users Mailing List Subject: Re: Datasource problem again.. Thx ! Since I am using Tomct 5 with auto-depoly, my Webapp DOESN'T has a Context element in server.xml. I think I will has a try to setup in default-context, or should I manually all a context element of my Webapp in server.xml?? You can provide an xml file with your aut-deploy. See the manual, or appfuse source code for details. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: url rewriting
-Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of j h Sent: Tuesday, July 20, 2004 7:41 AM To: [EMAIL PROTECTED] Subject: url rewriting Is there a way to disable the jsessionid from being appended to the url when a form is submitted? I think you can use url rewriting, and that won't put the jsessionid on it. Since the jsessionid is what is used for session tracking, you want to look at changing how session tracking is done. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Multiple Values In Form Hidden Parameter
Hi, I'd like to pass multiple values in my form hidden parameter. Is there any way i can do this? html:hidden property=svalues value=abc,def/ Bean: private String []svalues; private String []getSvalues(){ return svalues; } private void setSvalues(String []vals){ svalues = vals; } TIA S - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: form focus
Why not customize the html:form tag? You could override the renderFocusJavascript() method in FormTag to retrieve the errors and highlight the appropriate field Niall - Original Message - From: j h [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 3:43 PM Subject: form focus Can someone explain how the focus of a form can be set to one of the elements that failed validation when the form is re-displayed - 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: form focus
-Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of j h Sent: Tuesday, July 20, 2004 7:44 AM To: [EMAIL PROTECTED] Subject: form focus Can someone explain how the focus of a form can be set to one of the elements that failed validation when the form is re-displayed Depends on when you're doing the validtion.. using the javascript validation or server side validation. Server side you would have to do something like html:form blah blah focus=${focusOn} /html:form and set the focusOn attribute in your action class. javascript... you will have to write the javascript to do it... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] How to get Role/Group info only in JAAS client/tagish package
Hi, A bit OT question: how to get the Role/Group info only in JASS client - I am using Tagish package but I guess it is common. In my login.java, I use: ~~~ lc = new LoginContext(); lc.login(); Set p = lc.getSubject().getPrincipals(); ~~~ However, the getPrincipals() returns all the principals associated with the Subjet, including user name and Group in terms of Tagish implementation - I think it is common for JAAS implementation. Is there a way to retrieve the Group/Role names only ? thanks ! li xin __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: form focus
You could use the focus attribute of the form tag in the html api html:form action=/xyz focus=abc where abc is your property. sahil -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 11:47 AM To: Struts Users Mailing List Subject: Re: form focus Why not customize the html:form tag? You could override the renderFocusJavascript() method in FormTag to retrieve the errors and highlight the appropriate field Niall - Original Message - From: j h [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 3:43 PM Subject: form focus Can someone explain how the focus of a form can be set to one of the elements that failed validation when the form is re-displayed - 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: url rewriting
I think you can use url rewriting, and that won't put the jsessionid on it. It's sort of the other way around :-). The jsessionid parameter is the *result* of performing URL rewriting. If your browser client is using cookies, this will only show on the first request for a session - the container has to send the session id both ways (cookie and rewriting) the first time, because it doesn't know whether or not the client has cookies enabled. When the second request comes in with a cookie, the container notices and stops bothering to rewrite. Since the jsessionid is what is used for session tracking, you want to look at changing how session tracking is done. The Struts tags always do the URL rewriting calls for you, so that sessions just work. If you never want to see the rewritten URLs, most containers have a way to configure disabling this feature -- but, if you do, sessions will only work for clients that have cookies turned on. 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: [OT] RTF PDF export options
Forgive my naivety, Wendy, but what are the benefits of redirecting to a Servlet? -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Monday, July 19, 2004 4:46 PM To: Struts Users Mailing List Subject: Re: [OT] RTF PDF export options From: Barnett, Brian W. [EMAIL PROTECTED] Any suggestions for converting html to RTF and PDF inside an action class and then sending the RTF or PDF back to the client? iText, but I don't do it in an Action, I redirect to a Servlet whose job it is to output the PDF bytes. -- Wendy Smoak - 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: url rewriting
-Original Message- From: Craig McClanahan [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 8:57 AM To: Struts Users Mailing List Subject: Re: url rewriting I think you can use url rewriting, and that won't put the jsessionid on it. It's sort of the other way around :-). The jsessionid parameter is the *result* of performing URL rewriting. If your browser client is using cookies, this will only show on the first request for a session - the container has to send the session id both ways (cookie and rewriting) the first time, because it doesn't know whether or not the client has cookies enabled. When the second request comes in with a cookie, the container notices and stops bothering to rewrite. Ah... okay... did I miss this in the documentation? If so, where is it? I'd like it for a reference. Since the jsessionid is what is used for session tracking, you want to look at changing how session tracking is done. The Struts tags always do the URL rewriting calls for you, so that sessions just work. If you never want to see the rewritten URLs, most containers have a way to configure disabling this feature -- but, if you do, sessions will only work for clients that have cookies turned on. 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
File Upload
Hi, A simple question: after working with a FormFile, do I need to call the destroy() method? Thanks, Erez
RE: [OT] RTF PDF export options
I've been exposed to JasperReports, but in this case, I think it would be overkill for what I need. Thanks for the idea. -Original Message- From: Coyne, Jimmy [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 3:23 AM To: 'Struts Users Mailing List' Subject: RE: [OT] RTF PDF export options Did you have a look at JasperReports ( http://jasperreports.sourceforge.net/index.html) ? Jimmy -Original Message- From: Barnett, Brian W. [mailto:[EMAIL PROTECTED] Sent: 19 July 2004 23:22 To: '[EMAIL PROTECTED]' Subject: [OT] RTF PDF export options Any suggestions for converting html to RTF and PDF inside an action class and then sending the RTF or PDF back to the client? Open source tools, code snippets, tips tricks, etc. ?? Thanks a bunch. Brian Barnett - 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: Multiple Values In Form Hidden Parameter
Hi Sahil, You can do this sort of thing by using indexed properties: html-el:hidden property=svalues[0] value=abc/ html-el:hidden property=svalues[1] value=def/ But in your bean you will need to add getters and setters that include the index as a parameter: private void setSvalues(int index, String val) { svalues[index] = val; } private String getSvalues(int index) { return svalues[index]; } HTH, --Rob On Tue, 20 Jul 2004 11:40:48 -0400, Gupta, Sahil [EMAIL PROTECTED] wrote: Hi, I'd like to pass multiple values in my form hidden parameter. Is there any way i can do this? html:hidden property=svalues value=abc,def/ Bean: private String []svalues; private String []getSvalues(){ return svalues; } private void setSvalues(String []vals){ svalues = vals; } TIA S - 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: Multiple Values In Form Hidden Parameter
Alternatively, tokenize the String parameter to your setter and store it as appropriate in your array in your bean. From: Rob McBride [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Multiple Values In Form Hidden Parameter Date: Tue, 20 Jul 2004 09:29:35 -0700 Hi Sahil, You can do this sort of thing by using indexed properties: html-el:hidden property=svalues[0] value=abc/ html-el:hidden property=svalues[1] value=def/ But in your bean you will need to add getters and setters that include the index as a parameter: private void setSvalues(int index, String val) { svalues[index] = val; } private String getSvalues(int index) { return svalues[index]; } HTH, --Rob On Tue, 20 Jul 2004 11:40:48 -0400, Gupta, Sahil [EMAIL PROTECTED] wrote: Hi, I'd like to pass multiple values in my form hidden parameter. Is there any way i can do this? html:hidden property=svalues value=abc,def/ Bean: private String []svalues; private String []getSvalues(){ return svalues; } private void setSvalues(String []vals){ svalues = vals; } TIA S - 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] _ Overwhelmed by debt? Find out how to Dig Yourself Out of Debt from MSN Money. http://special.msn.com/money/0407debt.armx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Looking for Multiple file upload at once example
RE: Looking for Multiple file upload at once examplePaul, I believe the problem lies with the Commons FileUpload package. Another way to go over it is mentioned in this link: http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED] apache.orgby=subjectfrom=367131to=367131first=1count=2 Essentially, you can iterate over the parameters in the request (where multiple fields with the same name would show up. do some sort of isFile() method on that item, and then save it. You would just have to add enough logic to handle uploaded files with the same form parameter name. The Robert Priest example from the above link is a better explanation than my writing it down. Regards, David -Original Message- From: Perliti Scorzoni Paolo [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 11:08 AM To: David Friedman Subject: R: Looking for Multiple file upload at once example Hi David, I tried this solution just a few hours ago, before I received your answer! It worked! The code I used is very similar to the snippet reported in your mail. I'd only like to know if the limitation you referred to regards the BeanUtil package, the FileUpload package or Struts API... Anyway, thank you very much, your help was VERY appreciated. Thanks again :-) Paul -Messaggio originale- Da: David Friedman [mailto:[EMAIL PROTECTED] Inviato: martedì 20 luglio 2004 16.51 A: Perliti Scorzoni Paolo; Struts Users Mailing List Oggetto: RE: Looking for Multiple file upload at once example Paul, I'm cc'ing the list so other can learn about this. The problem is (unless it has been solved and I haven't heard about it) with the commons file uploads cannot upload multiple files as the very same form field name. Your velocity template shows the very same name, uploadedFiles, used for each file. The last time it was discussed, I believe the perp (er.. programmer. LOL) used one field and tried to upload multiple file names in that one field (which is supposedly technically allowed in file uploads, just not working in any struts-distributed commons upload version). Your way of using one file name in different fields on the page is essentially the same thing. Have you thought of changing those fields to index arrays such as: Attachment 1: input type=file name=uploadedFiles[0]/ Attachment 2: input type=file name=uploadedFiles[1]/ Attachment 3: input type=file name=uploadedFiles[2]/ Or you could name them randomly such as uploadFiles1, uploadFiles2, uploadFilesA, uploadFiles27, etc. and use the CommonsMultipartRequestHandler's getFileElements() method to iterate though file uploads without worrying about their names. I suppose it all depends on whether or not you need to I'd recommend using a form with that action, then casting the form's getMultipartRequestHandler() method a bit like so: CommonsMultipartRequestHandler handler = (CommonsMultipartRequestHandler) form.getMultipartRequestHandler(); HashTable files = handlers.getFileElements(); I haven't used it in a while so if I'm doing a typo on a method name, don't kill the messenger. :) Regards, David -Original Message- From: Perliti Scorzoni Paolo [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 3:42 AM To: [EMAIL PROTECTED] Subject: RE: Looking for Multiple file upload at once example Hi David. I'm trying to use a form to upload several files, all at once. I use Struts and Commons facilities (that is the FormFile interface). Here's my action form: public class AttachmentForm extends ActionForm { /* Files to upload */ private FormFile[] uploadedFiles; public FormFile[] getUploadedFiles() { return uploadedFiles; } public void setUploadedFiles(FormFile[] uploadedFiles) { this.uploadedFiles = uploadedFiles; } } And this is the html code I use to populate the action form (I'm using Velocity, but I don't think this is really important): html body ... form name=uploadForm method=post enctype=multipart/form-data action=(...my action...) ... Attachment 1: input type=file name=uploadedFiles/ Attachment 2: input type=file name=uploadedFiles/ Attachment 3: input type=file name=uploadedFiles/ ... /form ... /body /html Everytime I submit the form I obtain this exception: javax.servlet.ServletException: BeanUtils.populate org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254) org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:821) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
RE: Multiple Values In Form Hidden Parameter
that worked. thanks S -Original Message- From: Frank Zammetti [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 12:38 PM To: [EMAIL PROTECTED] Subject: Re: Multiple Values In Form Hidden Parameter Alternatively, tokenize the String parameter to your setter and store it as appropriate in your array in your bean. From: Rob McBride [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Multiple Values In Form Hidden Parameter Date: Tue, 20 Jul 2004 09:29:35 -0700 Hi Sahil, You can do this sort of thing by using indexed properties: html-el:hidden property=svalues[0] value=abc/ html-el:hidden property=svalues[1] value=def/ But in your bean you will need to add getters and setters that include the index as a parameter: private void setSvalues(int index, String val) { svalues[index] = val; } private String getSvalues(int index) { return svalues[index]; } HTH, --Rob On Tue, 20 Jul 2004 11:40:48 -0400, Gupta, Sahil [EMAIL PROTECTED] wrote: Hi, I'd like to pass multiple values in my form hidden parameter. Is there any way i can do this? html:hidden property=svalues value=abc,def/ Bean: private String []svalues; private String []getSvalues(){ return svalues; } private void setSvalues(String []vals){ svalues = vals; } TIA S - 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] _ Overwhelmed by debt? Find out how to 'Dig Yourself Out of Debt' from MSN Money. http://special.msn.com/money/0407debt.armx - 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] RTF PDF export options
From: Barnett, Brian W. [EMAIL PROTECTED] Forgive my naivety, Wendy, but what are the benefits of redirecting to a Servlet? My reasons, in no particular order... - I wanted a .pdf URL showing in the browser address line - the redirect lets me show a 'please wait' page - the sample code I started with was already a Servlet - it's not tied to Struts. It looks at something in the session, reads stuff from the database and spits out a PDF. If it works for you from an Action, I won't argue that you should rewrite it as a Servlet. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tag question
How can I set a variable (I assume with c:set) that will hold the value of request.getServletPath, so that I can use it in el tags? Thanks, Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multipart forms
Thanks again Niall. I had already put the code in my Action, as you suggested. I'm using a DispatchAction with a somewhat large number of methods on it and now I need to call my new method in several of them, this is why I would have preferred this code in the reset(), but this way works fine. regards, Diego I can't think of anything you can do in Struts currently to get this to work in the reset method - all the relevant code is in the RequestUtils.populate() method and we would have to refactor the multipart processing to resolve this (maybe you should open an enhacement request in bugzilla for it). Having said that, your code looks like it is doing whats needed to populate your checkbox values - can't you just move this code into the Action's execute method? Niall - Original Message - From: Diego [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 8:26 AM Subject: Re: Multipart forms Thanks for your answer Niall. If I can't get the parameters in the reset() method, then I don't know how to solve my problem. My ActionForm is on session and it's a wizard-like one. The jsp has tabs to go to any page at any time. What I do with non-multipart forms is something like this in the reset() method: String page = request.getParameter(page); if (page != null page.equals(1)) { String mycheckbox = request.getParameter(mycheckbox); //if mycheckbox==null,the user hasn't checked it-set the property to N mycheckbox == null ? setMycheckbox(N) : setMycheckbox(Y); } else if (page != null page.equals(2)) { ... } This works fine (I'm actually using multibox fields). I'm not using server validation in validate() method for several reasons, so I can't use it. Any idea how can I do this with a multipart form? Thanks again. You can't get them in the reset() method. Parameters in multipart requests are processed later and made available by wrapping the original request in MultipartRequestWrapper and storing the normal request parameters in that wrapper. Thats not done until the form is populated. The first chance you get to do anything is in the form's validate method. Niall - Original Message - From: Diego [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 19, 2004 3:26 PM Subject: Fwd: Multipart forms Hi! I have a problem when I want to get some parameters in the reset() method of an ActionForm. If the form is a normal form, then I simply call request.getParameter(myparameter) and the parameter is retrieved with no problem. But if the form is of type multipart, then I always get null. The parameter table seems to be filled later, on the RequestProcessor. I need to get parameters in the reset() method, specifically the page parameter, to deal with checkboxes in my wizard-style multipage form. How can I do it in the simplest way possible? Thanks in advance. This message was sent using IMP, the Internet Messaging Program. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message was sent using IMP, the Internet Messaging Program. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tag question
Try the following: c:set var=thePath value=${pageContext.request.servletPath} / Regards, Erez -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 10:21 PM To: Struts Users Mailing List Subject: Tag question How can I set a variable (I assume with c:set) that will hold the value of request.getServletPath, so that I can use it in el tags? Thanks, Erik - 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: Tag question
Hmm actually that renders everything *after* the servlet path, oddly. My controller is mapped to /services/*. I need a var that is equal to /services. The example below is printing out the end of the path -- /usecase/page.jsp Erik Erez Efrati wrote: Try the following: c:set var=thePath value=${pageContext.request.servletPath} / Regards, Erez -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 10:21 PM To: Struts Users Mailing List Subject: Tag question How can I set a variable (I assume with c:set) that will hold the value of request.getServletPath, so that I can use it in el tags? Thanks, Erik - 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: Tag question
Hi Erik, This one worked for me: c:set var=v %= request.getServletPath() % /c:set c:out value=${v}/ bean:write name=v/ HTH, ATTA On Tue, 20 Jul 2004 16:20:30 -0400, Erik Weber [EMAIL PROTECTED] wrote: How can I set a variable (I assume with c:set) that will hold the value of request.getServletPath, so that I can use it in el tags? Thanks, Erik - 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: Tag question
Erik, The getServletPath () returns the whole path to the servlet. As far as I know, there's no method that returns exactly what you need ,so you'll need to do the parsing (remove what is after the last /) by yourself. Perhaps using scriptlet (nasty but will work). c:set var=path % ... the code .. % /c:set You could also have you action prepare this path variable and put it on the request scope. Erez -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 10:38 PM To: Struts Users Mailing List Subject: Re: Tag question Hmm actually that renders everything *after* the servlet path, oddly. My controller is mapped to /services/*. I need a var that is equal to /services. The example below is printing out the end of the path -- /usecase/page.jsp Erik Erez Efrati wrote: Try the following: c:set var=thePath value=${pageContext.request.servletPath} / Regards, Erez -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 10:21 PM To: Struts Users Mailing List Subject: Tag question How can I set a variable (I assume with c:set) that will hold the value of request.getServletPath, so that I can use it in el tags? Thanks, Erik - 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: Tag question
Hmm I must be doing something wrong. That's giving me the same value as Erez's example. Strange, I would have expected it to give me /services. I wonder how I am causing it to give me /usecase/page.jsp. atta-ur rehman wrote: Hi Erik, This one worked for me: c:set var=v %= request.getServletPath() % /c:set c:out value=${v}/ bean:write name=v/ HTH, ATTA On Tue, 20 Jul 2004 16:20:30 -0400, Erik Weber [EMAIL PROTECTED] wrote: How can I set a variable (I assume with c:set) that will hold the value of request.getServletPath, so that I can use it in el tags? Thanks, Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] RTF PDF export options
I know you mentioned open source tools, but I wasn't 100% sure if you were limited to open source. Windward Reports seems like a tool for the job. http://www.windwardreports.com. It's not free and in fact it's pretty expensive. We are leaning towards using this tool because of the ease of use they advertise. Supposedly you create a template in Word and you then can output to all types of different formats. I am curious to know if anyone has any experience with this tool before we shell out the two grand it costs. Thanks. Barnett, Brian W. [EMAIL PROTECTED] wrote: Any suggestions for converting html to RTF and PDF inside an action class and then sending the RTF or PDF back to the client? Open source tools, code snippets, tips tricks, etc. ?? Thanks a bunch. Brian Barnett - Do you Yahoo!? Vote for the stars of Yahoo!'s next ad campaign!
RE: Tag question
That's what this method is supposed to return it's not something you are doing wrong. Maybe that will help: http://javaalmanac.com/egs/javax.servlet/GetReqUrl.html?l=new Erez -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 10:56 PM To: Struts Users Mailing List Subject: Re: Tag question Hmm I must be doing something wrong. That's giving me the same value as Erez's example. Strange, I would have expected it to give me /services. I wonder how I am causing it to give me /usecase/page.jsp. atta-ur rehman wrote: Hi Erik, This one worked for me: c:set var=v %= request.getServletPath() % /c:set c:out value=${v}/ bean:write name=v/ HTH, ATTA On Tue, 20 Jul 2004 16:20:30 -0400, Erik Weber [EMAIL PROTECTED] wrote: How can I set a variable (I assume with c:set) that will hold the value of request.getServletPath, so that I can use it in el tags? Thanks, Erik - 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: Tag question
howdy Erik! well, i was actually answering your original question about how to set a var using c:set and scriptlet! As Erez has mentioned you'd need to use some String.substring() to do the trick! ATTA On Tue, 20 Jul 2004 16:56:13 -0400, Erik Weber [EMAIL PROTECTED] wrote: Hmm I must be doing something wrong. That's giving me the same value as Erez's example. Strange, I would have expected it to give me /services. I wonder how I am causing it to give me /usecase/page.jsp. atta-ur rehman wrote: Hi Erik, This one worked for me: c:set var=v %= request.getServletPath() % /c:set c:out value=${v}/ bean:write name=v/ HTH, ATTA On Tue, 20 Jul 2004 16:20:30 -0400, Erik Weber [EMAIL PROTECTED] wrote: How can I set a variable (I assume with c:set) that will hold the value of request.getServletPath, so that I can use it in el tags? Thanks, Erik - 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: Tag question
Thanks guys! Seems like there was a method I used to call in my Servlets that would only return the Servlet portion of the request URI . . . I must have gone loco! I see that Struts puts a key to the servlet mapping /services/* in some scope -- perhaps I can substring on that. I guess I'll have to prepare this outside of the JSP as you suggest. Thanks, Erik Erez Efrati wrote: That's what this method is supposed to return it's not something you are doing wrong. Maybe that will help: http://javaalmanac.com/egs/javax.servlet/GetReqUrl.html?l=new Erez -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 10:56 PM To: Struts Users Mailing List Subject: Re: Tag question Hmm I must be doing something wrong. That's giving me the same value as Erez's example. Strange, I would have expected it to give me /services. I wonder how I am causing it to give me /usecase/page.jsp. atta-ur rehman wrote: Hi Erik, This one worked for me: c:set var=v %= request.getServletPath() % /c:set c:out value=${v}/ bean:write name=v/ HTH, ATTA On Tue, 20 Jul 2004 16:20:30 -0400, Erik Weber [EMAIL PROTECTED] wrote: How can I set a variable (I assume with c:set) that will hold the value of request.getServletPath, so that I can use it in el tags? Thanks, Erik - 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]
Validation headaches
Does anyone know if it is posible to use validatewhen in conjunction with mask (or other validators)? I cannot figure out how to make it work. Separately they work fine, but when I try to use them together it never validates. Here is the non-working config. form name=dynaPhoneNumberForm field property=phoneNumber depends=validwhen,mask arg0 key=phoneNumber.displayname / var var-nametest/var-name var-value(submit == 'delete') or (*this* != null)/var-value /var var var-namemask/var-name var-value^\d{4}-\d{4}$/var-value /var /field /form I'm using a LookupDispatchAction, and if I am calling delete, I do not send the phoneNumber field. If I am not deleting, then I would like to validate this against a regular expression. (yes, the regex is working OK - they are not U.S. phone numbers.) -- Matthew Van Horn [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tag question
-Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 2:17 PM To: Struts Users Mailing List Subject: Re: Tag question Thanks guys! Seems like there was a method I used to call in my Servlets that would only return the Servlet portion of the request URI . . . I must have gone loco! Were you thinking of request.getContextPath() ? It won't give you just the servlet portion but it would look like it did if you have a memory made out of stainless steel cheese like mine :) On the other hand... that might make it easier to extract the servlet portion I dunno... I see that Struts puts a key to the servlet mapping /services/* in some scope -- perhaps I can substring on that. I guess I'll have to prepare this outside of the JSP as you suggest. Thanks, Erik Erez Efrati wrote: That's what this method is supposed to return it's not something you are doing wrong. Maybe that will help: http://javaalmanac.com/egs/javax.servlet/GetReqUrl.html?l=new Erez -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 10:56 PM To: Struts Users Mailing List Subject: Re: Tag question Hmm I must be doing something wrong. That's giving me the same value as Erez's example. Strange, I would have expected it to give me /services. I wonder how I am causing it to give me /usecase/page.jsp. atta-ur rehman wrote: Hi Erik, This one worked for me: c:set var=v %= request.getServletPath() % /c:set c:out value=${v}/ bean:write name=v/ HTH, ATTA On Tue, 20 Jul 2004 16:20:30 -0400, Erik Weber [EMAIL PROTECTED] wrote: How can I set a variable (I assume with c:set) that will hold the value of request.getServletPath, so that I can use it in el tags? Thanks, Erik --- -- 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: Tag question
Heh, thanks Jim. Yeah, my memory is about like yours! But you are right, I can work from that. Cheers, Erik (Time to call it a day and go play some softball!) Jim Barrows wrote: -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 2:17 PM To: Struts Users Mailing List Subject: Re: Tag question Thanks guys! Seems like there was a method I used to call in my Servlets that would only return the Servlet portion of the request URI . . . I must have gone loco! Were you thinking of request.getContextPath() ? It won't give you just the servlet portion but it would look like it did if you have a memory made out of stainless steel cheese like mine :) On the other hand... that might make it easier to extract the servlet portion I dunno... I see that Struts puts a key to the servlet mapping /services/* in some scope -- perhaps I can substring on that. I guess I'll have to prepare this outside of the JSP as you suggest. Thanks, Erik Erez Efrati wrote: That's what this method is supposed to return it's not something you are doing wrong. Maybe that will help: http://javaalmanac.com/egs/javax.servlet/GetReqUrl.html?l=new Erez -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 10:56 PM To: Struts Users Mailing List Subject: Re: Tag question Hmm I must be doing something wrong. That's giving me the same value as Erez's example. Strange, I would have expected it to give me /services. I wonder how I am causing it to give me /usecase/page.jsp. atta-ur rehman wrote: Hi Erik, This one worked for me: c:set var=v %= request.getServletPath() % /c:set c:out value=${v}/ bean:write name=v/ HTH, ATTA On Tue, 20 Jul 2004 16:20:30 -0400, Erik Weber [EMAIL PROTECTED] wrote: How can I set a variable (I assume with c:set) that will hold the value of request.getServletPath, so that I can use it in el tags? Thanks, Erik --- -- 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OT: Best practice for access to file from multiple web apps
We have PDF's that can be created by one webapp, but must also be served by other webapps. Obviously, fun is ensuing in trying to figure out the best to avoid hard coding paths, even in a configuration file. Dev, Test and Production are of course different enought that each environment requires a different configuraion file. We don't want to take the performance hit of storing the pdf as a blob. Can't build them on the fly for readonly (these are supposed to be immutable). can't do cool unix linking tricks ( not on unix, running on AS400s). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT: Best practice for access to file from multiple web apps
Jim, do you use ANT or Maven to build/deploy your projects? if so you can have them set up a config file for you based on the environment you're building to. andy On Tue, 20 Jul 2004 15:35:51 -0700, Jim Barrows [EMAIL PROTECTED] wrote: We have PDF's that can be created by one webapp, but must also be served by other webapps. Obviously, fun is ensuing in trying to figure out the best to avoid hard coding paths, even in a configuration file. Dev, Test and Production are of course different enought that each environment requires a different configuraion file. We don't want to take the performance hit of storing the pdf as a blob. Can't build them on the fly for readonly (these are supposed to be immutable). can't do cool unix linking tricks ( not on unix, running on AS400s). - 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: Best practice for access to file from multiple web apps
-Original Message- From: Andrew Close [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 3:44 PM To: Struts Users Mailing List Subject: Re: OT: Best practice for access to file from multiple web apps Jim, do you use ANT or Maven to build/deploy your projects? if so you can have them set up a config file for you based on the environment you're building to. Nope.. not at the moment. *SIGH* Somewhere in this search for a better way is a rant about doing things that standard way rather then roll your own. but that's for another time and a lot more Guiness.. andy On Tue, 20 Jul 2004 15:35:51 -0700, Jim Barrows [EMAIL PROTECTED] wrote: We have PDF's that can be created by one webapp, but must also be served by other webapps. Obviously, fun is ensuing in trying to figure out the best to avoid hard coding paths, even in a configuration file. Dev, Test and Production are of course different enought that each environment requires a different configuraion file. We don't want to take the performance hit of storing the pdf as a blob. Can't build them on the fly for readonly (these are supposed to be immutable). can't do cool unix linking tricks ( not on unix, running on AS400s). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT: Best practice for access to file from multiple web apps
well, depending on your build process (and who is in control), setting up ANT really isn't all that difficult. and then you can have a config file for each platform you build to. i haven't had a chance (or taken the time) to play with Maven yet. it's built on top of ANT and apparently adds a lot of other cool features. you should check them out. sorry i don't have more specific help. :) On Tue, 20 Jul 2004 15:47:24 -0700, Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Andrew Close [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 3:44 PM To: Struts Users Mailing List Subject: Re: OT: Best practice for access to file from multiple web apps Jim, do you use ANT or Maven to build/deploy your projects? if so you can have them set up a config file for you based on the environment you're building to. Nope.. not at the moment. *SIGH* Somewhere in this search for a better way is a rant about doing things that standard way rather then roll your own. but that's for another time and a lot more Guiness.. andy On Tue, 20 Jul 2004 15:35:51 -0700, Jim Barrows [EMAIL PROTECTED] wrote: We have PDF's that can be created by one webapp, but must also be served by other webapps. Obviously, fun is ensuing in trying to figure out the best to avoid hard coding paths, even in a configuration file. Dev, Test and Production are of course different enought that each environment requires a different configuraion file. We don't want to take the performance hit of storing the pdf as a blob. Can't build them on the fly for readonly (these are supposed to be immutable). can't do cool unix linking tricks ( not on unix, running on AS400s). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT: Best practice for access to file from multiple web apps
On Tue, 20 Jul 2004 15:35:51 -0700, Jim Barrows [EMAIL PROTECTED] wrote: We have PDF's that can be created by one webapp, but must also be served by other webapps. Forgive me for coming in late, but it's not obvious to me how big a problem the other webapps part of this really is. Lets use the term consumer webapp to be the webapp that wants to return the PDF in response to a request, while the producer webapp is the one that generates it on demand. (Note that, in a properly designed environment, no consumer should ever be able to tell whether the PDF was actually generated on the fly, read from a BLOB, or read from a file -- all the consumer knows is a URL, and it is up to the producer to decide what to do.) The first rule is that the consuming webapp has to know the name of the PDF that it wants. You could look this up in a database, if you wanted it to be dynamic -- but it will typically be a simple relative URL like bar.pdf, right? Next, lets assume the consuming and producing webapps are on the same server, but distinct from each other. If the producing webapp has a context path of /foo, then the relative URL for this pdf becomes /foo/bar.pdf instead of bar.pdf -- again, the host is implicit, so this URL should work in development, test, and production environments with no changes as long as producer and consumer are guaranteed to be on the same machine. The most general case is where producer and consumer webapps might be on different servers. An easy way to generalize this would be to configure the root part of the path (http://myhost/foo) in a context init parameter (or a JNDI environment variable), and make the consumer webapp glue that together with the relative path of the pdf in question on demand. Then, at most, you have to change one configuration setting as you migrate from development to test to production -- and, if you use a JNDI environment variable, the change is totally external to the WAR file that you're deploying, because you can configure it using the server's admin tool. Is it really any harder than this? If it is, I must be missing something. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Datasource problem again..
Great, that's always good to hear. Also consider providing your own context xml for each app with the war file, might save you some time in server restarts. Unless you changed server.xml through the administrative interface. On Wed, 21 Jul 2004 10:24:21 +0800, Koon Yue Lam [EMAIL PROTECTED] wrote: Tthanks for the help for all of u ! Finally I get it done, I create a default-context element and nest a resource with details of MySql in server.xml and it just work smoothly~~~ Regards - 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: Datasource problem again..
Good point. I've done the same, ie setup a DefaultContext within the Host of server.xml, and defined my data-source there. I've still got a context.xml, but it's now down to just a couple of lines ie to specify docBase, path and a logger. It looks like this now: ?xml version='1.0' encoding='utf-8'? Context docBase=/webapps/isurvey path=/isurvey reloadable=true swallowOutput=true Logger className=org.apache.catalina.logger.FileLogger prefix=isurvey_log. suffix=.txt timestamp=true/ /Context Just to make it clear what this is all about, you don't need to define a Context in your server.xml. In my case, my app is called 'isurvey', so I defined a file called 'isurvey.xml' containing the Context above. I placed this file in {tomcat home}/conf/Catalina/localhost/ , and tomcat was able to automatically detect the app. Regards, John [EMAIL PROTECTED] Ph (09) 372-5010 |-+ | | Peng Tuck Kwok | | | [EMAIL PROTECTED]| | | om | | || | | 21/07/2004 05:09 | | | PM | | | Please respond to| | | Struts Users| | | Mailing List| | || |-+ --| | | | To: Struts Users Mailing List [EMAIL PROTECTED] | | cc: | | Subject: Re: Datasource problem again.. | --| Great, that's always good to hear. Also consider providing your own context xml for each app with the war file, might save you some time in server restarts. Unless you changed server.xml through the administrative interface. On Wed, 21 Jul 2004 10:24:21 +0800, Koon Yue Lam [EMAIL PROTECTED] wrote: Tthanks for the help for all of u ! Finally I get it done, I create a default-context element and nest a resource with details of MySql in server.xml and it just work smoothly~~~ Regards - 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]