Re: Tile Problem
Are you using the struts-el tags. You might have them installed as bean-el in which case you would need to use key="${titleKey}"/> I only use the EL tags, so I just use bean as the tag prefix eg <%@ taglib uri="/WEB-INF/jsp/tags/struts-bean-el.tld" prefix="bean" %> Caroline Jen wrote: I tried both of your suggestions. For example, I have [code] . key="${titleKey}"/> . [/code] I got java.lang.IllegalArgumentException: can't parse argument number titleKey --- Jason Lea <[EMAIL PROTECTED]> wrote: If you are using JSTL you can do this: name="title"> if that doesn't work, try this: key="${titleKey}"/> Caroline Jen wrote: In general, the tile works fine for me except the "title" piece. [CODE] . . [/CODE] In my tiles-def.xml, I have: [CODE] extends=".article.Base"> [/CODE] The problem is that my application displays article.Menu.title in the browser, instead of going to the application.properties (which is in the ApplicationRoot/WEB-INF/classes/resources folder) to get article.Menu.title=Registered Members What should I do? __ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html --------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tile Problem
If you are using JSTL you can do this: if that doesn't work, try this: Caroline Jen wrote: In general, the tile works fine for me except the "title" piece. [CODE] . . [/CODE] In my tiles-def.xml, I have: [CODE] extends=".article.Base"> [/CODE] The problem is that my application displays article.Menu.title in the browser, instead of going to the application.properties (which is in the ApplicationRoot/WEB-INF/classes/resources folder) to get article.Menu.title=Registered Members What should I do? __ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n with Japanese characters and tags....
He was saying it 'can' display Japanese characters. The example doesn't have any Japanese characters in in (if i remember correctly), but if they are put into the properties files for the locale they will be displayed. You should look into that http://www.anassina.com/struts/i18n/i18n.html page as it explains a lot. I think the main problem is you have the Japanese characters already converted into HTML in your application as yuo have them in the format ハ. When you use a bean to write it out, the bean tried to escape any characters that are significant to HTML, and the '&' character is one of them. That is why it replaces your '&' with '&'. The bean is trying to help by displaying the text you provided in HTML so that it will appear as ハ on the page. The 'filter=false' stops it doing this, but also means if you have some other characters like '<' in your text then they won't be escaped and could cause the page to be rendered incorrectly. When I display Japanese characters on my pages I store them in Japanese in a .properties file, then use native2ascii to convert those japanese characters into the Java Unicode properties file format of \u. When java reads them in, the actual unicode character is passed around in java and output directly into the html page. The page encoding is set to UTF-8, and the browser can display it correctly. The bean:write will also still escape the characters that need it such as '&' and '<'. This also means I am not dealing with HTML formatting inside my Java code, and can happily store the same characters in files, databases etc or output to another device instead of HTML. -- Jason Lea carlo latasa wrote: >I just checked the example application and did not see anything on Japanese >characters. I'm at: >http://localhost:8080/struts-example/tour.do > >Did you mean that if I were to just take this code and modify it to display >these characters? Or is the example somewhere else? > > > > >>From: <[EMAIL PROTECTED]> >>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >>To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >>Subject: Re: i18n with Japanese characters and tags >>Date: Tue, 23 Mar 2004 16:12:20 +0900 >> >>Carlo, >> >>Have you checked the example application included in Struts1.1(or >>current CVS)? It can show Japanese characters correctly without any >>special implementations. >>I think it will be a help for your problem. >> >>The most frequent mistake in such case is lack of unicode escape >>to their message resource files. >>Don't forget "native2ascii" when you make your resource files. >> >>see also : http://www.anassina.com/struts/i18n/i18n.html >> >> >>Yoshinori Ashizawa >>Ja-Jakarta Project www.jajakarta.org >> >> >>carlo latasa" <[EMAIL PROTECTED]> wrote: >> >> >> >>>Hello, >>> >>>I'm trying to show Japanese characters on my jsp pages however the "&" >>>character of the charset is coming back as & which is preventing the >>>characters from being displayed correctly. They look like: >>>キカスハ >>> >>>Note, the bean:write tag renders the characters correctly when the >>> >>> >>filter >> >> >>>attribute is set to "false". >>> >>>I've got a struts application using both Tomcat and Jrun and I've set my >>>controller element of the struts-config.xml as: >>> >>> >>> >>>and at the top of a tiles.jsp that's at the head of every page I've got >>> >>> >>a: >> >> >>><%@ page contentType="html/text; charset=JISAutoDetect" %> >>> >>> >>> > >> >>>%> >>> >>>. to set the encoding. >>> >>>My hunch is that this is something that Struts is doing to the in the >>>RequestProcessor or Controller. >>>Could/should I write a Filter to override this issue? >>> >>>Is this something I chould set in a .css called in the tiles.jsp? >>> >>>Any help is much appreciated. >>> >>> >>>Carlo Latasa - >>> >>> >>- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > > >Carlo Latasa - Home: (510) 231-9655 Cell: (415) 385-1567 > >_ >MSN Toolbar provides one-click access to Hotmail from any Web page ・FREE >download! http://toolbar.msn.com/go/onm00200413ave/direct/01/ > > >- >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: UTF-8 characters in the name of the uploaded document
Hi Zsolt, I wrote this reply in response to the same problem but in a different thread. I couldn't find it in the struts mailing list archives, so I include it again with the message it responds to. Someone has since written to me confirming that this does work. - Yes, I think you are right, i didn't realise which class we were talking about there. I have just read a bit more about the Struts FileUpload and how it wraps commons upload. Assuming Commons Upload works correctly with the setHeaderEncoding, then I guess there might be work around. Struts will use org.apache.struts.upload.CommonsMultipartRequestHandler by default to handle extracting the parameters out of the request and populating the form. It uses the DiskFileUpload class from Commons FileUpload. It is that handler that we need to modify, to do that we could create our own using the org.apache.struts.upload.CommonsMultipartRequestHandler source as the basis. We need to tell Struts to use ours instead of the defualt by adding this to your struts-config.xml Then to modify org.apache.struts.upload.CommonsMultipartRequestHandler by creating our my.own.MultiPartClassHandler class. We need to modify the handleRequest() method like so: // Create and configure a DIskFileUpload instance. DiskFileUpload upload = new DiskFileUpload(); upload.setHeaderEncoding("UTF-8"); // Set the maximum size before a FileUploadException will be thrown. upload.setSizeMax((int) getSizeMax(ac)); ... This is all untested and off the top of my head, so there is likely to be a mistake there somewhere, but I think it is possible. Daniel Rabe wrote: I see a similar problem with file upload. It doesn't look like org.apache.strugs.upload.FormFile exposes a setHeaderEncoding method... Daniel Rabe -Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Friday, December 26, 2003 1:33 PM To: Struts Users Mailing List Subject: Re: What is wrong with this upload filename (UTF-8) decoding? I have not used the file upload yet, but I believe you need to set the encoding for the headers formFile.setHeaderEncoding("UTF-8") setHeaderEncoding does this: "Specifies the character encoding to be used when reading the headers of individual parts. When not specified, or |null|, the platform default encoding is used." If this was running on a English operating system it is probably defaulting to the Latin-1 encoding. From this Java Doc: http://jakarta.apache.org/commons/fileupload/apidocs/org/apache/commons/file upload/FileUploadBase.html#setHeaderEncoding(java.lang.String) Please post back to the forum if this works. I would be interested in the result. Zsolt Koppany wrote: Hi, my application has to support UTF-8 including when files are uploaded with UTF-8 characters in the filename (for example: ??.txt). I use a servlet filter that always call request.setCharacterEncoding("UTF-8") and my jsp pages contain response.setContentType("text/html; charset=UTF-8"); Everything works fine except that I have problems with decoding of the name of uploaded filenames. I use the code below to get the name of the uploaded filename: String nm = formFile.getFileName(); String filename = new String(nm.getBytes(), "UTF-8"); The code above converts only the first couple of characters correctly (result: ??.txt). Any ideas how to fix the problem? I use TC-4.1.29, Struts-1.1, jdk1.4.2_02 Windows-XP. Zsolt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea Zsolt Koppany wrote: Hi Colm, I know that article, and as I wrote the application does work fine with UTF-8 characters except upload. Zsolt -Original Message- From: Colm Garvey [mailto:[EMAIL PROTECTED] Sent: Friday, March 19, 2004 4:20 PM To: Struts Users Mailing List Subject: RE: UTF-8 characters in the name of the uploaded document In this article: http://www.anassina.com/struts/i18n/i18n.html The author mentions that a filter is required for UTF-8 encoded forms. Worth a go? Colm -Original Message- From: Zsolt Koppany [mailto:[EMAIL PROTECTED] Sent: 19 March 2004 14:22 To: Struts Users Mailing List Subject: UTF-8 characters in the name of the uploaded document Hi, I use struts-1.1 with tomcat-4.1.30 and cannot get the name of the uploaded document correctly if that contains UTF-8 (Asian) characters. The application itself does work fine with UTF-8 characters in forms etc. the only exception is upload. Is there a fix to solve this problem or will it be fixed in the next release? Zsolt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -
Re: Text Area
as as wrote: Hi, How to make the below a text area? Thanks, Samy. Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam http://jakarta.apache.org/struts/userGuide/struts-html.html#textarea -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Search string tokenizer
Regular Expressions should work: There are a few implementations too like http://jakarta.apache.org/oro/index.html With a pattern like this: (".+"|[\d\w]*) You should get close to what you need (i think the above will return the space character as a token too, not sure). And here is a program that lets you test out patterns to see how they match strings or will be split http://www.weitz.de/regex-coach/ Robert Taylor wrote: I did a google search on this and didn't really come up with anything useful. Before I implement this myself, is there an existing implementation of parsing a search string which would produce tokens similar to how Google or other search engines parse search strings. For example, I would like to parse a search string into tokens where tokens are delimited by either a blank space or a quoted phrase. So the string: 'Struts "web presentation tier"' would return 2 tokens: - Struts - web presentation tier but the string: 'Struts web presentation tier' would return 4 tokens: - Struts - web - presentation - tier Any help is appreciated. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: security framework!!!
David Friedman wrote: I've also been looking into security frameworks and the only solutions I've really found are: 1. Standard (container) JAAS 2. SecurityFilter http://securityfilter.sourceforge.net 3. Pow2ACL http://pow2acl.sourceforge.net/ I was hoping, at some point, to use an SSL switching feature such as SSLext. From my research, Pow2ACL and SecurityFilter won't work that way. SecurityFilter has a note that certain 'elements' could be used for it but the current code makes no use of them in that manner. As for Pow2ACL, I didn't find anything suggesting how to use it in that way either. My bigger problem is my scenario, which no one supports. I'd like to allow manager accounts to become one of if it's sub-accounts. My system would support at least 5 levels where 4 could 'drill down' and back up again: admin, reseller, client, manager, employee (bottom feeder, no managerial tools and no popping into their accounts). Since there is no easily way to Trying to figure out what you are asking here can you give an example? If you have the following: 1. User Manfred is a manager 2. User Emily is an Employee 3. Emily is an employee under Manfred Are you saying that Manfred can become Emily and perform certain tasks/actions? Then Manfred would return to be Manfred the manager? push/pop or even set (then I could use my own internal stack) a UserPrincipal object, I'm thinking of using something a bit like SecurityFilter: wrap the request object with a subclass of HttpServeletRequestWrapper and add my own push/pop/set/get/count UserPrincipal object(s). Then, I could hook the login procedure with container methods (JAAS, i.e. a web browser login/password pop-up) and still be able to (when I'm ready) use SSLext or something like it for the HTTP/HTTPS switching. Regards, David -Original Message- From: Mailing List [mailto:[EMAIL PROTECTED] Sent: Saturday, March 13, 2004 6:19 AM To: [EMAIL PROTECTED] Subject: security framework!!! I'm developing a web application with struts.I had a problem for support security at jsp pages level for different roles.I send an email and recived 2 response to solve my problem: 1. with HTML tags. 2. 2.with define role in tiles definition but I'm searching for a good framework that be compatibled with struts framework and support the security for different roles at page levels. I mean for example if I have a jsp page with tow textfields and a submit deponds on user's role at the system,one user just can see one of the textfield and submit buttom and another user can see both of the textfield and submit buttom. Can you suggest a good framework for me. regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Breadcrumbs
Adam Hardy wrote: Jason, it just occurred to me (must have had my eyes shut) after a couple of weeks that the last breadcrumb in the breadcrumb menu done with your tiles method is actually a link to the page that you are already on. Is this the way you have implemented it, or have I done it wrong? Yes, it is a link to that page. Or at in some cases it has been the link to the list page for some admin pages. Eg list of users, when they select a user to edit i leave the breadcrumb as 'Users' and if they click on it, it goes back to the user list. Adam On 02/23/2004 11:27 PM Jason Lea wrote: Andy Engle wrote: Hi all, Is there any slick way of putting breadcrumbs into a web app with Struts? If so, what's the preferred way? Thanks. Andy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] I did this using tiles. I have my tiles extending a base layout, then each sub-menu item extends the parent tile definition eg (first level) ... (second level) ... Now, for breadcrumbs I would define breadcrumb0 in the first level. As the second level extends the first, breadcrumb0 will be included. In the second level I define breadcrumb1 eg link="workflowlist" tooltip="workflow.title" classtype="org.apache.struts.tiles.beans.SimpleMenuItem" /> I had originally wanted to just to be able to add an item to the breadcrumb list, but that is not possible in xml. In my layout.jsp page I then use Hope that make somes sort of sense. If not ask me a question and I will try to explain better. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Breadcrumbs
Hmm, I should probably point out a few things with those links The value is normally the text to link on, but I have internationalised my app so I use it as the key to look up the real name in my application.properties file. Same goes for the tooltip, it is just the name of the key to look up. The link I use is just the name of a forward. And I am using JSTL to substitute the values into the struts html-el tags (i only use html-el so I just labelled mine html instead of html-el) eg So my breadcrumbs can appear in japanese or english depending on the locale that is selected. These breadcrumbs work if you have 1 path to the page. If you want to track history you will have to do something else. Jason Lea wrote: Andy Engle wrote: Hi all, Is there any slick way of putting breadcrumbs into a web app with Struts? If so, what's the preferred way? Thanks. Andy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] I did this using tiles. I have my tiles extending a base layout, then each sub-menu item extends the parent tile definition eg (first level) ... (second level) ... Now, for breadcrumbs I would define breadcrumb0 in the first level. As the second level extends the first, breadcrumb0 will be included. In the second level I define breadcrumb1 eg link="workflowlist" tooltip="workflow.title" classtype="org.apache.struts.tiles.beans.SimpleMenuItem" /> I had originally wanted to just to be able to add an item to the breadcrumb list, but that is not possible in xml. In my layout.jsp page I then use Hope that make somes sort of sense. If not ask me a question and I will try to explain better. -- Jason Lea Email: [EMAIL PROTECTED] Phone/Fax: +64 3 381 2907 Mobile:+64 21 040 2708 ICQ: 67452939 MSN: [EMAIL PROTECTED] Jabber:[EMAIL PROTECTED] Address: 9a Tabart Street, Christchurch, New Zealand - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Breadcrumbs
Andy Engle wrote: Hi all, Is there any slick way of putting breadcrumbs into a web app with Struts? If so, what's the preferred way? Thanks. Andy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] I did this using tiles. I have my tiles extending a base layout, then each sub-menu item extends the parent tile definition eg (first level) ... (second level) ... Now, for breadcrumbs I would define breadcrumb0 in the first level. As the second level extends the first, breadcrumb0 will be included. In the second level I define breadcrumb1 eg link="workflowlist" tooltip="workflow.title" classtype="org.apache.struts.tiles.beans.SimpleMenuItem" /> I had originally wanted to just to be able to add an item to the breadcrumb list, but that is not possible in xml. In my layout.jsp page I then use Hope that make somes sort of sense. If not ask me a question and I will try to explain better. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction
Well, LookUpDispatchAction doesn't call the unspecified action when it is no parameter is supplied. One way would be to override the method that does the lookup and when no action parameter is supplied, call the unspecified() parameter. Another way is to make your initial call to the action provide the parameter. I have done this in some cases by defining some eg The other thing that needs to be looked at here is that 'list' will not be localised. So in my default ApplicationResources.properties file I have a global.list=list, and have map.put("global.list","list"); entry in the keyMethodMap. Then make sure you don't localise the global.list in the other properties files. I might have a localised list button eg map.put("button.list","list"); too, so that the list button appears in the correct language. There is no problem with more than 1 name linking to the list method. Guilherme Barile wrote: Hi I have the following DispatchAction working here public MyDispatchAction extends DispatchAction { public unspecified(...) { read_data_from_database(); populate_form(); return(mapping.findForward("renderForm"); } } renderForm renders the form (I don't access the jsp directly, just the action, this way it calls unspecified, which reads data from a database and populates the form). I tried converting this to a LookupDispatchAction, making MyDispatchAction extend LookupDispatchAction and adding protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("button.save", "save"); return map; } To the code ... the parameter is called "action" it exists on struts-config, the message "button.save" exists on ApplicationResources.properties but everytime I run it, I get the error Request[/myform] does not contain handler parameter named action I *guess* it happens because the first time I accessed this form no buttons were pressed, so "action" really doesn't exist (yet) ... problem is this must happen this way, otherwise I won't be able to read data from the database to populate the form. With an ordinary DispatchAction it works fine, but I can't localize my buttons. Any ideas ? Thanks in advance gui --------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation for Unicode characters?
Theodosios Paschalidis wrote: Hi all. I am internationalizing my application and I was wondering whether the standard validators can be used with Unicode (greek) characters by the proper modification of the regular expression. Standard [a-z] expressions doesn't recognize unicode characters, throwing the predefined error. Is it possible to use the unicode escape sequence?in a \u-\u manner? Thank you, Theo Assuming the struts regular expressions handle unicode correctly you should be able to use the actual greek characters in the validation.xml file. You will have to change the xml encoding from to something like or greek encoding. The ISO-8859-1 encoding is the standard ascii characters and so international characters are not supported. The \u format is used only in the .properties files, not in .xml. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to disable a html:option tag?
It could be that the the tag just renders an sometext html tag. If that is the case then the HTML browser would need to support the disable attribute. I wrote a quick test for IE and Mozilla: 1 2 3 IE V6.0 didn't support the disable attribute. Mozilla Firebird V0.7 does. Hookom, Jacob wrote: You can disable the select tag as a whole, but I've never heard of disabling an option tag. You might just want to not list them. -Original Message- From: Dirk Manske [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 5:21 PM To: 'Struts Users Mailing List' Subject: AW: how to disable a html:option tag? Sensitivity: Personal Hi, Does nobody know an answer or is it just too trivial?! Hm. The HTML Tag Library says, that I can disable an option by setting disabled to "true". However it does not work, the option can still be selected. I am wondering is this a bug or did I miss something? I hope someone can give me a hint. Thank you. Dirk -Ursprüngliche Nachricht- Von: Dirk Manske (Service Respond) [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 16. Januar 2004 18:04 An: [EMAIL PROTECTED] Betreff: how to disable a html:option tag? Vertraulichkeit: Persönlich Hi, I have in a form a html:select tag and inside some html:option tags. I want to disable some options and declared it like this optionText But this seems not to work because this option is still selectable. How to solve it? thx, Dirk - 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] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 403 error page not being displayed
I couldn't see any. But could you modify the GZIPResponseWrapper so that the sendError() or setStatus() methods can keep a copy of the status and add a getStatus() method so you can retrieve it later? Matt Raible wrote: OK, well that Filter isn't any better - anyone know how to get the HTTP_STATUS code so I can disable the filter when the error-code is 403? Thanks, Matt -Original Message- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 1:14 PM To: 'Struts Users Mailing List' Subject: RE: 403 error page not being displayed I'm currently experiencing the issue with Tomcat 4.1.29, JDK 1.4.2 on Windows XP and Fedora Core 1. The header (from Mozilla) looks fine: HTTP/1.x 403 User is not authorized to access action /editUser Content-Type: text/html;charset=ISO-8859-1 Content-Language: en-US Transfer-Encoding: chunked Date: Thu, 08 Jan 2004 19:51:50 GMT Server: Apache-Coyote/1.1 After further review it looks like my Gzip CompressionFilter (http://tinyurl.com/25xva) is hosing things up - bout time I get a new one (http://tinyurl.com/3aaoy). Thanks, Matt -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 12:05 PM To: Struts Users Mailing List Subject: Re: 403 error page not being displayed Huh. Both 4.1.29 and 5.0.16 seem to work for 400 and 403 with a simple error-page test (no Struts involved). AFAIK, the roles check is performed within RequestProcessor.processRoles which just does an HttpServletResponse.sendError if the user in not in the required role. At that point, the container should take over, so I'm not sure why it's not working for you. Big help, eh? ;-) Quoting Kris Schneider <[EMAIL PROTECTED]>: Looks like Struts 1.1 sends a 400 and the current nightly sends a 403. Maybe it's a TC bug. Which version are you using? Quoting Matt Raible <[EMAIL PROTECTED]>: I have roles configured on my "/editUser" action mapping so that only administrator can access it. When I try to request the page as a "user", I get the default 403 page from Tomcat, rather than my app's configured one. In web.xml, I have a number of error pages defined, and 404 works OK: 500 /error.jsp 400 /index.jsp 403 /403.jsp 404 /404.jsp In another application, that uses a very similar structure, when a 403 is returned the user sees nothing - they're just routed back to the welcome file of the app. The first app uses a Struts Nightly build from early December, the 2nd uses Struts 1.1. Any ideas why my 403.jsp error page isn't displaying? I can pull it up fine if I type in the URL. Thanks, Matt -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> - 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] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: applyLocalizedPattern
I saved it and looked at it in a hex editor. It shows it is A0, in the Windows Character Map program that is No-Break Space and is U+00A0 I assume that means \u00a0 should work. Ted Husted wrote: That's definitely what we were looking for :) Next question for the group: What's the best way to determine the unicode value for fr group separator character? From this, I can't actually tell what character it's suppose to be. The browser substitutes another character. I tried saving the java file directly, but when I try to paste it over, something is lost in the translation (so to speak), and I end up with a question mark. -Ted. On Fri, 02 Jan 2004 09:35:04 +1300, Jason Lea wrote: I don't know the official location but this stuff seems to be located in your jre/lib/ext/localedata.jar as class files I found this link to some java source for these (java v1.1.7) here http://www.dei.unipd.it/corsi/fi2ae- docs/source/jdk1.1.7/src/java/text/resources/ This one: http://www.dei.unipd.it/corsi/fi2ae- docs/source/jdk1.1.7/src/java/text/resources/LocaleElements_fr.java has ",", /*decimal separator*/ " ", /*group (thousands) separator*/ where http://www.dei.unipd.it/corsi/fi2ae- docs/source/jdk1.1.7/src/java/text/resources/LocaleElements_en.java has ".", /*decimal separator*/ ",", /*group (thousands) separator*/ Ted Husted wrote: When is provided a pattern through the message resources, rather than as a tag attribute, the applyLocalizedPattern <http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.ht ml#applyLocalizedPattern> method is used. This method assumes the pattern is using a localized notation. Does anyone know where the localized notations are documented? Or, do you have to run a test program with toLocalizedPattern and discover it that way? This question relates to Issue #2119 <http://issues.apache.org/bugzilla/show_bug.cgi?id=21992>. -Ted. -- --- To unsubscribe, e-mail: struts-user- [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: applyLocalizedPattern
I don't know the official location but this stuff seems to be located in your jre/lib/ext/localedata.jar as class files I found this link to some java source for these (java v1.1.7) here http://www.dei.unipd.it/corsi/fi2ae-docs/source/jdk1.1.7/src/java/text/resources/ This one: http://www.dei.unipd.it/corsi/fi2ae-docs/source/jdk1.1.7/src/java/text/resources/LocaleElements_fr.java has ",", /*decimal separator*/ " ", /*group (thousands) separator*/ where http://www.dei.unipd.it/corsi/fi2ae-docs/source/jdk1.1.7/src/java/text/resources/LocaleElements_en.java has ".", /*decimal separator*/ ",", /*group (thousands) separator*/ Ted Husted wrote: When is provided a pattern through the message resources, rather than as a tag attribute, the applyLocalizedPattern <http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html#applyLocalizedPattern> method is used. This method assumes the pattern is using a localized notation. Does anyone know where the localized notations are documented? Or, do you have to run a test program with toLocalizedPattern and discover it that way? This question relates to Issue #2119 <http://issues.apache.org/bugzilla/show_bug.cgi?id=21992>. -Ted. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is wrong with this upload filename (UTF-8) decoding?
Yes, I think you are right, i didn't realise which class we were talking about there. I have just read a bit more about the Struts FileUpload and how it wraps commons upload. Assuming Commons Upload works correctly with the setHeaderEncoding, then I guess there might be work around. Struts will use org.apache.struts.upload.CommonsMultipartRequestHandler by default to handle extracting the parameters out of the request and populating the form. It uses the DiskFileUpload class from Commons FileUpload. It is that handler that we need to modify, to do that we could create our own using the org.apache.struts.upload.CommonsMultipartRequestHandler source as the basis. We need to tell Struts to use ours instead of the defualt by adding this to your struts-config.xml Then to modify org.apache.struts.upload.CommonsMultipartRequestHandler by creating our my.own.MultiPartClassHandler class. We need to modify the handleRequest() method like so: // Create and configure a DIskFileUpload instance. DiskFileUpload upload = new DiskFileUpload(); upload.setHeaderEncoding("UTF-8"); // Set the maximum size before a FileUploadException will be thrown. upload.setSizeMax((int) getSizeMax(ac)); ... This is all untested and off the top of my head, so there is likely to be a mistake there somewhere, but I think it is possible. Daniel Rabe wrote: I see a similar problem with file upload. It doesn't look like org.apache.strugs.upload.FormFile exposes a setHeaderEncoding method... Daniel Rabe -Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Friday, December 26, 2003 1:33 PM To: Struts Users Mailing List Subject: Re: What is wrong with this upload filename (UTF-8) decoding? I have not used the file upload yet, but I believe you need to set the encoding for the headers formFile.setHeaderEncoding("UTF-8") setHeaderEncoding does this: "Specifies the character encoding to be used when reading the headers of individual parts. When not specified, or |null|, the platform default encoding is used." If this was running on a English operating system it is probably defaulting to the Latin-1 encoding. From this Java Doc: http://jakarta.apache.org/commons/fileupload/apidocs/org/apache/commons/file upload/FileUploadBase.html#setHeaderEncoding(java.lang.String) Please post back to the forum if this works. I would be interested in the result. Zsolt Koppany wrote: Hi, my application has to support UTF-8 including when files are uploaded with UTF-8 characters in the filename (for example: ??.txt). I use a servlet filter that always call request.setCharacterEncoding("UTF-8") and my jsp pages contain response.setContentType("text/html; charset=UTF-8"); Everything works fine except that I have problems with decoding of the name of uploaded filenames. I use the code below to get the name of the uploaded filename: String nm = formFile.getFileName(); String filename = new String(nm.getBytes(), "UTF-8"); The code above converts only the first couple of characters correctly (result: ??.txt). Any ideas how to fix the problem? I use TC-4.1.29, Struts-1.1, jdk1.4.2_02 Windows-XP. Zsolt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: not writing?
I have read about people having problems getting or setting a bean which does not fit the bean specification. In that case the Cart object would also need a setSubTotal(double dbl) method, even if it is not used eg public class Cart extends HashMap { private double subTotal = 400.00; public double getSubTotal(){return subTotal;} public void setSubTotal(double dbl){subTotal=dbl;} } This could be the problem because the bean:write would expect a bean, but the <%...%> is just accessing an object's method. Also the way to access maps in struts is object(value) eg Which is roughly the same as These should perform the following: cart.get("abc") Michael Marrotte wrote: Here's the bean: public class Cart extends HashMap { private double subTotal = 400.00; public double getSubTotal(){return subTotal;} } Here's the Java: session.setAttribute("cart", new Cart()); Here's the JSP // no output? <%= ((csp.Cart)session.getAttribute("cart")).getSubTotal() %> // works, writes 400.0 Here's the problem isn't producing any output, but <%= ... %> is... Any ideas are greatly appreciated. Thanks, --Mike M. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is wrong with this upload filename (UTF-8) decoding?
I have not used the file upload yet, but I believe you need to set the encoding for the headers formFile.setHeaderEncoding("UTF-8") setHeaderEncoding does this: "Specifies the character encoding to be used when reading the headers of individual parts. When not specified, or |null|, the platform default encoding is used." If this was running on a English operating system it is probably defaulting to the Latin-1 encoding. From this Java Doc: http://jakarta.apache.org/commons/fileupload/apidocs/org/apache/commons/fileupload/FileUploadBase.html#setHeaderEncoding(java.lang.String) Please post back to the forum if this works. I would be interested in the result. Zsolt Koppany wrote: Hi, my application has to support UTF-8 including when files are uploaded with UTF-8 characters in the filename (for example: ??.txt). I use a servlet filter that always call request.setCharacterEncoding("UTF-8") and my jsp pages contain response.setContentType("text/html; charset=UTF-8"); Everything works fine except that I have problems with decoding of the name of uploaded filenames. I use the code below to get the name of the uploaded filename: String nm = formFile.getFileName(); String filename = new String(nm.getBytes(), "UTF-8"); The code above converts only the first couple of characters correctly (result: ??.txt). Any ideas how to fix the problem? I use TC-4.1.29, Struts-1.1, jdk1.4.2_02 Windows-XP. Zsolt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best way to parse a String and replace line feeds with f or html?
That does mean you are adding some html formatting to the action which isn't so nice. Another option that I have used while waiting for the next version of JSTL is the jakarta string taglib: http://jakarta.apache.org/taglibs/doc/string-doc/intro.html eg | A sentence. Another sentence. Some more to test. And insert Br's into. Hopefully.| So you can leave the object/form as is, and use this taglib to change newlines to 's on the JSP page Barett McGavock wrote: Thoughts: 1) Assuming that you have a separate value object to carry this item to the view, try replacing any "\n" with "" in the action. 2) Have you also considered using the HTML tag? B -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 5:05 PM To: Struts Mailing List Subject: Best way to parse a String and replace line feeds with for html? Situation: using the html:textarea element tag to enter notes on an object, thats getting persisted as a blob in our database. I would like to be able to output this to html with the same formatting.. ie the line feeds work. Whats the best way to do this? I tried the jstl:core c:out tag and it didnt work (did not goto the next line), tried the struts bean:write tag same problem. Is there another struts tag library I can use? Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strategy for out of date items through forms using hibernate?
With versioning hibernate increments the version number each time. I believe this is prefrered to the timestamp method, but I think hibernate supports both. (off the top of my head) I have a struts form which holds the fields etc plus the object I loaded from Hibernate. I use DispatchLookUp actions so that all of my actions are selected from the button pressed eg it adds a dispatch=save, or dispatch=overwrite to decide which action to perform. The save action would normally reconnect the hibernate session, start a hibernate transaction, get the object from the form, populate the object properties from the form fields, and end the transaction. To overwrite (dispatch=overwrite), I think I throw the current hibernate session away, create a new one, load a new object using the objects id (this should get the latest version from the db), start transaction and do the same as the save above. David Erickson wrote: I have done this. Hibernate supports versioning (using a version number column), if you use this Hibernate can make sure the changes are not overwritten. The basic process is: 1. Hibernate session A loads object A1 (with identifier 1234) 2. Hibernate session B loads object B1 (also with identifier 1234) 3. Session A modifies object A1 and saves it 4. B modifies object B1 and attempts to save it 5. Hibernate will detect the version number for the object has changed and generate an exception (StaleObjectStateException) 6. Catch this exception, close the hibernate session, return an error message to the user using ActionErrors etc I also have a refresh button so that at any time the user can press refresh which reloads the object from hibernate so it is up to date. When I return my stale object error I also allow the user to either refresh (loses the users changes), cancel (do nothing, return to parent menu), or overwrite. Overwrite can attempt to overwrite the changes by reloading the new object, but use the posted field changes to update and then save the object. Yes I figured this out just barely, rather I used timestamp instead of version (are there any drawbacks to that?). I am interested in doing exactly what you did, but how did you go about overwriting the things that have been changed? Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strategy for out of date items through forms using hibernate?
I have done this. Hibernate supports versioning (using a version number column), if you use this Hibernate can make sure the changes are not overwritten. The basic process is: 1. Hibernate session A loads object A1 (with identifier 1234) 2. Hibernate session B loads object B1 (also with identifier 1234) 3. Session A modifies object A1 and saves it 4. B modifies object B1 and attempts to save it 5. Hibernate will detect the version number for the object has changed and generate an exception (StaleObjectStateException) 6. Catch this exception, close the hibernate session, return an error message to the user using ActionErrors etc I also have a refresh button so that at any time the user can press refresh which reloads the object from hibernate so it is up to date. When I return my stale object error I also allow the user to either refresh (loses the users changes), cancel (do nothing, return to parent menu), or overwrite. Overwrite can attempt to overwrite the changes by reloading the new object, but use the posted field changes to update and then save the object. You should check out versioning on the hibernate web site for more info on that. David Erickson wrote: Hi I am using Struts with Hibernate in a webapplication.. we are using forms etc. The problem I am currently trying to decide how to handle is thus: Assume user 1 loads up an object in a form and is modifying it. Assume user 2 loads up the same object in a form and is also modifying it. User 1 submits the modified object. User 2 also submits the object, however his is out of date and I would like the webapp to tell him that and show the differences that exist. What is the best way to use hibernate to deal with this? What I have attempted is using the built in timestamp feature in MySQL, I have a field in my object that is timestamp but does not insert or update, thus mysql controls its value. Then when the user submits the object I loaded another copy of that object from the DB and tried to compare their dates.. however this gave me an error saying: net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 1, of class: cmcflex.salesweb.model.prospect.Prospect because of the object I loaded to compare. What do do? Is there a better strategy for tackling this? I tried using the actual in the properties for my object, but then when I tried to submit the object the generated sql said "when id=? AND timestamp=?" meaning it would not update if the timestamp is different, and I'm unsure if I could even determine if it did or did not update. Thanks in advance, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with character conversion [partial solution]
This is probably what you are looking for: http://www.anassina.com/struts/i18n/i18n.html The main point here is it tells the browser that the content is UTF-8 instead of the default Latin-1 encoding. It also includes the filter you used earlier to tell java/servlet that it should expect UTF-8 encoded content from forms. Gus Heck wrote: Well after a little poking around, I discovered that it was the browser's fault. Setting the character encoding that the browser is using allows it to send the character without & escaping it, but then one has to also set the encoding when viewing it later. I am wondering if there is a way to support the full range of characters in unicode without having to set the encoding... The app I am building will not be internationalized, but we may want to store some international names and places in the DB and it would be nice if they could display correctly rather than resorting to anglecized spellings, which might be annoying to some people who's names or addresses will be mis-spelled. Anyone know how to do this? Gus Heck wrote: programs fits because they contain a capital dotted I which looks like this: I. (set your encoding to Turkish if necessary to view it, it should look like a capital i with a dot above it) heh it seems to give my mailer fits too, as it got converted to I with a period after it :) - 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] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unicode text in Property files
You can create and edit the property files saving them in UTF-8. Then you convert the UTF-8 into the format java expects eg \u using the native2ascii program that comes with Java. It will create a new file so the created files are what go into your application, leaving your source files in UTF-8. I use an ANT task to do this for me automatically: Here are the Java Docs for native2ascii: http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/native2ascii.html So this should work native2ascii -encoding UTF-8 file1.source file1.properties Debashish Chakrabarty wrote: Hi, I have a query and request you to kindly spare some time to enlighten me. I am making a web application that would translate words from English to various Indian languages using Struts. The application would not use any database so I must use some flat file to store the translation in form of English_word = Hindi_meaning (name value pair or some other form). There would be 11 Indian languages apart from Hindi. Since Java Property files are used in application localization I was of the opinion that they could easily be used to store this data (for eg. a property file State.propeties might store the names of Indian states in Hindi ex: Delhi= ??). The value is written in Hindi unicode here, a Hindi Unicode font is available here for free download. Important point is: My language data (the value for english keys) would be in Unicode, as above. I understand that the default encoding of the property file is not Unicode. So while saving the property file I will have to save it with UTF-8 encoding. Since struts heavily uses the Property files for internationalization, will it be possible for me to use the files with Unicode text in them. I request your advice on how to use the Property file in such a case (or should I use the normal tab-separated text option as above, with the file,being read using Java I/O API). Thanks, Debashish Chakrabarty http://www.jroller.com/page/debashish -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can I avoid *.do in my URLs?
Have a look at this filter that Matt Raible came up with: http://marc.theaimsgroup.com/?l=struts-user&m=106399831922108&w=2 Alan Bram wrote: Hi, I would like to avoid having to formulate my URLs as "*.do", or even "/do/*". I want to have simple names like "/foo" and "/bar", names that no single pattern could match. The reason is that I don't want to expose implementation details in my URLs, because an implementation could change and then my URLs would be no good. I care about this because I want bookmarked URLs within my application to continue to work. (See http://www.w3.org/Provider/Style/URI.html, especially the section called "We used to use a cgi script for this and now we use a binary program.") I had planned to accomplish this by making multiple entries in the web.xml file, one for each page, each one pointing to the controller servlet. (My application has only a small number of pages, so this seemed feasible.) But I just noticed the following warning in the User's Guide (section 5.4.2 "Configure the Action Servlet Mapping"): WARNING - Struts will not operate correctly if you define more than one element for the controller servlet. Eeek! Is there some other way I can do this? Or am I stuck? (Is there maybe some way a servlet Filter could do this for me?) Thanks for listening. Cheers, - arb - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] How to select an Option automatically?
Pingili, Madhupal wrote: I am converting a VB application to Web application. I need to select an option from a drop-down list box as the user enters a value in that box. For example, there are four values in that drop-down box: one, two, three, four As the user types say "f" or "fo", I need to select the option "four". Can anyone share some ideas to do that? BTW, I am using Struts actions and JSP to build the page that contains the option list. When the pull-down has focus and you press a letter, the web browser will normally select the next item in the list with that letter. Eg if you have the following list one two three four and you press 't', it will select 'two', if you press 't' again it will select 'three'. I seem to remember seeing someone do what you described where typing 'th' will go to 'three'. I believe you need to use Javascript to catch the key-press (or was it the key-release?) event. Then store the key presses in a javascript variable - also have to take into account backspace - and after each key press search the pull-down list for the match. I am pretty sure the code to do this is horrible as it has to deal with both the IE and Netscape event model and what to do if the arrow keys are used to move up down etc. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tokens
The Struts saveToken() & isTokenValid() methods save a token so that double submits are detected and can be dealt with. Just disabling the submit button won't stop a user submitting and then refreshing the page (which submits the same info twice) or going back in their history and clicking submit on an earlier page. Geeta Ramani wrote: Gurpreet: Don't mean to jump in if you already have found a good solution, but wouldn't it be simpler to just not allow the user to press the submit btton twice? It is easy (using Javascript) to disable a submit button once it has already been pressed.. Regards, Geeta "Mainguy, Mike" wrote: Call saveToken() in GET (or read) Test isTokenValid() in the POST (or write) to see if it is a dupe (duplicate returns false [bad token]) worse is better -Original Message- From: Gurpreet Dhanoa [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 11:19 PM To: Struts Users Mailing List Subject: Re: Tokens hi Ramadoss Thanks for your help. But this is not i m looking for. I may not be able to explain my question proeprly . But i m looking for saveTOken() method implementation in struts which does not allow duplicate entry of records into the database when the user click on submit button twice. - Original Message - From: "Ramadoss Chinnakuzhandai" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, November 19, 2003 7:56 PM Subject: RE: Tokens Hi Gurpreet, If what I understand is correct from your question, you can use split function the same way as you use String Token...following is sample snap shot String str = "botherouioero:and:foroffo:mar:ssod:slave"; String[] arr = str.split(":", 9); System.out.println("length of arr[] is:" + arr.length); for (int i = 0; i < arr.length; i++) { System.out.println("value is :" + arr[i]); } String[] ar = str.split("o", 8); System.out.println("length of arr[] is:" + ar.length); for (int i = 0; i < ar.length; i++) { System.out.println("value is :" + ar[i]); } Where the number 9 and 8 denotes number of occurences you want to consider after which it will be treated as whole single string and will be included into your String Array. Hope this help, -Ram -Original Message- From: Gurpreet Dhanoa [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 6:19 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Tokens hi All Can somebody explain small code snap shot of using Tokens. AS i am trying to use it in one of my application. but due to some unknown reason it is not working. I may be doing something wrong. Any help will be appreciated Regards GAry -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with UTF-8 characters in a mutlipart/form-data encoded form
Paul Barry wrote: By using a element, do you mean this: That doesn't seem to work when the form is multipart/form-data, because the Content-Type header still just has multipart/form-data. The problem seems to be that when I do a request.getCharacterEncoding(), I get null. Is that normal? I would think I should at least get the default character encoding for the webapp. I am using Resin 2.1.10. This might be an issue for me to report to them. This definately is what is causing my problem, because if I look at the code in org.apache.struts.upload.CommonsMultipartRequestHandler.addTextParameter(), this is the first thing is does: try { value = item.getString(request.getCharacterEncoding()); } catch (Exception e) { value = item.getString(); } Since request.getCharacterEncoding() is null, I assume an Exception is being throw an caught (a log.warn() might be nice there) and then I am get getting the string without decoding it from UTF-8. If I manually set the characterEncoding to UTF-8 before this code executes (in processMultipart() in the requestProcessor for example), then everything works fine. So I guess my question is should I be expecting request.getCharacterEncoding() to return null or is there a bug in my app server? Nope, it is not a bug. The browser hasn't set the encoding, so the method returns null to indicate this. Here is the relevant section from Java™ Servlet Specification Version 2.3 (servlet-2_3-fcs-spec.pdf) "SRV.4.9 Request data encoding Currently, many browsers do not send a char encoding qualifier with the Content-Type header, leaving open the determination of the character encoding for reading HTTP requests. The default encoding of a request the container uses to create the request reader and parse POST data must be “ISO-8859-1”, if none has been specified by the client request. However, in order to indicate to the developer in this case the failure of the client to send a character encoding, the container returns null from the getCharacterEncoding method. If the client hasn’t set character encoding and the request data is encoded with a different encoding than the default as described above, breakage can occur. To remedy this situation, a new method setCharacterEncoding(String enc) has been added to the ServletRequest interface. Developers can override the character encoding supplied by the container by calling this method. It must be called prior to parsing any post data or reading any input from the request. Calling this method once data has been read will not affect the encoding." Martin Cooper wrote: In Struts 1.1, the default file upload mechanism *is* Commons FileUpload. ;-) It seems that you may have omitted to tell the browser explicitly that your pages are in UTF-8. For some reason that I've never fully understood, that causes the browser to use UTF-8 when it submits subsequent requests from that page. Make sure that you use a element in your to specify UTF-8. -- Martin Cooper "Paul Barry" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I think you are correct. When I was looking at the packets and seeing two characters, it is actually the characters that are equal to the 2 bytes that make up the single UTF-8 character. I thought the browser was somehow not correctly encoding my data, because it was turning 1 character into 2 characters, but actually it is UTF-8 encoding my character correctly. So I think if I use something to read the data and convert it from UTF-8 to Unicode, I will get the correct data on the server. So from reading the documentation about FileUpload, that seems to be the way to go, but now my question is how to integrate FileUpload with struts? My thought would be to call a method to populate an ActionForm in the beginning of my action, and then use that ActionForm instead of the one I get from the requestProcessor. So like this: public ActionForward execute( ActionMapping mapping, ActionForm pform, HttpServletRequest request, HttpServletResponse response) throws Exception { TestActionForm form = getFormUsingFileUpload(request); log.info("The value is: "+form.getTest()); return null; } Is this how others have used Jakarta Commons FileUpload with Struts, or is there a better way? Jason Lea wrote: From what I can see there Resin is expecting UTF-8 for any paramters passed to it, and decoding it correctly. However multipart/form-data is treated differently as the data is not passed as normal parameters so the request.getParameter() cannot be used here (and servlet filters that set the request encoding won't help either). You normally have to use something like the FileUpload com
Re: Problem with UTF-8 characters in a mutlipart/form-data encoded form
st; public String getTest() { return test; } public void setTest(String string) { test = string; } } --------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: & internationalization
Normally I have an action that prepares data that initialises the form with default information. This action will get the information from the message resources (using the chosen locale), puts them into a LabelValueBean and put those beans into a List. Then that List is put into the ActionForm, and the tag reads the value from the form. koen boutsen wrote: Does anyone know how I can use interantionalization in the tag in a . In Can anyone help Thanks Koen Enter for a chance to win one year's supply of allergy relief! http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda3.com/1/c/563632/125699/307982/307982 This offer applies to U.S. Residents Only - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Webapp works fine until uploaded to remote server
todd thorner wrote: Hi all, I'm a newbie trying to deploy my first Struts webapp. Mine works fine inside my development environment (Struts 1.1, Tomcat 4.1.x), but when I transfer all local files to the service provider I'm using for public servlet deployments (where they also use Tomcat 4.1.x), I get the following error (500): org.apache.jasper.JasperException: Cannot find global ActionForward for name welcome I have changed nothing in "struts-config.xml" or any other file. I have uploaded "Struts.jar" to my remote WEB-INF/lib directory. My webapp uses the usual approach of "Index.jsp forwards to Welcome.jsp", which as I said works fine in my development environment. Here is the line in "Index.jsp" Here is what's in my "struts-config.xml" shouldn't this: be this: I must be forgetting something simple, some .jar or something. Any help? Thanks. Enter for a chance to win one year's supply of allergy relief! http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda3.com/1/c/563632/125699/307982/307982 This offer applies to U.S. Residents Only - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: sorting and searching in Struts/tiles
I have included a quick example of doing this by using a list of hashmaps. The hashmap holds the text that may appear in the pulldown. list = new ArrayList(); for (Iterator i = myObjects.iterator(); i.hasNext();) { Map map=new HashMap(); map.put("firstName","Joe"); map.put("lastName","Smith"); map.put("fullName","Joe Smith"); map.put("someOtherField","blue"); list.add(map); } to sort the list we use can do this: Collections.sort(list, new BeanComparator("lastName")); (this uses the BeanComparator from here http://jakarta.apache.org/commons/beanutils.html) This will sort ascending by default, so to get decending I can do this afterwards... Collections.reverse(list); Dinh Nguyen wrote: Hi Tim, In this case, I have to display the sorted list (ascending and descending) for names, etc. How do I do this? How can I pull the objects from the back-end. I am thinking to use collections.sort(list, comparator)as you mentioned or use sortedset and using arraylist (or hashset) to hold objects. For searching, I am thinking to use hashtable, but have no idea what's the next step. I use the EJB as back-end and has not implemented it yet. If you can give me feedback on this or give me some kinds of ideas, then it'll be great. Thanks for your help. Dinh Nguyen --- In [EMAIL PROTECTED], "Chen, Gin" <[EMAIL PROTECTED]> wrote: I'm not sure I understand this question but wouldn't you just implement some comparators? Then based on the sort option selected you can call something like: Collections.sort(list, comparator)? As for the search just have a java module to search thru the collection. I'm not quite sure how what this question really has to do with Struts. Unless you use something like the displaytags to display a sortable list for the names. -Tim -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 1:26 PM To: Struts Users Mailing List Subject: sorting and searching in Struts/tiles [Forwarded from Dinh Nguyen, his emails aren't reaching the list] Dinh Nguyen wrote: Hi, I am wondering how do you do the sorting and searching in struts. Let say, when a person views a list of collections (for example, the list consists of 5 people, each person has first name, last name, age), there is a drop-down menu on the bottom of the table/page says that: 1) Sort has two options: a) Ascending b) Descending 2) Search has three options a) Last Name b) First Name c) Age Since data is not stored in database yet. so in this case how can I do it using Struts? Thanks for your help. DN --- -- 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] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Charset Encoding problems with JSP Fragments (Tiles)
I have had a similar experience with Tomcat 4.1.*. Though I seem to remember that putting this <%@ page contentType="text/html; charset=UTF-8"%> In the tiles layout page worked if Tomcat compiled the pages. But if I pre-compiled the jsp tiles it wouldn't work. My guess was that when pre-compiling each page is given to the compiler and the content type is read from the page, but if it is included when Tomcat compiles a page it takes the content type from the parent page. That means to pre-compile I have had to add <%@ page contentType="text/html; charset=UTF-8"%> to every jsp page. So normally I have this at to top of each page: <%@ page contentType="text/html; charset=UTF-8"%> <%@ include file="/WEB-INF/jsp/include/global.jsp" %> and I stick everything else that is needed on everypage into global.jsp - such as taglibs. Putting the content type into global didn't work when pre-compiling either. Ivica Pavic wrote: I'm trying to set the UTF-8 charset for the whole application. I'm using Struts/Tiles on Tomcat 4.1.27. For now the only way to achieve this was adding <[EMAIL PROTECTED] contentType="text/html; charset=utf-8"%> on EVERY Tile (JSP). It's a lot of copy/paste job and I'm sure there should be a more elegant way. I've tried several things: 1. Setting the controller contentType to "text/html; charset=UTF-8" in struts-config.xml 2. Adding <%request.setCharacterEncoding("UTF-8");%> in the master layout 3. Adding to Master layout's BUT NOTHING WORKS except adding a page directive on every JSP fragment. Anyone has that resolved? Ivica --------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem when uploading text with paragraphs
This probably isn't a struts problem if I am guessing correctly... I assume that the problem is you enter text into the textarea and have several new lines eg paragraph number 1 with some text that might wrap at the edge of the textarea paragraph number 2 with some different text paragraph number 3 to end the textarea This gets stored in MySql, but when the text is redisplayed on the HTML page it appears like this: paragraph number 1 with some text that might wrap at the edge of the textarea paragraph number 2 with some different text paragraph number 3 to end the textarea eg missing the line breaks. To fix this the developer needs to do a search and replace on the text looking for /n (the newline character) and replacing it with the html line break. You only want to do this when displaying the text, not when you put it into the database. If you wanted to edit this text again it would have tags instead of newlines which would look bad. Also if you use something like to write out the text it will try to escape the characters, meaning the will change into <br/> and not work as line breaks. I use this taglib http://jakarta.apache.org/taglibs/doc/string-doc/intro.html for doing the replace in the JSP page after the html has been escaped. I use it with JSTL eg but you might be able to use it like this (if using struts tags): Catalin :: Braescu wrote: I am not the developer but rather the internal client who asks a colleague developer deliver some feature and the developer can't find the solution. Anyway, we have a blog application written in Struts. The user inputs some text, consisting of more than one paragraph. The submit is done using textarea from Struts, not from HTML (I can't explain better, I am not the developer, but I am sure you understand what I mean). Unfortunately at this stage all formating of text (most important paragraph markings) is cleared away; within Mysql the text is one single chunk. There must be a solution to upload text corectly into a database using Struts, so if there are any paragraphs they are preserved during submit. Any hints? With many thanks in advance for absolutely any help, Catalin -- Catalin Braescu Scuba.ro Bucharest - ROMANIA (Europe) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help with URL localization (continued)
Ruth, Brice wrote: This seems like a good idea, but I think it would prevent the country code from always being available in the URL (so if you're in the US site, you should always see /US/index.do, etc.) unless I can do this within the Tomcat/Servlet interaction, w/o issuing a redirect to the browser?! Can chain.doFilter() send the request to an action other than what was initially invoked by the browser? Yes, the filter catches the request before it is passed to the servlet so you can do pretty much anything you like including sending the request to a different action. But the redirect is usually server side, so the browser would see the original URL. So the problem comes back to getting the links to include the country code. Here are 2 ways... 1. (probably involves the most work) Create some new JSP tags using the Struts tags a base. You need to do almost the same thing but insert that country code at the start of the link. Then you can use some text, which would create a link with url '/US/crafts/crafts.do' 2. (this might work staight off, and doesn't look too bad) Using JSTL and the Struts-EL tags... some text Though i think struts puts the locale into the session under the name |'org.apache.struts.action.LOCALE', so you might| need to put a copy (in your filter) into session under a shorter name - or even just the country code that you are using. Eg put into session as 'urlprefix' and The only thing you are losing here is you are not linking to the action name ('crafts/crafts'), you have to link to the url name 'crafts/crafts.do'. So if you changed the servlet mapping from '*.do' to '/do' you would have to change the links. Brice Jason Lea wrote: Here is a thought... Set up your action mappings in struts-config.xml without the domain prefix eg /index.do /crafts/crafts.do Then in your filter you can check for the locale prefix and set the locale. In the same filter, construct a new path by removing the locale prefix and forward to the remainder of the path eg request is /de/index.do --> redirect to /index.do Struts will then match this and forward to the correct action. If the request doesn't contain a matching locale then just let the request pass through. eg /crafts/crafts.do would be let through unchanged as the 'crafts. does not match a locale. As the first request should set the locale, you may not need to include it in any subsequent requests so .jsps can link to /index.do instead of /de/index.do eg request #1: /de/index.do (filter sets locale to de) request #2: /crafts/crafts.do (uses locale already set to de) Hmm, you could even change the filter mapping so it is only invoked for the locales that you are covering eg /de/* /fr/* Then you won't have to do let through any unmatched locales eg /crafts/crafts.do would not be checked by the filter, but /fr/crafts/crafts.do is caught, locale set and redirected to /crafts/crafts.do Ruth, Brice wrote: The straightforward wildcarding didn't seem to work (it matched against a literal wildcard). Just an FYI for others, I guess .. :) Adam Hardy wrote: Hi Brice, wasn't long before you came back! I was holding out thinking someone else might have a more intuitive solution than mine, but whatever, in your position I write my own taglib based on the html link taglib & add in the locale to the URL in that. As for the action mappings, I think you're going to have to test it to see if you can use patterns. The struts gurus seem to be keeping their heads down, but maybe one of them will chime in. Adam On 10/21/2003 05:40 PM Ruth, Brice wrote: Greetings. As per my previous thread on the best way to create a URL structure like: http://domain/us/whatever http://domain/de/whatever etc. I've implemented the recommendations I received and now have a Filter listening to each request and setting the locale appropriately based on the country code specified in the URL. Working great :) I also have the .jsp I'm working with mapped to an action with a path like /us/index.do. Now, within this index page, I have links in my navigation, being generated by the Struts HTML tags (html:link) - how would I best go about incorporating the country URL prefix (/us/, /de/, /fr/, etc.) without manually having to insert something like - also, instead of setting up an action for each .jsp, for each language (/us/index.do; /de/index.do; /us/crafts/crafts.do; /de/crafts/crafts.do; etc.) - what's a better way of doing this? Can I create an action using org.apache.struts.actions.ForwardAction that uses a wildcard? So something like /*/index.do would have a parameter of /index.jsp and /*/crafts/crafts.do would have a parameter of /crafts/crafts.jsp. I'm looking for guidance - best way of accomplishing my goals of code-reu
Re: Help with URL localization (continued)
Here is a thought... Set up your action mappings in struts-config.xml without the domain prefix eg /index.do /crafts/crafts.do Then in your filter you can check for the locale prefix and set the locale. In the same filter, construct a new path by removing the locale prefix and forward to the remainder of the path eg request is /de/index.do --> redirect to /index.do Struts will then match this and forward to the correct action. If the request doesn't contain a matching locale then just let the request pass through. eg /crafts/crafts.do would be let through unchanged as the 'crafts. does not match a locale. As the first request should set the locale, you may not need to include it in any subsequent requests so .jsps can link to /index.do instead of /de/index.do eg request #1: /de/index.do (filter sets locale to de) request #2: /crafts/crafts.do (uses locale already set to de) Hmm, you could even change the filter mapping so it is only invoked for the locales that you are covering eg /de/* /fr/* Then you won't have to do let through any unmatched locales eg /crafts/crafts.do would not be checked by the filter, but /fr/crafts/crafts.do is caught, locale set and redirected to /crafts/crafts.do Ruth, Brice wrote: The straightforward wildcarding didn't seem to work (it matched against a literal wildcard). Just an FYI for others, I guess .. :) Adam Hardy wrote: Hi Brice, wasn't long before you came back! I was holding out thinking someone else might have a more intuitive solution than mine, but whatever, in your position I write my own taglib based on the html link taglib & add in the locale to the URL in that. As for the action mappings, I think you're going to have to test it to see if you can use patterns. The struts gurus seem to be keeping their heads down, but maybe one of them will chime in. Adam On 10/21/2003 05:40 PM Ruth, Brice wrote: Greetings. As per my previous thread on the best way to create a URL structure like: http://domain/us/whatever http://domain/de/whatever etc. I've implemented the recommendations I received and now have a Filter listening to each request and setting the locale appropriately based on the country code specified in the URL. Working great :) I also have the .jsp I'm working with mapped to an action with a path like /us/index.do. Now, within this index page, I have links in my navigation, being generated by the Struts HTML tags (html:link) - how would I best go about incorporating the country URL prefix (/us/, /de/, /fr/, etc.) without manually having to insert something like - also, instead of setting up an action for each .jsp, for each language (/us/index.do; /de/index.do; /us/crafts/crafts.do; /de/crafts/crafts.do; etc.) - what's a better way of doing this? Can I create an action using org.apache.struts.actions.ForwardAction that uses a wildcard? So something like /*/index.do would have a parameter of /index.jsp and /*/crafts/crafts.do would have a parameter of /crafts/crafts.jsp. I'm looking for guidance - best way of accomplishing my goals of code-reuse, ease-of-maintenance, as well as being able to provide the flexibility in URL naming that marketing would like to see. Thanks, Brice -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n - Chinese charactor problem
If you are using UTF-8 everywhere it should work - I use it for english & Japanese and it works. You mentioned in another message you had this: SetCharacterEncodingFilter encoding GB2312 Are you still using that? or UTF-8? Everything has to match. ZYD wrote: Hi Jason, Thank you for your response. I did exactly the same thing as the article said, but still, not working properly. Chinese can be displayed, but not in the text box. If I change <%@ page contentType="text/html; charset=UTF-8" %> to <%@ page contentType="text/html; charset=GBK" %> then the Chinese charactors are handled properly. Why is that? - Original Message - From: "Jason Lea" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, October 17, 2003 5:51 AM Subject: Re: i18n - Chinese charactor problem Here is a link that explains what is needed and a filter to do it... http://www.anassina.com/struts/i18n/i18n.html Greg Reddin wrote: I don't remember the exact code, but a looong time ago we had to write a Filter that created a request wrapper that properly set the character encoding on request parameters. Maybe googling that would turn up something. Greg ZYD wrote: Hi, I have a problem in getting the Chinese charactors from , The following is my jsp file: <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> - I have two property files, one is for englisn, the other is for chinese. Both english and chinese can be displayed properly on the page, except in the text box. When I input chinese charactors in the text box and submit, I cannot get the chinese charactor in the form bean correctly. The chinese charactors become some unreadable charactors like . There are no special process in the getEmail and setEmail method in the form bean. Does anybody have similar problem? I need your advice. Any response is appreciated. --bruce ----- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea ----- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n - Chinese charactor problem
Here is a link that explains what is needed and a filter to do it... http://www.anassina.com/struts/i18n/i18n.html Greg Reddin wrote: I don't remember the exact code, but a looong time ago we had to write a Filter that created a request wrapper that properly set the character encoding on request parameters. Maybe googling that would turn up something. Greg ZYD wrote: Hi, I have a problem in getting the Chinese charactors from , The following is my jsp file: <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> - I have two property files, one is for englisn, the other is for chinese. Both english and chinese can be displayed properly on the page, except in the text box. When I input chinese charactors in the text box and submit, I cannot get the chinese charactor in the form bean correctly. The chinese charactors become some unreadable charactors like . There are no special process in the getEmail and setEmail method in the form bean. Does anybody have similar problem? I need your advice. Any response is appreciated. --bruce - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction, theory behind it
The HTML/4.01 spec does have something that addresses this, the tag. The problem is browser support. You can supply the 'type' (eg submit, reset, button), a 'value' that is returned as the name/value pair, and the button label is the body of the tag (meaning you can mix images, text, and other formatting tags into the label). You can use it like this: delete item Which is great, but as IE doesn't support it correctly it becomes useless. Other browsers do support it, Mozilla for example. IE's problems include defaulting all tag 'types' to 'button' instead of 'submit', returning the label in the name/value pair and putting all button fields into the request instead of the submit button being activated. So we are stuck with using buttons and LookupDispatchAction. Craig R. McClanahan wrote: Adam Hardy wrote: I thought I might just raise this here because I see struts has obviously no qualms about submit button functionality, but it bugs me. I'm not using LookupDispatchAction, but I would like to if it wasn't for the annoying browser behaviour on submit of the HTML-input submit button values. LookupDispatchAction is great for sorting out the appropriate action according to which submit button was clicked, even if those submit buttons have got localized text. But surely it's just pandering to the poor design of HTML? Yep. Surely W3C is going to have to change that browser behaviour recommendation, Whether they should or not isn't really the issue ... it's whether they will. I'm betting that: * They won't (especially not as an HTML/4.01 successor, since the focus there is on XHTML and modularization and such, not HTML. * They won't (just for this issue) because it's not important enough by itself, and creating new standards is *expensive*. * They won't (because existing workarounds are available -- it's not a dealbreaker bug * Even if they did, it wouldn't matter to Struts ... we'd have to support the current mechanism anyway because 100% of the worlds browsers today don't support the new mechanism. because submitting the button name-value pair as "submit/labeltext" is indisputably linking function and content, which these days should be frowned upon. Shouldn't it? I mean, it could use body text for the label, and submit its value, or it could have a caption attribute or similar. Adam Craig ----- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamically populating tile lists at runtime for menus - Is it possible?
The docs show that doesn't accept a role attribute, and the tag does but not in a definiton so I don't think you can. I have a menu tile that is displayed on every page. I use the to check user roles, and display items depending on that. ... ... (general links that any user can access, don't have to be logged in) Your other option might be to use a tile controller to generate the list. Joanne L Corless wrote: Hi, I am in the process of building a Struts/Tiles application that needs to be able to dynamically construct menu lists when the user logs in. For instance a user may belong to the base user role, therefore a single tab should be displayed but he could also belong to an admin role, therefore 2 tabs need to be displayed. Is there a way of building the . . . . . dynamically? All the documentation I have found so far seems to suggest that all these lists need to be predefined, however I want to be able to retrieve the item's from a database within a Struts action as the number of combinations of list items could run into the hundreds. Regards Joanne Corless CSC Computer Sciences Limited ( Office +44 (0)1772 318025 ( Mobile +44 (0)7767 656588 * email [EMAIL PROTECTED] Based at: CSC, Alliance House, Library Road, Chorley, Lancs, PR6 7EN CSC Computer Sciences Limited: Registered in England, No. 963578. Registered office: Royal Pavilion, Wellesley Road, Aldershot, Hampshire, GU11 1PZ. This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: element
Shane Mingins wrote: If memory serves me correct was only supported by IE has that changed? I like the button tag and I was going to use it when I found it because of the control over the button text and values that are submitted. I was testing using Mozilla and it was great. It is probably supported by Opera etc But testing with IE (version 6 I think) showed it had problems. It is unusable with out resorting to JavaScript to control it's use. The spec says that the default action for a tag should be 'submit'. IE defaults to 'button' which means it won't submit a form (this means you need to add type="submit" to the tag). But the problem that made it unusable was that when the form is submitted all button fields are submitted. Also instead of passing the value in the 'value' attribute, it passes the button text. Try this in your favourite browers: first button second button third button Pressing the first button: Mozilla result (good): button_test.html?textfield1=abc&dispatch=first IE 6 result (bad): button_test.html?textfield1=abc&dispatch=%3CB%3Efirst%3C%2FB%3E+button&dispatch=%3CB%3Esecond%3C%2FB%3E+button&dispatch=%3CB%3Ethird%3C%2FB%3E+button Shane -Original Message- From: Graham Leggett [mailto:[EMAIL PROTECTED] Sent: Tuesday, 30 September 2003 4:48 a.m. To: Struts Users Mailing List Subject: element Hi all, I don't seem to see a corresponding struts html tag to render a "button" element - is there a reason for this, or am I reading the docs wrong? Regards, Graham -- - 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] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] off topic, but I have a quick JavaScript question please...
If you are not worried about older browsers there is another way to get tooltips without using JavaScript. Browsers with good HTML4.01 support will display 'title' attributes as tooltips. Form tags (and lots of other tags in HTML 4.01) allow you to specify a title. If you use Struts tags you can use 'titleKey' to look up the key from the message bundle... eg Mick Knutson wrote: It just makes my code much cleaner inside my function. But I do understand the way you described. Thanks --- Thanks Mick Knutson http://www.baselogic.com +001(805) 563-0666 Office +001 (708) 570-2772 Fax --- - Original Message - From: "Daniel Smeltzer" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, September 26, 2003 9:06 AM Subject: RE: [OT] off topic, but I have a quick JavaScript question please... Well, the tag would need to be where the function is called, not where it is defined. The struts tags will execute on the server side and the JavaScript executes on the client side. When the JavaScript runs, all the struts tags will have been executed and converted into text. So, you'd need something like: function tooltip(message) { return overlib(message, STICKY, CAPTION, message, CENTER); } And somewhere else: ... onMouseOver="return tooltip('')" ... Daniel -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Friday, September 26, 2003 10:59 AM To: Struts Users Mailing List Subject: Re: [OT] off topic, but I have a quick JavaScript question please... Thank you, but now another issue: How do I dynamically use that argument in my ??? function tooltip( tooltip_key ) { return overlib( '' , STICKY, CAPTION , '' , CENTER ); } --- Thanks Mick Knutson http://www.baselogic.com +001(805) 563-0666 Office +001 (708) 570-2772 Fax --- - Original Message - From: "Daniel Smeltzer" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, September 26, 2003 8:52 AM Subject: RE: [OT] off topic, but I have a quick JavaScript question please... In your function definition, just declare the input parameters and use those names to refer to them, i.e.: Function tooltips(message, title) { // now the input parameters are available as message and title } Daniel -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Friday, September 26, 2003 10:50 AM To: struts Subject: [OT] off topic, but I have a quick JavaScript question please... I have a function "function tooltips()" and the call to that function is "return tooltip('tooltip.msg.name', 'tooltip.title.name');" in my function, how do I access each of the arguments? Is it something like args[0], and args[1]? --- Thanks Mick Knutson http://www.baselogic.com +001(805) 563-0666 Office +001 (708) 570-2772 Fax --- -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: japanese in form
Try this link http://www.anassina.com/struts/i18n/i18n.html and look item number 7. The form data being submitted might not be being read as Shift_JIS or UTF-8 but instead the default ISO-8859-1 format. You need to set the character encoding of the request before Struts puts the request parameters into your ActionForm. As suggested in the link above, a filter can be used to set the encoding. Amit Rana wrote: Hi, I am having exactly same problem as in this thread http://www.mail-archive.com/[EMAIL PROTECTED]/msg38443.html i.e. Japanese in the form elements (textboxes) becomes garbage once form is re-shown. I have this tiles/struts application Japanese from properties or from form is displayed problem but when form is re-displayed Japanese becomes garbage. I have tried putting all the combinations given in http://www.mail-archive.com/[EMAIL PROTECTED]/msg12490.html Can anyone suggest what can be done to solve this problem? Regards, Amit. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Know of any good Calendar Tag Libraries? (Sorry, that was Aug 21)
One that can do both... (but is DHTML, not taglib) http://dynarch.com/mishoo/calendar/cal.html Matt Raible wrote: I'm aware of Matt's Library (and I love it), but I don't want a pop-up, I want an in-page calendar. Matt -Original Message- From: David G Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 4:37 PM To: Struts Users Mailing List Subject: RE: Know of any good Calendar Tag Libraries? (Sorry, that was Aug 21) What about Matt Kruse's (very) beta taglib mentioned August 21st? http://www.mattkruse.com/javascript/javascripttoolbox.zip I wonder if it's any further along. -David -Original Message- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 6:23 PM To: '[EMAIL PROTECTED]' Subject: Know of any good Calendar Tag Libraries? Anyone know of a good Calendar Tag Library - that renders calendars like the ones you see on blogs (not a pop-up)? I found this one (http://tinyurl.com/ok95) from Coldbeans, but it's $50 - whereas free is always better. We just need it to render a calendar on a page and gray out certain days (with CSS) to say that day is not available. Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Page Title
Craig R. McClanahan wrote: Bryce Fischer wrote: How do i assign different title for each page using tiles. Following is my tile layout which has title "My Site Name". And it has Header, Side Menu, BODY, Footer. Should i have in each BODY jsp ? Is there any short cut to get the page name and over ride the main layout title ? Definitely. Put this in your header: Now, in your tiles-def.xml file, put this: I'm almost embarrassed to ask this :-), but is there a way to localize the replacement title? Not directly that I know of. However, I put the resource key for the page in the tiles definition eg Then you can use this to write out the localised page title in the JSP page: Craig McClanahan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is it possible to remove *.do or /do/* from the URL [solved]
Jason Lea wrote: Look good... You can probably move the vanity extension loop to be outside the main loop because you only need loop throught the extensions once. Is this going to have any issues with 'jsessionid' being added to the path? Here I go replying to my own question No, the getServletPath() does not include extra path info or query string so it should be ok. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is it possible to remove *.do or /do/* from the URL [solved]
Look good... You can probably move the vanity extension loop to be outside the main loop because you only need loop throught the extensions once. Is this going to have any issues with 'jsessionid' being added to the path? -- Jason Lea Matt Raible wrote: Back to the original question... I found a solution and want to validate it: 1. I created a RequestFilter that maps to /* 2. This filter checks to see if request.getServletPath() matches any of the action paths in struts-config.xml. If so, it forwards to the action. 3. As an added feature, I added a set of allowed extensions to this filter's init parameters. So far I have .jsp,.html,.asp,.cfm (using .jsp ensures no one links to them directly, MVC enforced!) - so marketing can choose what technology they want to convey ;-) This seems to work great. For example, I have an "advancedSearch" action defined as follows: type="org.apache.struts.actions.ForwardAction" parameter=".advancedSearch"/> (ForwardAction will eventually be replaces, if necessary, with a real action). This allows all of the following URLs to work: http://site.com/do/advancedSearch (works with Struts by default) http://site.com/advancedSearch http://site.com/advancedSearch.html + all other extensions listed. Pretty slick IMO. Please let me know if I'm missing anything. Thanks, Matt Here's the code from RequestFilter.doFilter(): // get Struts' configuration ModuleConfig m = getModuleConfig(request); // get a list of actions ActionConfig[] actions = m.findActionConfigs(); // get the requested path String path = request.getServletPath(); for (int i = 0; i < actions.length; i++) { ActionConfig action = actions[i]; String actionPath = action.getPath(); String params = RequestUtil.getRequestParameters(request); // check to see if path ends with a vanity extension for (int j = 0; j < allowedExtensions.length; j++) { if (path.endsWith(allowedExtensions[j])) { path = path.substring(0, path.indexOf(allowedExtensions[j])); break; } } if (StringUtils.equalsIgnoreCase(actionPath, path)) { StringBuffer url = new StringBuffer(); boolean redirect = false; // change to true if using redirect if (redirect) { url.append(request.getContextPath()); } url.append("/do" + actionPath); url.append((!StringUtils.isEmpty(params)) ? ("?" + params) : ""); if (log.isDebugEnabled()) { log.debug("forwarding from path '" + path + "' to action '" + actionPath + "'"); } // This this until we have issues (this way the URL doesn't change) RequestDispatcher dispatcher = request.getRequestDispatcher(url.toString()); dispatcher.forward(request, response); // If a forward doesn't work - use the one below // Redirect the page to the desired URL // response.sendRedirect(response.encodeRedirectURL(url.toString())); // ensure we don't chain to requested resource return; } } protected ModuleConfig getModuleConfig(HttpServletRequest request) { ModuleConfig mConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY); if (mConfig == null) { mConfig = (ModuleConfig) config.getServletContext().getAttribute(Globals.MODULE_KEY); } return mConfig; } -Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:10 PM To: Struts Users Mailing List Subject: Re: Is it possible to remove *.do or /do/* from the URL If there are only a small number of 'marketing' style URLs that are going to be used, you could do those mappings specifically in the web.xml and leave everything else to your /do/* mapping Eg Marketing URLs 'activities', 'contact', 'foo' /activities/* /contact/* /foo/* everything else /do/* Or you could wrap a filter around the /activities/*, /contact/*, /foo/* mappings and forward to the correct action. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Map Backed Form/Tiles
Ray Madigan wrote: I have narrowed the problem down to: being in a tile. If the tag is in the main body of the JSP everything works as it should. - Guess I better look harder at the tiles I use. Thanks Looking at this I haven't used the value='' attribute before. The Struts taglib API says ' Value to which this field should be initialized. [Use the corresponding bean property value] [RT Expr]' This sounds like it will try to access the method in the form bean to find the initial value. If your ${element.value} evaluates to "abc" then it will try to do a Form.getAbc() for the initial value. I don't think that is what you want. I think you should be using this: and in the action that you call to get to this JSP page, you should be putting in the initial values. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Map Backed Form
You don't have any other setElementMap() methods in there do you? eg public void setElementMap(String key, Object value) public void setElementMap(String key, String value) There should only be 1. Ray Madigan wrote: Jason - thanks for your help. I do appreciate it. This code worked in 1.1 beta and I haven't had a chance to look at it since then. I have found that the exception I am getting is caused by Struts via BeanUtils attempting to access a setter on a bean when the setter method doesn't exist. I added to the line: private Properties elementMap = new Properties(); I rechecked the name of the methods and the name in the jsp. I remember once I had a space between the ( and the parameter and the parser couldn't find the parameter. This page lives in a set of pages that all use the same formBean it is the only page that uses the map. Also the html text control code lives in a tile. The tile declares itself a form and uses the correct form. I'll have to dig in the source I guess. -Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:29 PM To: Struts Users Mailing List Subject: Re: Map Backed Form Perhaps you need to step through the struts-config to make sure you are referencing the correct form bean. Do you access the .jsp page directly or go through an action first? I would also look at your initialisation of the elementMap. Perhaps you should be using private Properties elementMap = new Properties(); and in your reset method: elementMap.clear() to make sure it is initialised at first use. If you accessed the .jsp directly I don't think the reset method is called, but the bean is created. Ray Madigan wrote: I tried this - same result? h -----Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 2:18 PM To: Struts Users Mailing List Subject: Re: Map Backed Form I read this somewhere (perhaps Struts in Action) and I use map-backed properties... the methods should have String keys, but Object values eg public Object getElementMap ( String key ) { public void setElementMap ( String key, Object value ) Ray Madigan wrote: I am having some difficulty with my Map Backed Form implementation. I have in my Form: private Properties elementMap = null; public String getElementMap ( String key ) { return ( String ) elementMap.getProperty ( key ); } public void setElementMap ( String key, String value ) { elementMap.put ( key, value ); } public void reset ( ActionMapping mapping, HttpServletRequest request ) { ... elementMap = new Properties ( ); } I have in my JSP: If I enumerate the request parameters in the reset method of the form the paramaters and values look like: name->elementMap(PerPage) value->4 I get the exception java.lang.IllegalAccessError: try to access class org.apache.commons.beanutils.MappedPropertyDescriptor$1 from class org.apache.commons.beanutils.MappedPropertyDescriptor From past experience I get this exception when struts is looking for a setter in my form and can't find it. I think that struts is looking for a method 'setElementMap(perPage)' and has not figured out it is a mapped property for some reason. And I can't write a method with name. Any help would be appreciated. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - 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] -- Jason Lea - 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] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Map Backed Form
Perhaps you need to step through the struts-config to make sure you are referencing the correct form bean. Do you access the .jsp page directly or go through an action first? I would also look at your initialisation of the elementMap. Perhaps you should be using private Properties elementMap = new Properties(); and in your reset method: elementMap.clear() to make sure it is initialised at first use. If you accessed the .jsp directly I don't think the reset method is called, but the bean is created. Ray Madigan wrote: I tried this - same result? h -Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 2:18 PM To: Struts Users Mailing List Subject: Re: Map Backed Form I read this somewhere (perhaps Struts in Action) and I use map-backed properties... the methods should have String keys, but Object values eg public Object getElementMap ( String key ) { public void setElementMap ( String key, Object value ) Ray Madigan wrote: I am having some difficulty with my Map Backed Form implementation. I have in my Form: private Properties elementMap = null; public String getElementMap ( String key ) { return ( String ) elementMap.getProperty ( key ); } public void setElementMap ( String key, String value ) { elementMap.put ( key, value ); } public void reset ( ActionMapping mapping, HttpServletRequest request ) { ... elementMap = new Properties ( ); } I have in my JSP: If I enumerate the request parameters in the reset method of the form the paramaters and values look like: name->elementMap(PerPage) value->4 I get the exception java.lang.IllegalAccessError: try to access class org.apache.commons.beanutils.MappedPropertyDescriptor$1 from class org.apache.commons.beanutils.MappedPropertyDescriptor From past experience I get this exception when struts is looking for a setter in my form and can't find it. I think that struts is looking for a method 'setElementMap(perPage)' and has not figured out it is a mapped property for some reason. And I can't write a method with name. Any help would be appreciated. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - 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] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Map Backed Form
I read this somewhere (perhaps Struts in Action) and I use map-backed properties... the methods should have String keys, but Object values eg public Object getElementMap ( String key ) { public void setElementMap ( String key, Object value ) Ray Madigan wrote: I am having some difficulty with my Map Backed Form implementation. I have in my Form: private Properties elementMap = null; public String getElementMap ( String key ) { return ( String ) elementMap.getProperty ( key ); } public void setElementMap ( String key, String value ) { elementMap.put ( key, value ); } public void reset ( ActionMapping mapping, HttpServletRequest request ) { ... elementMap = new Properties ( ); } I have in my JSP: If I enumerate the request parameters in the reset method of the form the paramaters and values look like: name->elementMap(PerPage) value->4 I get the exception java.lang.IllegalAccessError: try to access class org.apache.commons.beanutils.MappedPropertyDescriptor$1 from class org.apache.commons.beanutils.MappedPropertyDescriptor From past experience I get this exception when struts is looking for a setter in my form and can't find it. I think that struts is looking for a method 'setElementMap(perPage)' and has not figured out it is a mapped property for some reason. And I can't write a method with name. Any help would be appreciated. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is it possible to remove *.do or /do/* from the URL
If there are only a small number of 'marketing' style URLs that are going to be used, you could do those mappings specifically in the web.xml and leave everything else to your /do/* mapping Eg Marketing URLs 'activities', 'contact', 'foo' /activities/* /contact/* /foo/* everything else /do/* Or you could wrap a filter around the /activities/*, /contact/*, /foo/* mappings and forward to the correct action. -- Jason Lea Matt Raible wrote: The reason I don't like extension mapping is because I think path-mapping (/do/*) is cleaner. Also, I like using path-mapping b/c then we can add parameters and they look like regular URLs. For example - extension mapping: http://site.com/activities.do?activity=fishing or http://site.com/activities.do?fishing path-mapping: http://site.com/do/activities/fishing And then in our "activities" action, we can do a check (request.getPathInfo()) to see if we should serve up the "fishing" page vs. the general activities one. Thanks to all for your opinions and practices. Matt -Original Message- From: Micael [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 11:33 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: Is it possible to remove *.do or /do/* from the URL I use .Whatever, where that is some marketing term that is acceptable. At 10:39 AM 9/18/2003 -0400, Vic Cekvenich wrote: How about a hack: *.jsp It looks as jsp on top but it's a do. Or you can even say *.asp, or anything. Just pick a word marketing likes. .V Matt Raible wrote: I agree with you - however, it's a marketing thing. The project I'm on has implemented a lot of folder/index.html (with meta-refresh) so that marketing materials have pretty URLs. I was simply hoping to accomplish this without doing anything extra - so http://site.com/do/activities can be put into marketing materials as http://site.com/activities. Maybe we could have marketing use http://site.com/activities/index.html and then use a filter (mapped to *.html) to do a redirect to http://site.com/do/activities. Matt -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 1:26 AM To: Struts Users Mailing List Subject: Re: Is it possible to remove *.do or /do/* from the URL The important principle here is "Web Application != Web Site". If your users feel compelled to use bookmarks and the back button in your webapps, despite efforts to train them correctly, this is a pretty good sign that you have not provided enough suitable navigation controls in your basic UI. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] LEGAL NOTICE This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you - 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: Handling of n number of text boxes at runtime
Madala, Srinivasa wrote: Hi folks, I am having trouble with my JSP page.The jsp is designed in such a way that it can generate n number of text boxes at runtime.So I can't have either ActionForm or DynaActionForm which are predefined based on a list of properties enumerated in either the Form bean or the Struts configuration file and they utilize the properties at the initialization time.I got to collect input values from all these n text boxes when I submit the page.Does anyone have a clue how to handle this in Struts?Can anyone help me?? Thanks in advance, Srinivas You can use a map-backed ActionForm eg public class MyForm extends ActionForm { protected Map map=new HashMap(); public Object getValue(String key) { return map.get(key); } public void setValue(String key, Object value) { map.put(key, value); } } As for the JSP page you need to specify the property values like so: So if you wanted 3 fields called name, description and quantity you would use or create some fields in a loop using JSTL and Struts-EL tags -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Passing variables for logic:iterate
Gregory F. March wrote: On Sep 15, 2003, "Susan Bradeen" <[EMAIL PROTECTED]> wrote: |I think this might be one of those cases where you go through "comment out |parts of your JSP code and try again" iterations to find what is causing |the error. Not very elegant, but it has worked for me. Thanks Susan, that's what I wound up doing. Still not sure what it was (maybe an empty string for one of my iterate properties?). Too bad it doesn't give some form of a stack trace... /greg -- Gregory F. March-=-http://www.gfm.net:81/~march-=-AIM:GfmNet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] You said you have these entries in your form: But the logic:iterate tag offset and length attributes need the following: "This can be either an integer that directly expresses the desired value, or the name of a JSP bean (in any scope) of type java.lang.Integer that defines the desired value." You need to pass it Integer objects or put the actual values into the tag. JSTL might be a better way with the tag. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TreeMap vs html:optionsCollection
I haven't used maps with so I don't know if I can give you a definite answer on this. The optionsCollection tag is expecting a collection of objects that it can call .getLabel() and .getValue() on (by default but it can be changed with parameters). To get a list of objects from a map you normally call object.entrySet which you can then iterate over. The entry set is a set of Map.Entry objects (they have getKey and getValue methods). So it looks like the tag is trying to do a .getLabel() on the Map.Entry object. If the tag does accept maps I would have expected that it knows about Map.Entry objects. I normally use List objects with pull-downs instead, like this: List eventGroups = new ArrayList(); eventGroups.add(new LabelValueBean("Label 1","Value 1")); eventGroups.add(new LabelValueBean("Label 2","Value 2")); eventGroups.add(new LabelValueBean("Label 3","Value 3")); ((EventGroupBean)form).setEventGroups( eventGroups ); Lars Bergström wrote: Dear Struts users, I am trying to get my html:optionsCollection to work with a TreeMap. I don't know if this is possible but on the Struts API page for the class OptionsCollectionTag I read the following: "The collection may be an array of objects, a Collection, an Enumeration, an Iterator, or a Map." ( http://jakarta.apache.org/struts/api/org/apache/struts/taglib/html/Opti onsCollectionTag.html) Since TreeMap implements SortedMap which is a subinterface of Map, TreeMap should work fine, right? However, when the page is loaded I get the folloing error text: "HTTP ERROR: 500 No getter method available for property label for bean under name 1=LabelValueBean[Label 1, Value 1]" Can anyone explain this error message? This seems strange to me. The returntype in my ActionFormBean is TreeMap and the code snippet where I build up the TreeMap is like this: eventGroups = new TreeMap(); eventGroups.put( new String( "1" ), new LabelValueBean( "Label 1", "Value 1" ) ); eventGroups.put( new String( "2" ), new LabelValueBean( "Label 2", "Value 2" ) ); eventGroups.put( new String( "3" ), new LabelValueBean( "Label 3", "Value 3" ) ); ((EventGroupBean)form).setEventGroups( eventGroups ); ( Best regards Lasse -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FRIDAY] YA Stuts In Action Triva Quiz
Ted Husted wrote: The contest will run until Saturday, September 14, 2003, 23:59:59 so everyone has a chance to participate. Just for completness and clarification, which time zone is that? EDT? Perhaps you should say 2003-09-14 23:59:59 -0400 Or is it +? -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Character Encoding
Yann Lebreton wrote: As part of localizing a site, I'm trying to set the content type of the response. Now I now I can do this within the JSP (<%@ page contentType="text/html; charset=UTF-8" %> ). But I'd rather do this globally. I found out that you can set this as a parameter of the controller in struts. This would work fine if the JSP compiler wasn't also setting the content type automatically. So do someone know a container setting to do this ? Is there something like a "pre-compiler" for JSP, that would change/add code to each JSP before giving it to the JSP compiler ? Thanks, Yann I had this problem when I pre-compiled my JSPs (Tomcat 4.1.24). If I don't pre-compile then (from memory) they were encoded correctly. I am using tiles, so the layout page set the encoding to UTF-8, then everything else is included into the layout. This might be why it worked, as the encoding was set on the parent JSP it was probably used when compiling the included pages. When pre-compiling the JSPs each page is compiled separately. In this case I think it used the default Latin encoding. I couldn't find a way to forcethe compiler to use a different encoding other than adding <%@ page contentType="text/html; charset=UTF-8"%> to the top of every JSP page (including it didn't seem to work). -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Character Encoding
Have a look here for an example of what you have to do to get the response encoded correctly: http://www.anassina.com/struts/i18n/i18n.html Yann Lebreton wrote: did you set the character encoding on the request before getting the data to the db ? if you don't the input may be interpreted using the default JVM's encoding. -Original Message- From: José Gustavo Zagato [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 9:53 AM To: 'Struts Users Mailing List' Subject: RE: [OT] Character Encoding Hey Yann Lebreton ! I have the same doubt as you, but for time constraints we decide to use the encode at the JSP. I have some questions about Internationalizations and maybe you / someone else could give me a more clear perspective on this subject... I' am developing a site wich must run under several languages, including Chinese, Thay, and many many others. I build several small applications to prove that the location / I18N works fine on struts for showing messages at the HTML. But My current concern is those input text fields... How Can I handle the user Input ? I will save all entered data in a Oracle database (already prepared to work with Unicode), but during testing every time that I save some data in Unicode format the Database don't understand it. Does anyone here have any hint on this stuff ? Cheers ! José Gustavo Zagato Rosa System Analyst - Atos Origin [EMAIL PROTECTED] -Original Message- From: Yann Lebreton [mailto:[EMAIL PROTECTED] Sent: sexta-feira, 5 de setembro de 2003 13:46 To: [EMAIL PROTECTED] Subject: [OT] Character Encoding As part of localizing a site, I'm trying to set the content type of the response. Now I now I can do this within the JSP (<%@ page contentType="text/html; charset=UTF-8" %> ). But I'd rather do this globally. I found out that you can set this as a parameter of the controller in struts. This would work fine if the JSP compiler wasn't also setting the content type automatically. So do someone know a container setting to do this ? Is there something like a "pre-compiler" for JSP, that would change/add code to each JSP before giving it to the JSP compiler ? Thanks, Yann - 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] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Syntax for accessing an object nested in a List of Lists [SOLVED]
Did you try list[index][index].property? It is too late for me to test (1:34am - going to bed) Robert Taylor wrote: Okay. After looking at PropertyUtils I determined that this sort of syntax is not allowed when accessing an object from an ArrayList of ArrayLists. You have to wrap the child lists in an object which provides some type of accessor/mutator. So in my case I have an ArrayList of ListWrapper objects. Where each ListWrapper contains a List and getList()/setList(). Then the syntax below works - assuming my form bean has the methods getList()/setList(). list[index].list[index].property Kind of a PIA to have to wrap the nested lists. Seems like PropertyUtils would contain logic to recognize this use case but as I look at the source code for getIndexedProperty, the necessary modifications would be none trivial. robert -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2003 5:15 PM To: [EMAIL PROTECTED] Subject: Syntax for accessing an object nested in a List of Lists I've run into some trouble accessing a nested object in my form. The object "lives" in a List of Lists type of structure. I've been using a syntax like the following assuming my List form property is named 'list'. list[index].[index].productId This must be wrong because I get the following exception: No getter method available for property list[0].[0].productId for bean under name org.apache.struts.taglib.html.BEAN' I tried the following just to make sure it could find the 'first level'. list[index] This doesn't cause any exceptions, so I must have the syntax wrong for accessing the 'second level' of the structure. Any help would be appreciated? robert - 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] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is nesting Tile layouts possible?
You could try something like this: Here you have a 'AccountSubSection' definition that overrides the BaseDef's content with your AccountSubSection layout page AccountSubSection.jsp. Now for every account page you want to go to, you just add 1 more definition that extends AccountSubSection. And to add customer service you would need 1 CustomServiceSubSection definition (for layout) eg plus a definition per page Your AccountSubSection.jsp will need to use the tag so you can access the attributes. Rick Reumann wrote: I'm still stumped even working with extending definitions on how to accomplish this. A friend in #struts_users was helping as well and his solution is good, but still seems like a lot of work. I posted the idea below this post... On Wed, 2003-09-03 at 17:31, Rick Reumann wrote: Pardon if this is a real stupid question and has been covered before (I have looked at some of the docs and didn't see this addressed but I've been known to easily miss the obvious:). Imagine you have a site that has a main layout: COMPANY LOGO DATE MAIN MENU {II. main content section} FOOTER I could easily set up a layout definition for the above (BaseDef). However the problem is each of my sub-sections(II. above) in the application could also possibly have different layouts. For example, imagine the user goes to the "Accounting" section and the layout of the accounting section has... ACCOUNTING HEADER LEFT MENU {accounting page content} RIGHT STATIC INFO COLUMN but maybe the Customer Service section is slightly different... CUSTOMER SERVICE HEADER {customer service page content} RIGHT MENU Ok one idea that I got help with would work a bit like this: The above works ok but it requires two definitions for evey page you want to go even though the "AccountSubSection" definition is basically the same with just different accountContent. I've even tried adding "accountContent" as... but that didn't work. There should be a way this could work without having to provide two defintions for every page I'd want to go to? -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: element filter in web.xml causes error
Hi Jiri, Make sure you add the and in the correct order inside web.xml: icon?, display-name?, description?, distributable?, context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?, error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*, login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref* So and needs to come after any but before and entries. Jiri Chaloupka wrote: Hallo, I need to add filter elements into web.xml file for correct encoding of form's data. In web.xml I was changed dtd into http://java.sun.com/dtd/web-app_2_3.dtd and add this: Set Character Encoding org.apache.filters.SetCharacterEncodingFilter encoding UTF-8 Set Character Encoding /* class org.apache.filters.SetCharacterEncodingFilter I have, of course. but, when deploy I got error that "filter" and "filter-mapping" must be declared and if I run this web app, I got exception : org.apache.jasper.JasperException: File "/tags/struts-bean" not found at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:105) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:430) when I disable filter and filter-mapping in web.xml, it runs, but data from forms comming damaged, of course. Where can be problem? Thanks, Jiri - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Remote Debugging facility
Yes, I use it. Version of Java is probably more importent than version of Tomcat. I'm using Tomcat v4.1.24, Java 1.4.2, on Windows 2000. Tomcat is installed as a service. I use these settings: -Xrs -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=,suspend=n Differences: not using -server using -Xrs different port different order for the runjdwp [EMAIL PROTECTED] wrote: Has any one successfully used the "Remote Debugging facility" of ECLIPSE with TOMCAT 4.0.X ? I tried using it but am getting a message that says "Failed to connect to remote VM, Connection refused". Below is how I setup TOMCAT & ECLIPSE for debugging. Added the below statement to CATALINA.bat SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 and started TOMCAT. On the ECLIPSE configuration for Remote debugging I gave Host : localhost Port : 8000 Connection Type : Standard (Socket Attach). Is there anything that I am missing ? Regards Sreekant G This mail was scanned by Interscan Virus Wall of Mailserver2 at SNR, TCS, Chennai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload and Request Parameter
David Stemm wrote: All, I have a form that is doing a file upload and on the confirmation page after the upload I'm trying to get a request parameter using the tag. The tag doesn't seem to find the request param. I know the parameter exists - I can see it in the debugger. The tag looks like this: and I tried this as well . I believe the problem is because the form is setup to use "multipart/form-data". Any ideas on this? Thanks. There is a note in the request.getParameter() JavaDocs that states: "If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via getInputStream() or getReader() can interfere with the execution of this method." You have probably used some package like FileUpload to handle the file. This package would be using the getInputStream() to extract the contents of the uploaded file (this is why you cannot access the parameters normally). This package should also provide some method of accessing any formfields or parameters that were passed. FileUpload package: http://jakarta.apache.org/commons/fileupload (I haven't used this myself) It looks like you could use this in your action to get a list of FileItems (some will be uploaded files which you can save to disk, the others would be form fields). When you find a form field, you could try adding it to the request using request.setAttribute(), which should allow you to access it using . -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP not displaying data when in Edit Mode
I think that form beans default to session scope. But you specified scope="request" in /testPage, so that is where the form bean would be stored. Your /saveTestPage was looking in session scope for the form bean but of course it wasn't stored there. You could leave the scope out of both actions and it should still work. Srinivas Gunturu wrote: I have resolved this issue. But can not explain how it is fixed. :-) Can any of the struts gurus out there shed some light on why this is so? My struts-config.xml By replacing following line with I was able to get my TestForm.jsp display data and get it into edit mode. Though I am only trying to access http://localhost/myapp/testPage.do, I am not sure why NOT HAVING SCOPE in /saveTestPage action made it not to display data given in TestForm. Any ideas? [EMAIL PROTECTED] 08/27/03 02:13PM >>> All, I am trying to get my JSP to display data from my form when in Edit mode. I am new to Struts and using Struts 1.1 I am not sure what I am doing wrong. Any help or pointers at resources would be appreciated. I have included my struts-config, my jsp, my action class and my form class. When I load my jsp, I am expecting to see "Filed1 value from action" in "field1" as defined in the action class. However, I am seeing the default "Test Field1" as defined in the ActionForm class. One thing I noticed is, my form is null in action execute class and I see 'Test Form is null. Creating new one..." in the console. Any idea what I am doing wrong? TIA - Srinivas My JSP: <[EMAIL PROTECTED] language="java" import="mybean.*"%> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> Field 1 : Field 2 : Submit My Form: private String field1; private String field2; public void reset(ActionMapping arg0, HttpServletRequest arg1) { field1 = "Test Field1"; field2 = "Test Field2"; } public String getField1() { return field1; } public String getField2() { return field2; } public void setField1(String field1) { this.field1 = field1; } public void setField2(String field2) { this.field2 = field2; } My Action: public ActionForward execute( ActionMapping aMapping, ActionForm aForm, HttpServletRequest aRequest, HttpServletResponse aResponse) { HttpSession session = aRequest.getSession(); if ( aForm == null ) { System.out.println("Test Form is null. Creating new one..."); aForm = new TestForm(); } TestForm testForm = (TestForm) aForm; testForm.setField1("Filed1 value from action"); testForm.setField2("Field2 value from action"); if ("request".equals(aMapping.getScope())) { aRequest.setAttribute(aMapping.getAttribute(), testForm); } else { session.setAttribute(aMapping.getAttribute(), testForm); } return aMapping.findForward(Constants.SUCCESS); } My struts-config.xml - 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] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction vs Unicode-utf8
Maurice Wijtten wrote: I have a multilangual form handled by a LookupDispatchAction. When we recently added a spanish language, our action throwed an exception because it could not find the corresponding key of the submit button. It seemed that a non asci character was handled as UTF8 and not Unicode. (Instead of 1 character, 2 are posted). I've done my homework but found nothing covering this usue yet. For your information, i have the page encoding set on utf-8 in the jsp. Maurice Wijtten - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The page is probably rendered as UTF-8, but when the servlet reads the request parameters it will assume they are the Latin encoding. You need to set the encoding on the request before the parameters are read by struts. I have a filter that does this: request.setCharacterEncoding("UTF-8"); on every request. Look at 7 here: http://www.anassina.com/struts/i18n/i18n.html -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP not displaying data when in Edit Mode
My struts-config.xml Remove this attribute attribute="testForm" and replace with name="testForm" scope="request" validate="false"> 'name' is the name of the form bean that is created and given to the action form. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Another missing attribute in html-el
Slattery, Tim - BLS wrote: The tag does not have an "accesskey" attribute. I tried adding the attribute to the struts-html-el.tld file, and got this error message: Error in using tag library uri='/WEB-INF/struts-html-el.tld' prefix='html-el': The Tag class 'org.apache.strutsel.taglib.html.ELSelectTag' has no setter method corresponding to TLD declared attribute 'accesskey' -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] You could use the tag which accepts an accesskey and passes the focus onto another form field. Eg My Field ... or else use the for="" option with label: MyField ... Apparently the for="" references matches the id, so we have to add a styleId to the select. Not sure if it would find the name="" field. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] A date utility? anyone, pls help
Butt, Dudley wrote: I know you guys are all excellent java programmers, so I do believe someone has what I'm looking for? I really please need a date utility class that accurately calculates the number of years between 2 dates? Would appreciate it very much thx!! I can think of 2 ways of measuring this. You are either looking for a. an elapsed time in years b. difference of year values As an example using these 2 dates: 31 Dec 2000 and 1 Jan 2001 You would get a difference for (a) 0 years, (b) 1 year. You would calculate (a) by getting the time in milliseconds for each date and subtracting one from the other, the figure out how many years have gone by. (b) is calculated by using the Calendar, extract the year component of each date and subtract one from the other. Here are some useful examples from The Java Developers Almanac 1.4 http://javaalmanac.com/egs/java.util/GetAge.html -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Missing images & style sheet in welcome file
sriram wrote: Hi, In my web application (using struts), I have login.jsp as welcome file. I've defined the welcome file in web.xml as follows: /jsp/login.jsp And in login.jsp, I'm using relative path to load images and style sheet. My directory structure is as follows: ---web | |--css | |--jsp | |--images | |--WEB-INF login.jsp is located in /web/jsp folder. In login.jsp, I'm including style sheet as follows: "../css/style.css" --> the style sheet is located in /web/css folder. Now, when I browse http://localhost:8080/myApp, login.jsp is displayed as welcome page, but the style sheet is not found. Same is the case with images on login.jsp. (this problem is occurring on Linux) But when I use http://localhost:8080/myApp/jsp/login.jsp, then it is displaying everything perfectly. And http://localhost:8080/myApp displays the login page correctly on Windows. Any idea what could be the problem? Sriram The browser makes the request for the images and stylesheet relative to the path it *thinks* the login.jsp is at. In this case it sees the login.jsp page as being: http://localhost:8080/myApp/login.jsp so when it tries to access the stylesheet it is looking for: http://localhost:8080/myApp/../css/style.css which becomes: http://localhost:8080/css/style.css and that doesn't exist. What you can do is use some global forwards in your struts-config.xml such as and in your login.jsp do this: Then the rewrite should put in the path relative to the web application eg it will put in the path '/myApp/css/style.css' You can use the tags for your images. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting a Welcome File + Tiles + PreCompiled JSP's
I use a filter to catch requests that map to "/" and request my Homepage.do action instead. So I don't have any index.html or index.jsp page at all. I think the 2.3 spec wants some sort of file to map to. I did hear of one person who set the to 'index.do' and put a dummy index.do file in there (with a note that it was a dummy and not to delete). The web container was happy because there was a file there called 'index.do'. Since Struts is mapped to process *.do, the person defined an action called 'index' and struts could do its normal processing, forwarding off to the .jsp in /WEB-INF/. I don't know if that is portable amongst containers though. Pat Quinn wrote: I'm using tiles and i know i can't set the attribute in web.xml to a tile definition or a struts action url. I'm also precompiling all my JSP's so i can't assign it to a JSP... i was thinking about assign it to a html file and then onLoad i could redirect to my logon action url... to do this i'd have to hard code the ipaddress and port number into my url so i don't really want to do that. Any ideas how i might do this? _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error message headers and footers?
Jason Long wrote: I am looking for a way to simplify my ApplicationResources.properties file. For example: errors.header=Validation Error errors.footer= error.footageRequired.integer=Footage required must be a positive integer error.chkItems.required=At least 1 item must be selected I basically do not want to put in front of each entry or following them. Is this already possible? If you look at this: http://jakarta.apache.org/struts/userGuide/struts-html.html#messages You can use it like so: Validation Error border="0" /> In your ApplicationResources.properties file you just need: error.footageRequired.integer=Footage required must be a positive integer error.chkItems.required=At least 1 item must be selected Much more tidy :) and we don't need errors.header or errors.footer The tag will iterate over the ActionErrors, so you don't need to put markup in your .properties file. The will mean the table will only be displayed if there are errors. I use the JSTL way of outputting the error message, but you could use I think. Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:choose and html:form
Erez Efrati wrote: Is this legal? Thanks, Erez I think this would cause a problem because the JSP compiler would complain that the tag is not being closed. It would want the tag to be nested at the same level as the opening tag. An option might be to use the html-el tags which should mean you can do something like -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Allowing only POST for form submittal ????
Adam Hardy wrote: Hi Jason, I've heard of Get, Post, Put and Delete, but what are Head, Options and Trave? Oops, should be Trace. as to what they do... Servlet Spec 2.3, 2.1.2 says: The doHead method in HttpServlet is a specialized form of the doGet method that returns only the headers produced by the doGet method. The doOptions method responds with which HTTP methods are supported by the servlet. The doTrace method generates a response containing all instances of the headers sent in the TRACE request. The RFC gives some more details: http://www.ietf.org/rfc/rfc2616.txt -- Jason Lea Jason Lea wrote: Hi Shane, I guess it is so they can have one servlet method per HTTP method The spec includes doGet(), doPost(), doPut(), doDelete(), doHead(), doOptions(), doTrave() HTTP/1.0 has doGet, doPut, doHead. HTTP/1.1 adds the others. - 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: Hindi i18n Iscii Font
Hi Kiran, You need to set the character encoding for the JSP page/response. Java still thinks the response should be in the default encoding which is ISO-8859-4 (I think that is the Latin character set). I use UTF-8 encoding so that I can mix languages eg English/Japanese/French without having to worry about setting the correct page encoding for each page. So I do the same thing for the properties files eg native2ascii -encoding UTF-8 etc etc But at the top of each of my JSP pages I have this: <%@ page contentType="text/html; charset=UTF-8"%> In your case you probably have to change that to charset=ISCII91 if use that encoding. You can put this in your base action so you don't have to include in every page eg response.setContentType("text/html; charset=UTF-8"). [Note: JSP Precompilation: The only problem I had with setting the content type in the action was when precompiling JSP pages. If there this line <%@ page contentType="text/html; charset=UTF-8"%> isn't in the JSP page or page fragment then Jasper would use the default encoding instead of UTF-8.] You will also need to set the character encoding on any request that submits data otherwise it will also be interpretted as ISO-8859-4. I use a filter an all request that just does this: request.setCharacterEncoding("UTF-8"); (again change this to your character encoding ISCII91) This can't be done in an action because form beans are populated before they are given to the action. So you have a choice of using a filter, or overriding the RequestProcessor to do this. Hope this helps. --jason Kiran Kumar.M wrote: Hi, I need some help on I18n in Hindi,I am using Struts 1.1 and need to display fonts in hindi (we use iscii charsets which are 8 bit)... if i give the hindi value directly in my jsp it is working fine but it is not able to read the same from the resource file ... here are the steps i followed first create applicationresources_hi.properties file entered the following prompt.hindi={ÉÚ®úÉ {ÉiÉÉ next converted the file native2ascii -encoding ISCII91 srcfile dest file ... this converts the {ÉÚ®úÉ {ÉiÉÉ to {\u092b\u093e\u090d\u096f\u092b {\u092bi\u092b\u092b (locale set to hi in Action) in my jsp file this does not work (nothing comes browser) when i get the value from resource file although there is no problem with the english fonts in the same file this works (hindi font comes on browser) {ÉÚ®úÉ {ÉiÉÉ Can someone please help me Regards, Kiran - 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: Allowing only POST for form submittal ????
Hi Shane, I guess it is so they can have one servlet method per HTTP method The spec includes doGet(), doPost(), doPut(), doDelete(), doHead(), doOptions(), doTrave() HTTP/1.0 has doGet, doPut, doHead. HTTP/1.1 adds the others. -- Jason Lea Bailey, Shane C. wrote: Jason, That makes since about the user (hacker) recreating the form on POSTing. Why the original separation in the Servlet then, any ideas? I would do the check at the top of the action. It seems more flexible than having to put your form actions in a certain area. Thanks. BTW, SecurityFilter is running smoothly :-) -Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 6:21 PM To: Struts Users Mailing List Subject: Re: Allowing only POST for form submittal Hi Shane, I don't think it really matters. Say you have a hidden field containing an id in your form that is posted back to an action. A user could copy that page to their hard disk, modify the field and then submit it. They would still be POSTing so your action would be happy. You still need to verify the id is ok, or user has permission to access that id. If you had some reason to only allow POSTs then you might be able to check in the action, or I think you can do that with a security contraint in web.xml: allow only POSTs /postonly/*.do GET no-member-role This basically means if someone tries to use GET (eg a normal request to the action) they would have to be a member of the role 'no-member-role'. Since we won't have anyone in this role, nobody can use GET for these actions. All other methods are allowed. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Allowing only POST for form submittal ????
Hi Shane, I don't think it really matters. Say you have a hidden field containing an id in your form that is posted back to an action. A user could copy that page to their hard disk, modify the field and then submit it. They would still be POSTing so your action would be happy. You still need to verify the id is ok, or user has permission to access that id. If you had some reason to only allow POSTs then you might be able to check in the action, or I think you can do that with a security contraint in web.xml: allow only POSTs /postonly/*.do GET no-member-role This basically means if someone tries to use GET (eg a normal request to the action) they would have to be a member of the role 'no-member-role'. Since we won't have anyone in this role, nobody can use GET for these actions. All other methods are allowed. -- Jason Lea Bailey, Shane C. wrote: I have worked with Struts at a few different companies now and I noticed none of them try to do any checks to see that only POST methods can successfully make it to Actions which handle forms submittals. Struts allows GETs and POSTs to make it to every Action so it seems like this would be something to think about (or maybe not, that is one reason I am asking). So I guess I have a few questions then: 1. Shouldn't I worry about (and defend against) which request methods types (GET, POST, etc.) can make it to which actions? 2. If so, does Struts have a built in mechanism like path="/whatever" requestMethod="POST"> or if not 3. Should I be doing something like this at the top of my execute() method: if( ! "POST" == request.getMethod() ){ return mapping.findForward("failure"); } for Actions which should require a POST only With #1 I mean should it matter if someone can go to the URL field in the browser and type in all the field / value pairs for a form and hit enter (I am thinking it does matter) compared to HAVING to do a POST for it to succeed? I am just thinking back to the Servlet programming days when you put the form submittal handling code in the doPost() and the other code in the doGet() methods. Any thoughts on this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Is "jsessionid" specific to Tomcat or generic to all webcontainers?
Matthias Bauer wrote: Craig, all this sentence says is that the session id must be encoded as a path parameter. But it does not say anything about the name, the implementing server is supposed to use. Is there some other place in the spec where it says that the parameter must be called "jsessionid"? If not, I would say the server implementation is free to choose any name. Am I overlooking something? Perhaps you overlooked looking at the spec itself :) Servlet Spec 2.3 SRV.7.1.3 URL Rewriting URL rewriting is the lowest common denominator of session tracking. When a client will not accept a cookie, URL rewriting may be used by the server as the basis for session tracking. URL rewriting involves adding data, a session id, to the URL path that is interpreted by the container to associate the request with a session. The session id must be encoded as a path parameter in the URL string. The name of the parameter must be jsessionid. Here is an example of a URL containing encoded path information: http://www.myserver.com/catalog/index.html;jsessionid=1234 --- Matthias The URL rewriting format is also standardized; in section 7.1.3 you will see the sentence: The session id must be encoded as a path parameter in the URL string. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: pleeeez
In your struts-config.xml you will need something like this Struts would then look for /WEB-INF/classes/ApplicationResources.properties For example I use this instead: so that struts looks for /WEB-INF/classes/resources/application.properties --jason Monang Setyawan wrote: Sorry if bother u, but I'm SURE that i've put it in web.xml. But I've never read that ApplicationResource.properties must be specified in struts-config.xml here my web.xml: http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";> action org.apache.struts.action.ActionServlet application naker.web.ApplicationResources config /WEB-INF/struts-config.xml debug 2 detail 2 validate true 0 action *.do index.jsp /WEB-INF/nakerapp.tld /WEB-INF/nakerapp.tld /WEB-INF/struts-bean.tld /WEB-INF/struts-bean.tld /WEB-INF/struts-html.tld /WEB-INF/struts-html.tld /WEB-INF/struts-logic.tld /WEB-INF/struts-logic.tld On Wed, 23 Jul 2003, Jimmy Emmanual wrote: make sure your custom tag is defined in web.xml and the ApplicationResource.properties file is defined in struts-config.xml - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction problem
Tim Clotworthy wrote: This is really a simple aside, but is there a way to have the text (label) of the button appear different that the value of the submit, and if so, how does one do it? Thanks. Yes and no. The HTML 4.0.1 standard allows you to specify a tag which does this but IE doesn't support it properly. Mozilla supports it correctly though. I have only checked with IE6 and Mozilla 1.3/1.4. The button tag can even include different styles and images on the button eg this is a button, click me Problems I found with IE's support of the button tag: 1. The default type should be 'submit' from the standard, but IE treats it as 'button' so it doesn't cause the form to submit. Fixed by adding the type="submit" to the tag 2. (the problem that stops me using it) If you have more than 1 button tag in your form all the button values will be included when the form submits - which makes it useless. Eg if i have the following buttons: update me delete me I click the 'update me' button, IE will submit the following values method=update&method=delete, when it should only send method=update. check out the spec here: http://www.w3.org/TR/html401/interact/forms.html#edef-BUTTON --Jason Lea -Original Message- From: Tim Clotworthy [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 5:07 PM To: 'Struts Users Mailing List' Subject: RE: LookupDispatchAction problem Thanks for all help. It is fixed now. God bless you, one and all. -Original Message- From: Suzette Daniel [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 5:01 PM To: 'Struts Users Mailing List' Subject: RE: LookupDispatchAction problem No prob, here you go: ERROR: Application resources not loaded -- check servlet container logs for error messages. Suzette -Original Message- From: Tim Clotworthy [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 5:00 PM To: 'Struts Users Mailing List' Subject: RE: LookupDispatchAction problem Thanks, but I switch it to method, and same error occurs. Again, I wonder if my problem is related to my resource bundle, not being able to find it, etc. How can I simply diagnose that the tag key="button.add" /> is being processed properly by the ActionServlet (value being found, etc.). thanks. Sorry for this going on-and-on. Who knew... -Original Message- From: Suzette Daniel [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 4:43 PM To: 'Struts Users Mailing List' Subject: RE: LookupDispatchAction problem I received the same error, so I switched to using my own property "method" and if fixed that error. JSP: Struts-config: .. Suzette -Original Message- From: Tim Clotworthy [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 4:40 PM To: 'Struts Users Mailing List' Subject: RE: LookupDispatchAction problem Thanks to all earnest responses. I still have a problem, but it has evolved a little. I have simplified the syntax (using husted tip 003), so that my jsp has: (as he suggested, using the default name of submit that corresponds to the tag, and in my struts-config, I now have: type="com.hotapp.fes.presentation.support.action.FESSupportOrgDispatchAc tion" name="SupportOrgForm" parameter="submit"> and in my action I have: protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("button.selectOrgs", "selectOrgs"); return map; } But alas, I am still getting an error (below). I wonder if my resource bundled is not being read properly, because the button on the form appears with the tag syntax "something is wrong), rather than the value from the properties file. How can I check that the property button.selectOrgs is being found in the resource bundle, or, for that matter, that the resource bundle is being found at all? Thanks so much to all. javax.servlet.ServletException: Request[/SupportOrgDispatchAction] does not contain handler parameter named submit at org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAct ion.java:199) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr ocessor.java:480) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt e
Re: Refreshing Issue.
Hi Anurag, Sounds like that when you reset the parameters are being resent, so the action 'add' action is being called again. Struts has a way of dealing with this situation with a token stored in the submit form, here is a link to an earlier thread: http://www.mail-archive.com/[EMAIL PROTECTED]/msg68432.html Apparently there is an example of its use in struts-example.war -- Jason Lea Anurag Garg wrote: Hi All, I am facing a problem in jsp page refreshing. After submitting the page to add a new record in the database, I again display the same page with the added record in the list. Now If I press F5 (I am not clicking the ADD button) it again adds a new record(duplicate record) in the database, which it should not do. I have added the following line in my Action Class response.setHeader("pragma","no-cache"); I have also added the following statement in the struts-config.xml But still it is adding the duplicate record in the database when i press F5. Any solution how to overcome this problem.. Thanks and Regards, Anurag Garg - 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: Location of JSP Pages
[EMAIL PROTECTED] wrote: Hi, For security reasons (forbid direct access to JSP Pages), I've localized my JSP Pages under WEB-INF. Each page is fronted with a Struts Action. I encounter since JSP compilation problems : "org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: -1 in the jsp file: null Generated servlet error: [javac] Compiling 1 source file M: \wsad\VINCENT_view_tomcatservices\WebServicesNet\work\org\apache\jsp\WEB-INF\pages\accueil_jsp.java:1: ';' expected package org.apache.jsp.WEB-INF.pages; 1 error " '-' char (from WEB-INF) seems not to be valid for package name ... I use Tomcat 4.1.12 Is it possible to protect JSP Pages from direct access ? What is the best practice for that ? Yes, but it looks like you have put them in the wrong place. Your web app should look something like this: /../webapp /WEB-INF /classes (your java classes get compiled into here) /lib (your jar files go here) /struts-config.xml /web.xml (your index.html and other plain files can go here, images directory) I created a 'jsp' directory under WEB-INF and put my directory structure of jsps there eg /../webapp /WEB-INF /classes /lib /jsp /layout /layout.jsp /tiles /tile1.jsp /tile2.jsp Hope that helps... -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: doesn't get rendered
Hi Bob, Use this in the JSP: and ApplicationResources.properties: books.publisher.heading=/logos/PublishersEnglish.jpg --jason [EMAIL PROTECTED] wrote: Hi All, Maybe someone has done this before : I am trying to use to deliver a in my JSP, however, the tag doesn't get rendered when it is delivered. Instead, the raw tag, , is delivered. Am I missing anything here? Any suggestions please. Thank you. Bob. A snippet from my ApplicationResources.properties file : . . books.publisher.heading= . . A snippet from my JSP : . . . . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: My LogonView.jsp Displays A Blank Page
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> : : --- __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: site root going straight to a .do
I have used a filter instead of specifying a welcome file: WelcomeFilter / This mapping works under Tomcat 4.1.24. My WelcomeFilter then forwards to my Homepage.do action. I did this because I wanted to hide all of my .jsp files under /WEB-INF and compile them before deployment. Compiling the *.jsp files essentially turns them into servlets with mappings in the web.xml so the wouldn't work in this situation. --jason K.C. Baltz wrote: My understanding is that the webapp spec requires that files in the welcome-file-list be actual files, not servlets, because it has to test for their existence to decide which welcome file to use. So, "/index.do" won't work. K.C. Affan Qureshi wrote: Have you tried configuring the in web.xml. I guess you can do all this there. Affan "Simon Kelly" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi all, Sorry about the subject line, it's the best I can do in one sentance. What I'm trying to do, is set up the wecome file, so that instead of having to go via a html or jsp page, I can go straight to an action class! Any ideas? If someone types in htt://our.site.com/ourapp then it should go straight to the welcome.do Action and not a html file. I'm using struts1.1 and stxx. Cheers Simon "I have often wondered how it is that every man loves himself more than all the rest of men, but yet sets less value on his own opinion of himself than on the opinion of others." -- Georg Christoph Lichtenberg Institut fuer Prozessdatenverarbeitung und Elektronik, Forschungszentrum Karlsruhe GmbH, Postfach 3640, D-76021 Karlsruhe, Germany. Tel: (+49)/7247 82-4042 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] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL- el - nested beans from a map used in a form?
Hi Rick, Rick Reumann wrote: On Sat, 2003-06-28 at 19:00, Jason Lea wrote: Here are some ideas, I haven't tested them so they could be horribly wrong :) The html-el:text tag are just like the html:text tag, but I can evaluate EL expressions. What you want to generate is something like this: someCode: because when this is submitted Struts will do something like: formBean.getFooMap().get("aCode").setSomeCode("a new value") Thanks Jason. I'll have to try some of this. The problem with the above though is what do i substitute in for "aCode" that represents "key". The keys can be different obviously as the iterations take place. So then looking at the html:text tag documentation we see for 'property': "Name of this input field, and the name of the corresponding bean property if value is not specified. The corresponding bean property (if any) must be of type String." This means the value of 'property' will be the name of the text input field - this is the bit we want to become name="fooMap['aCode'].someCode". The other importent part is the 'indexed' property: "Valid only inside of logic:iterate tag. Actually this seemed to also work within the JSTL foreach loop. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag." You are using JSTL and have not created a logic:iterate tag so the index isn't going to be generated for you. You could switch to using logic:iterate and I think the tags figure out what to call themselves eg someCode: I tried the above but it complained that it couldn't find my map (fooMap in the above example). Are you using the html:form tag? All of these tags should be inside one so they know what formBean to use. or use the tags, which would be something like: someCode: If you want to use JSTL, you probably have to generate the property name yourself: someCode: someDescrip: With the above I end up with the error: org.apache.jasper.JasperException: An error occurred while evaluating custom action attribute "property" with value "departments['${beanInMap.deptCode}'].deptCode": Unable to find a value for "deptCode" in object of class "java.util.HashMap$Entry" using operator "." (null) Ahh, yes. That now triggers something I read a while ago. When JSTL gets something out of a map it will be of the type java.util.Map.Entry so perhaps try Code: Name: You will have to use the to evaluate the ${beanInMap.key} (at least I hope it tries to evaluate it that way). If you use then it will just treat it as text, essentially looking up the departments map with '${beanInMap.key}' instead of the actual key. the syntax looks like: Code: Name: I've tried all kinds of other combos also and still stumped. Thanks for the help so far. Rick Reumann wrote: Ok this has me stumped... the down and dirty: formBean has HashMap called fooMap fooMap has keys that bring back beans of type BarBean BarBean has properties someCode , someDescrip Now I want to iterate over this map and create the properties based on the properties in BarBean and be able to update this form which will then update the underlying BarBeans in the map. (Ignore the part that I know that's a hassle about the reset method and making sure Map exist there). someCode: someDescrip: the text will display fine in the form with: someCode: but when the form submits all the bean property values are null ( in the reset if it matters for testing i'm just creating a few maps with empty BarBeans in the map). I'm stumped.. any help much appreciated. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL- el - nested beans from a map used in a form?
Hi Rick, Here are some ideas, I haven't tested them so they could be horribly wrong :) The html-el:text tag are just like the html:text tag, but I can evaluate EL expressions. What you want to generate is something like this: someCode: because when this is submitted Struts will do something like: formBean.getFooMap().get("aCode").setSomeCode("a new value") So then looking at the html:text tag documentation we see for 'property': "Name of this input field, and the name of the corresponding bean property if value is not specified. The corresponding bean property (if any) must be of type String." This means the value of 'property' will be the name of the text input field - this is the bit we want to become name="fooMap['aCode'].someCode". The other importent part is the 'indexed' property: "Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag." You are using JSTL and have not created a logic:iterate tag so the index isn't going to be generated for you. You could switch to using logic:iterate and I think the tags figure out what to call themselves eg someCode: or use the tags, which would be something like: someCode: If you want to use JSTL, you probably have to generate the property name yourself: someCode: someDescrip: Rick Reumann wrote: Ok this has me stumped... the down and dirty: formBean has HashMap called fooMap fooMap has keys that bring back beans of type BarBean BarBean has properties someCode , someDescrip Now I want to iterate over this map and create the properties based on the properties in BarBean and be able to update this form which will then update the underlying BarBeans in the map. (Ignore the part that I know that's a hassle about the reset method and making sure Map exist there). someCode: someDescrip: the text will display fine in the form with: someCode: but when the form submits all the bean property values are null ( in the reset if it matters for testing i'm just creating a few maps with empty BarBeans in the map). I'm stumped.. any help much appreciated. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] SecurityFilter Question was RE: Looking for ideas for action servlet checking for logged in user.
What do you mean "So why another realm?"? Are you asking: 1. Do you have to define more than 1 realm? No. If you are using security-filter you would put the realm definition in security-filter.xml and nowhere else. This means you won't be tied to a specific web container's realm. 2. Is it possible to define more than 1 realm? Sort of. Tomcat allows you to create Realms that affect different scopes. You can define these in , , or with each scope overriding the one above so that a web app will only see 1 realm. Not sure what happens if you create a Tomcat Realm and also define a realm in security-filter.xml. 3. Something else? If you are using secutiry-filter with Catalina JDBC Realm look at this forum discussion which gives an example of how to use it... http://sourceforge.net/forum/forum.php?thread_id=834123&forum_id=200424 Bailey, Shane C. wrote: OK, fair enough. I'm just trying to fill in the pieces of a subject I am not very familiar with... Even if you have two datastores (one with user info and one with everything else) it seems like the only realm that matters is the one storing the auth info since the container needs to know about that realm. The other datastore (and the data in it) your data access code will handle all that and it will know from say a properties file or something where/how to connect. So why another realm? -Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2003 5:56 PM To: Struts Users Mailing List Subject: Re: [OT] SecurityFilter Question was RE: Looking for ideas for action servlet checking for logged in user. Hi Shane, Not sure if I undestand your question (so I will make some random statements and see if one hits the spot :) ) I guess reading this would help: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html But basically, you might decide to store your usernames/passwords/roles in a database separate from your application datastore. In this case you will have one connection to your application datastore and the JDBC realm will have a different connection to a different database. Of course they might be in the same database. Or you might have your username/passwords/roles list stored in an LDAP server (using the JNDI realm to access it). Tomcat can also store them in an XML file (Memory realm). You might come across a situation where these usernames/passwords/roles are provided by some other source in which case you can write your own Realm implementation to access it. This doesn't mean each user has to log into the database under their own username/password (though you could if you want). In my situation my application has a username/password that connects to the database. When a user makes a request of one of my Struts Actions I can check their role to see if I will perform the operation on the database. The changes are still made under my application's database connection. Hope this answers your question... --jason Bailey, Shane C. wrote: Thanks for the response. For my lack of knowledge, I understand the concept of realm but why is there a separate JDBC realm? Is this so you can have each user have a login to the database (essentially) instead of everyone using the same DB login to do datastore transactions? -----Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 5:56 PM To: Struts Users Mailing List Subject: Re: [OT] SecurityFilter Question was RE: Looking for ideas for action servlet checking for logged in user. Hi Shane, Looks fine to me :) I also had a similar thought in the beginning to create my own Principal object so I could store all sorts of app specific info when the user authenticates. It seemed to make sense until I started trying to write my own. There are also some disadvantages as you can't easily switch realms eg switch to use Tomcat's JNDI Realm instead of JDBC Realm. In each case I would have to write my own implementation so MyPrincipal object was returned. In the end it was a lot of work and I came up with a better solution: I use the standard Tomcat JDBC/JNDI Realms for authentication, so this is very portable. Then your application just has to figure out when a user has logged in for the first time. When user authenticates use a filter or have all of your actions extend a BaseAction that checks for the login and puts the extra info into a User object and store that in a session scope. The standard realm only accesses the database when you authenticate and it collects the list of roles and populates the GenericPrincipal. So it is quite efficient in that manner. I hope this will be portable across web containers - I just have to plug in a new Realm from the other container. --jason Bailey, Shane C. wrote: So I am real close to moving to the securityfilter (I've been reading the docs, etc
Re: [OT] SecurityFilter Question was RE: Looking for ideas for action servlet checking for logged in user.
Hi Shane, Not sure if I undestand your question (so I will make some random statements and see if one hits the spot :) ) I guess reading this would help: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html But basically, you might decide to store your usernames/passwords/roles in a database separate from your application datastore. In this case you will have one connection to your application datastore and the JDBC realm will have a different connection to a different database. Of course they might be in the same database. Or you might have your username/passwords/roles list stored in an LDAP server (using the JNDI realm to access it). Tomcat can also store them in an XML file (Memory realm). You might come across a situation where these usernames/passwords/roles are provided by some other source in which case you can write your own Realm implementation to access it. This doesn't mean each user has to log into the database under their own username/password (though you could if you want). In my situation my application has a username/password that connects to the database. When a user makes a request of one of my Struts Actions I can check their role to see if I will perform the operation on the database. The changes are still made under my application's database connection. Hope this answers your question... --jason Bailey, Shane C. wrote: Thanks for the response. For my lack of knowledge, I understand the concept of realm but why is there a separate JDBC realm? Is this so you can have each user have a login to the database (essentially) instead of everyone using the same DB login to do datastore transactions? -Original Message----- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 5:56 PM To: Struts Users Mailing List Subject: Re: [OT] SecurityFilter Question was RE: Looking for ideas for action servlet checking for logged in user. Hi Shane, Looks fine to me :) I also had a similar thought in the beginning to create my own Principal object so I could store all sorts of app specific info when the user authenticates. It seemed to make sense until I started trying to write my own. There are also some disadvantages as you can't easily switch realms eg switch to use Tomcat's JNDI Realm instead of JDBC Realm. In each case I would have to write my own implementation so MyPrincipal object was returned. In the end it was a lot of work and I came up with a better solution: I use the standard Tomcat JDBC/JNDI Realms for authentication, so this is very portable. Then your application just has to figure out when a user has logged in for the first time. When user authenticates use a filter or have all of your actions extend a BaseAction that checks for the login and puts the extra info into a User object and store that in a session scope. The standard realm only accesses the database when you authenticate and it collects the list of roles and populates the GenericPrincipal. So it is quite efficient in that manner. I hope this will be portable across web containers - I just have to plug in a new Realm from the other container. --jason Bailey, Shane C. wrote: So I am real close to moving to the securityfilter (I've been reading the docs, etc.) a question I have then is in order to implement the SecurityRealmInterface.isUserInRole(Principal principal, String rolename); method I would like to not go to the DB (inside the method) everytime it is called so is this so bad to do: class MySecurityRealm extends SecurityRealmInterface { public boolean isUserInRole(Principal principal, String rolename) { //Since java.security.Principal doesn't have the methods I want... MyPrincipal p = (MyPrincipal)principal; //This next method is only in MyPrincipal and not Principal interface List roles = p.getRoles(); //do the role test here //return true or false here } public Principal authenticate(String username, String password) { //Do username and password test if(successful) { MyPrincipal p = new MyPrincipal(); p.setName(username); //Get list of roles for the user from DB p.addRoles(...); return p; } return null; } } -----Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 5:34 AM To: Struts Users Mailing List Subject: Re: Looking for ideas for action servlet checking for logged in user. In case no one has mentioned it yet: http://securityfilter.sourceforge.net/ This emulates the container managed security but uses filters. You can define the security contraints in security-filter.xml (looks similar in structure to web.xml) eg Administrator-only Area /admin/* admin You can even use the Tomcat's JDBC Realm with it. This means yo
Re: [OT] SecurityFilter Question was RE: Looking for ideas for action servlet checking for logged in user.
Hi Shane, Looks fine to me :) I also had a similar thought in the beginning to create my own Principal object so I could store all sorts of app specific info when the user authenticates. It seemed to make sense until I started trying to write my own. There are also some disadvantages as you can't easily switch realms eg switch to use Tomcat's JNDI Realm instead of JDBC Realm. In each case I would have to write my own implementation so MyPrincipal object was returned. In the end it was a lot of work and I came up with a better solution: I use the standard Tomcat JDBC/JNDI Realms for authentication, so this is very portable. Then your application just has to figure out when a user has logged in for the first time. When user authenticates use a filter or have all of your actions extend a BaseAction that checks for the login and puts the extra info into a User object and store that in a session scope. The standard realm only accesses the database when you authenticate and it collects the list of roles and populates the GenericPrincipal. So it is quite efficient in that manner. I hope this will be portable across web containers - I just have to plug in a new Realm from the other container. --jason Bailey, Shane C. wrote: So I am real close to moving to the securityfilter (I've been reading the docs, etc.) a question I have then is in order to implement the SecurityRealmInterface.isUserInRole(Principal principal, String rolename); method I would like to not go to the DB (inside the method) everytime it is called so is this so bad to do: class MySecurityRealm extends SecurityRealmInterface { public boolean isUserInRole(Principal principal, String rolename) { //Since java.security.Principal doesn't have the methods I want... MyPrincipal p = (MyPrincipal)principal; //This next method is only in MyPrincipal and not Principal interface List roles = p.getRoles(); //do the role test here //return true or false here } public Principal authenticate(String username, String password) { //Do username and password test if(successful) { MyPrincipal p = new MyPrincipal(); p.setName(username); //Get list of roles for the user from DB p.addRoles(...); return p; } return null; } } -Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 5:34 AM To: Struts Users Mailing List Subject: Re: Looking for ideas for action servlet checking for logged in user. In case no one has mentioned it yet: http://securityfilter.sourceforge.net/ This emulates the container managed security but uses filters. You can define the security contraints in security-filter.xml (looks similar in structure to web.xml) eg Administrator-only Area /admin/* admin You can even use the Tomcat's JDBC Realm with it. This means you can use the request.isUserInRole() and you can define access to Struts actions by role eg: Or display tiles if they have the right role eg The other problem you normally encounter is creating a few objects that you want in your session after a user logs in eg get user's name, email, phone number etc throw it into a User object and store it in the session so you can refer to it later. There are a couple of choices... 1. Create a BaseAction class that all of your other Actions extend 2. Use a Filter The process is the same for each: a. Check to see if request.getUserPrincipal() is not null. If null, the user has not been authenticated b. If the user has been authenticated check to see if you have defined a session variable eg session.getAttribute("USER_LOGGED_IN") c. If it hasn't been defined, then this is a newly logged in user and you can do your initialisation stuff, record the login etc and store something in our session variable session.setAttribute("USER_LOGGED_IN", Obj) If you want to log the user out you can use session.invalidate() --jason Adam Hardy wrote: The drawback to using filters compared to security constraints is that you would have to roll your own login mechanism - which seems unnecessary when you could use the container's authentication method. Did you mention having to change Tomcat to get it to use your JDBC realm? I'm not sure quite what you mean, but yes I suppose if you have a complex realm module and you're not going to use container-managed security, I guess filters or constraints would be just as good. Adam Michael Remijan wrote: Filters have mapping patterns just like servlets have mapping patters (take a look at the web.xml DTD). So like you say servlet "Foo" is mapped to *.foo or /foo/* you can map a filter to urls as well. So if you have a directory in your webapp named "secure"
Re: LookupDispatchAction question part2
Hi Frances, Frances Aleah Z. de Guzman wrote: im sorry but im having the same exception What does your tag look like? What was the HTML output it produced? What do you have in your getKeyMethodMap()? What are the matching entries in your application.properties file? If you post those things I might be able to help better... --jason On Thursday 26 June 2003 05:01 pm, Jason Lea wrote: Frances Aleah Z. de Guzman wrote: i had posted a question i think 3 days ago about submitting a form to a LookupDispatchAction without hitting any button and still having a default value of the parameter handler. someone advised me (im sorry i forgot your name) that i should have a hidden property of my parameter name, so that eventhough i hit the enter button the submitted form will go to the method of the action corresponding to the default value of the parameter i specified. and it worked! but i have the same problem again with a little twistin my jsp i have a display of collection in a tabular form, and each record has a link going to an lookupdispatchaction that will edit its contents. i used , but everytime i click this link im having the same exception as before "Request[/holiday] does not contain handler parameter named action". i put a hidden property of action eventhough i know that wont work coz link doesnt submit the form. how will i solve this? You should be able to add the dispatch name to the action in the link tag: I don't think you need the '.do' on the action either (the tag can match the correct action without it) so this should work: Of course you might have trouble with this sort of link because the LookupDispatchAction will try to match the action parameter's value with a localised key. I define two keys for each method eg protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("global.action.internal.list", "list"); map.put("global.action.internal.edit", "edit"); map.put("button.list", "list"); map.put("button.edit", "edit"); return map; } The global.action.internal.* keys are only defined in my application.properties file so I can create standard links like the one above. The button.* keys are defined application.properties and also the other locales (eg application_ja.properties) so my buttons can show the localised name and still call the correct method. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Looking for ideas for action servlet checking for logged in user.
ession. The action tracking has a lot other responsibilities. hth Adam Jing Jing Zhou wrote: - Original Message - From: "Larry Zappeterrini" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Tuesday, June 24, 2003 4:13 PM Subject: RE: Looking for ideas for action servlet checking for logged in user. Check out http://marc.theaimsgroup.com/?t=10445485033&r=1&w=2 for a possible solution. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 24, 2003 4:59 PM To: [EMAIL PROTECTED] Subject: Looking for ideas for action servlet checking for logged in user. I have a webapp which have several pages which require the user to be logged in(have a httpSession with a "usercontainer" object stored) , and a few pages that doesn't require a log in(the log-in page, references, indexes...). All pages are fronted by actions. My current solution is to check for valid login in every action class that needs to protect its invocation. That seems tedious. I though about extending the action servlet to do it, but then it would check for all requests. And I do want to distinguish between if the user is authorized(isUSerInRole) and if he/she is even logged in, so I can't use the role parameter in the action element. My next idea is extending the action servlet pluss adding parameters that can go into the action element in the struts-config.xml file. (some thing like usersession="true"> ) This would require my action servlet to know about my userContainer stored in the httpsession. Pluss modifying the struts-config file. I haven't looked into how hard this is, figure I'd ask someone who's run into this before. Any other good approaches, or should I just stick with what I got?(check individually in every action) Yes. So far so good. One possible improvement is that you put all of the checking codes into a base class of your action classes. Then you extend the action mapping to provide additional attributes that allow the checking codes to configure themselves dynamically for the corresponding actions, e.g. the usersession attribute. thanks, Henrik Bentel Jing - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *** This electronic mail transmission contains confidential and/or privileged information intended only for the person(s) named. Any use, distribution, copying or disclosure by another person is strictly prohibited. *** - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction question part2
Frances Aleah Z. de Guzman wrote: i had posted a question i think 3 days ago about submitting a form to a LookupDispatchAction without hitting any button and still having a default value of the parameter handler. someone advised me (im sorry i forgot your name) that i should have a hidden property of my parameter name, so that eventhough i hit the enter button the submitted form will go to the method of the action corresponding to the default value of the parameter i specified. and it worked! but i have the same problem again with a little twistin my jsp i have a display of collection in a tabular form, and each record has a link going to an lookupdispatchaction that will edit its contents. i used , but everytime i click this link im having the same exception as before "Request[/holiday] does not contain handler parameter named action". i put a hidden property of action eventhough i know that wont work coz link doesnt submit the form. how will i solve this? You should be able to add the dispatch name to the action in the link tag: I don't think you need the '.do' on the action either (the tag can match the correct action without it) so this should work: Of course you might have trouble with this sort of link because the LookupDispatchAction will try to match the action parameter's value with a localised key. I define two keys for each method eg protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("global.action.internal.list", "list"); map.put("global.action.internal.edit", "edit"); map.put("button.list", "list"); map.put("button.edit", "edit"); return map; } The global.action.internal.* keys are only defined in my application.properties file so I can create standard links like the one above. The button.* keys are defined application.properties and also the other locales (eg application_ja.properties) so my buttons can show the localised name and still call the correct method. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A question on Tiles and Frames
If you want to use frames then each frame is going to issue it's own request. If you want to hide the JSPs under WEB-INF, then you have to front each request with an action because you can't link to the JSP directly. It probably means replacing your definition with: and adding an action mapping to struts-config.xml for each of the items: and then another definition in tiles-def.xml: Have to repeat that for code, menu, button, text. So then if a real action wanted to change both code and menu frames, you can create a definition that extends the first definition: I'm not sure if this will work - as it is 2am here and I am about to go to bed :) But it looks ok to my half-closed eyes Jeff Kyser wrote: Hello, I was trying to use a Tile Definition like: with a framesetLayout.jsp that looks like: " name="heading" scrolling="NO" noresize> " name="code"> " name="menu"> " name="button" noresize/> " name="text" noresize/> but I get Forbidden errors, presumably because my JSPs are beneath the WEB-INF directory and therefore not accessible. Is there an alternate way to do this and still have my JSPs underneath WEB-INF? (Basically, I have a frames-based layout with a scrollable panel, and am trying to figure out how to best implement that feature using Struts/Tiles without exposing all my JSPs. TIA, -jeff --------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles question
Mykola Ostapchuk wrote: I have request.setAttribute("userList", userListBean); string in execute() method. My Action class works well without tiles - it returns a bean to users.jsp and I see the users list. I'm wandering if I'm using DoFirst action forward class in a right way? Maybe because of this "additional" forwarding all the objects in request disappear? The definitions and forwarding look correct, but the DoFirst.java code you posted only had a perform() method, and no execute() method. And the code you posted for DoFirst.java doesn't add the bean to the request. When you access /usersAdm.do, Struts will match that request to the path "/userAdm" in struts-config.xml. Struts will then call the perform() or execute() method of com.name.wos.struts.common.DoFirst. From the code you posted, DoFirst.java will just return a forward called "success". Struts will then match that to the path "usersPage", which matches the tiles definition "usersPage" in tiles-def.xml. Nowhere in that process was a bean added to the request. You must have a different class file which does that somewhere. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles question
Hi, The action DoFirst.java isn't putting the userList bean into the request. It should be doing something like request.setAttribute("userList", userListBean); It is also using the 'perform()' method, if you are using the latest struts then you should be using the 'execute()' method instead. -- Jason Lea Mykola Ostapchuk wrote: Hello, I'm new to tiles and can't make it work. I'm trying to display users list (body - users.jsp) and get an error: [ServletException in:/users.jsp] Cannot find bean usersList in scope request' . I'm populating 'usersList' bean and put it into request in my Action class. It displays header and footer well, but not the body. The link I'm calling: /usersAdm.do tiles-defs.xml: layout.jsp: <[EMAIL PROTECTED] contentType="text/html"%> struts-config.xml: DoFirst.java: import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; public class DoFirst extends Action { public ActionForward perform( ActionMapping aMapping, ActionForm aForm, HttpServletRequest aRequest, HttpServletResponse aResponse) { return aMapping.findForward("success"); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n, passing variable into arg0 using bean:message
Tin Pham wrote: Hi, Individually these all work deleteBusiness.confirm.p1 = Confirm company {0} is correct. Instead of using a literal of esso we want to use the value taken from our formBean, deleteOganizationForm. We have tried various combinations. Can somebody please provide an example? You are unable to use a bean inside the arg0="" parameter (as you have no doubt found out). You probably have 2 choices here: 1. Use JSTL (preferred) You would have to use the struts-el tags in the contrib directory It should look something like this 2. Use Scriptlets -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources).
The wrong commons logging jar was included in RC2. Mentioned in a previous message (subject Re: commons-logging problem in 1.1 RC2) which clarifies the situation: My apologies. Commons Logging now comes as two separate jars, and I bundled the wrong one. I've fixed the problem on the main Apache site. It'll take a little while to propagate to the mirrors, so if you want to download it right away, you probably want to go to the main site. -- Martin Cooper Richard Raquepo wrote: we have the same problem - Original Message - From: "Bjorn T Johansen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, June 10, 2003 12:15 PM Subject: log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). I just upgraded to rc2 and I suddenly get this error message, any idea why? I have downloaded the latest rc2 with the commons-logging lib fix (at least the jar fil is about 31K..) It worked under rc1 and I haven't changed anything... Regards, BTJ -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles Internationalization with Definitions
Ed Smith wrote: I want to internationalize definitions in Tiles. Consider the following definitions in a tiles configuation file: I would like to internationalize the title values. I know I can create a tiles configuration file for each language; however, these files would mostly be duplicates of one another with only the titles changed so maintenance would be difficult. What's the best way to solve this? Is there some way to make something like the following work? /> You obviously cannot put the tag in the tiles-defs.xml. You can probably do it this way: tiles-defs.xml: header.jsp: application.properties: index.title=Index otherpage.title=Other Page -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: accesskey attribute of not working
Vijay Pawar wrote: Hi all, I am using the following code to make a html button. As per the struts-html taglib guide, accesskey attribute is used to specify a keyboard character to immediately move focus to this element. I have only one button in my form. Can anyone tell me where is the problem. Vijay You have to use Alt-a to activate that button. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Documenting projects
Jose Gonzalez Gomez wrote: Jason, Thanks for your response. I'am already using Poseidon for the UML part, and after searching and reading a while I think I'll adopt DocBook. What software do you use to author DocBook documents? A plain XML editor with DTD validation or do you use anything else? Ahh yes, I forgot that bit XMLmind XML Editor (XXE) (http://www.xmlmind.com/xmleditor/) The Standard Edition is free and managed to do everything I needed (there is a Pro version with added features). XXE features DTD and XML Schema aware editing commands and a word processor-like view configured using W3C's cascading style sheets. That gives it a WYSIWYG feel which is really quite cool. We also created our own extensions to DocBook to support Use Cases eg actors, preconditions etc. Adding a CSS file means we could see what they would almost look like when rendered into PDF or HTML. Then used an XSLT to convert Use Case->DocBook, then we could use the DocBook->HTML/FOP/etc standard XSLTs. It supports DocBook straight off so it is very easy to use without the extra stuff we did. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]