Re: Can validation.xml be modularized?
- Original Message - From: "Chan, Jim" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 18, 2004 12:34 PM Subject: Can validation.xml be modularized? > > I have modularized my Struts application using different struts-config.xml > files. Also I am using different resource properties files for localization > for each module. Everything works fine. Currently, I am hooking up the > client side validation using the struts validation plugin. However, the > only way I can get it working is to register all the form validation in the > validation.xml, and access the localized error messages using the default > resource properties file. > > Does anyone know how to: > > 1. modularize the validation.xml so that I can decompose it the same way as > I did for the struts-config files. I tried using xml includes, but the > validation plugin complains that it can't find my validation1.xml file. It > only works if I use the absolute file path. > > > ]> > > &validation1; > For this part - I have wrestled with this alot, and have not been able to get it to work for validation.xml or tiles-defs.xml. Search back through the archives for something like "entity includes" and you will see my problems with it, and some suggestions for fixing - none of which have worked for me. I myself am convinced there is a bug in the plugin processor, or in validation and tiles themselves that make this not possible. It works fine in struts-config though. When I get free time (yeah right) I plan on getting to the bottom of this, but I have know idea when it would be. Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts logic combined with the struts validator
Alexander - Usually when I have this situation I just put in an else (or a logic:notEqual in your case) which prints out the form field as hidden with some "bogus" data in it. That "bogus" data will be enough to make the validation pass of course. I had thought about doing the requiredifpresent or something like that, but this always seemed much simpler. Matt Bathje - Original Message - From: "Alexander Craen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 02, 2004 8:14 AM Subject: Re: Struts logic combined with the struts validator > Maybe i`ll better rephrase my question to make it more easy for the reader > :) > > I want to make a field in a form required when it exists on the form > > if it is not on the form (due to some logic tags that make it disappear), I > dont want to generate an error. > > How would I best solve this? > > make a new validator "requiredifpresent" ? > or could I use the requiredif together with some logic based on values in > other beans ? > > > - Original Message - > From: "Alexander Craen" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, March 02, 2004 11:25 AM > Subject: Struts logic combined with the struts validato > > > > Hello, > > I am making a registration procedure that works with some logic based on > the > > choices the customer makes on a previous page > > > > > value="business"> > > > key="text.data.label.bill_vat_number"/> > > > > > > > > Problem description : > > When a customer is of customertype 'business' the field bill_vat_nr is > > showed on the page and is required when a customer is not of customertype > > 'business' the field bill_vat_nr is not showed on the page and theirfor is > > not required > > > > I tried to use a standard struts validator implementation > > > > > > > > > > > > I first thought about using the requiredif implementation. Problem is that > I > > only get it to work with elements from the same form. > > > > The result : > > The bill_vat_nr is required even if it has been left out of the form by > > struts logic > > > > My question : > > Is their a way to combine struts logic and the validator framework? Do I > > have to write a custom validator that does some kind of introspection on > the > > jsp? Or are their validators that are used for that purpose? What would be > > the best solution to tackle this problem? > > > > Tnx in advance > > Alexander Craen > > > > > > - > > 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]
flushing output from custom taglib
Hey all. Got another wacky question. I am writing a custom tag library, and I want it to flush the buffer of html out to the page as part of the processing. From what I can tell, either pageContext.getResponse.flushBuffer(); or pageContext.getOut.flush(); should do this, but I can't get either to. If for example I have in my doEndTag(): ResponseUtils.write(pageContext, "test1"); pageContext.getResponse.flushBuffer(); Thread.sleep(5000); ResponseUtils.write(pageContext, "test2"); pageContext.getResponse.flushBuffer(); Thread.sleep(5000); ResponseUtils.write(pageContext, "test3"); I would expect the "top portion" of the tile/page to be spit out along with "test1", then a 5 second wait, then "test2" to be spit out, then the rest of the page. Instead I get a 10 second (or so) wait, and the whole page spits out. using getOut.flush() results in the same behavior. I am using tiles if it makes any difference...but any idea what I am doing wrong here? Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
global forwards with modules (Again)
Hi all. I asked this a while back and never got an answer, so figured I'd ask again and see if there were any bites. I am trying to have the admin area of my project use modules, but so far it is a no go. I setup the module as: config/admin /WEB-INF/struts-config-admin.xml and if I type urls under /admin/ into the location bar, they work. If I try to use any of the global forwards I have defined in struts-config-admin.xml though, they do not. This becomes a problem rapidly, because (like good struts users) all of our javascript, style sheets, etc. are setup as global forwards, and the index.jsp page under the /admin/ directory has Any idea why the forwards aren't being followed, and how to correct the problem? I have tried changing that to forward="/admin/adminLogin" and that didn't help either. Right now the forwards are setup like the following: I have tried changing it to name="/admin/adminLogin", path="/admin/login.do", and messing around with the contextRelative attribute, and nothing seems to help - it always says it can't find the forward. Any help would be greatly appreciated. Thanks again, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Sending email from struts
Hi all. This is kind of off topic as it is not really struts related, but somebody here would probably have the answer. We have our application sending emails to users at some points and it is working fine. The problem is that we have the email message hardcoded into the Java, which we would like to avoid either by storing the message in application.properties or our database. This would be easy, except all of the messages contain user-specific information like their name or phone number or order id or something like that. Anybody have any ideas (or links to programs!) that can read in an email, replace the information it needs to from the db, and send that to the user. I could obviously write something myself to do it, but wouldn't want to reinvent the wheel. Turns out this is hard to search for too - email is not a search term that makes things easy. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamic parameters
Nathan - I think in a situation like this I would put an if test into the loop. If there is no data for the student, I would make HIDDEN form fields for that student, otherwise I would make the text fields. Then in your action, if the fields are blank, you don't need to worry about updating them. (Although then you need to think about what happens if a users enters blanks into the text fields - maybe add another field to each student for whether the user was allowed to input data or something like that) Matt Bathje - Original Message - From: "Nathan Maves" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, February 10, 2004 1:35 PM Subject: Re: dynamic parameters > Sorry for an ambiguity that was in my example. > > here are the gory details :) > > I am only using student as an example the real object would only > complicate matters. > > In an action I am retrieving : > > - a list of all the students objects. This includes their student id. > > - an array of studentsGrade objects. These objects have a studentId, > semester1Grade, semester2Grade in them. Remember that there might be, > at most, the same amount of studentGrade objects as there are students. > It is the case where there are less that I am concerned in. > > In the jsp : > > I only what the form to create text fields for the student if there > was data found. This may seem strange but there is a good business > reason for this. > > I need the full list of students to be displayed in the page. With out > this everything works great. The list of students is also ordered. > > Last ditch effort, > Nathan > > On Feb 10, 2004, at 11:43 AM, Michael McGrady wrote: > > > Hi, Nathan: > > > > This is progress, but I cannot tell what "Since the index from the > > outside will not work for the indexed properties first and > > last name" means. Please clarify. > > > > So far I can tell only the following: you have a list of students > > identified only by first and last name. You want to have a form that > > gets some more information, i.e. a third bit of information, from them > > via a text field. > > > > There are various reasons why what you are writing is hard to read. > > Your examples indicate a reality which is unlikely to be true, e.g. > > you have all the students with the same name such a "Joe Schmoe". You > > apparently are using A, B, etc. to stand in for what you call a > > NameId. If that is true or not is impossible to tell. > > > > Let me try to understand what you want to do. Do you merely want to > > update student names when you have them stored under student ids? I > > really cannot tell what you want to do. Whatever you want to do can > > easily be done, I am sure. It is really hard to tell what you want > > done. If you are trying to update names alone, then how are you doing > > this. Are the students doing it? Is an administrator doing it? Is > > the problem that there are too many students for one page? Is the > > problem that you don't have them indexed by name? If they are indexed > > by id, and there are a known number, you an create a Map with the > > students and use the id as an indexed property to retrieve the > > students. But, again, your explanation is not readable for me. So, I > > don't know what you want to do. Want to try again? > > > > Michael > > > > Michael > > > > At 07:52 AM 2/10/2004, you wrote: > >> First thanks for your time trying to help me. > >> > >> Here is the deal > >> > >> I have a list of elements. > >> > >> NameId > >> Student A 123 > >> Student B 123 > >> Student C 123 > >> Student D 123 > >> Student E 123 > >> Student F 123 > >> > >> and I only have data (first & last name) for some random amount of > >> them. On these rows I want the form to create text fields for these > >> items. > >> > >> Student A > >> Student B joe schmoe > >> Student C > >> Student D joe schmoe > >> Student E joe schmoe > >> Student F > >> > >> Since the index from the outside will not work for the > >> indexed properties first and last name I believe that I will have to > >> test if the current student row is equal to the next row in the array > >> of data. If they are then I will have to create the by > >> hand. > >> > >> Nathan
Re: dynamic parameters
What you want are called indexed properties in struts. Start here: http://jakarta.apache.org/struts/faqs/indexedprops.html and here: http://www.developer.com/java/ejb/article.php/2233591 Then search the list archives for any specific questions you have, many have been answered. Also, if you are having n number of elements, make sure your form goes into the session scope instead of the request scope. This is probably the biggest issue with indexed properties I have seen. Matt Bathje - Original Message - From: "Nathan Maves" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Monday, February 09, 2004 6:24 PM Subject: dynamic parameters > I have searched but found nothing on this specific example. > > I have a form that will have n number of elements. Each of these > elements will needs it own name. > > example. > > list of students is displayed on the screen with two text fields for > their first and last name. > > This is for a mass update page. > > The only way I can thing of is to have form element like.. > > > > > This way in my action I can parse out the student id and then update > the corresponding first and last name. > > Can this be done or is there a better way to do 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]
Re: Orkut
I would also like to be added. Any way we could take this off the list though? Like have 1 or 2 people that can be emailed privately about it? Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with the forward attribute in action
I didn't even know it was possible to do it the first way you show (I've always done it using #2). That would sure simplify things if #1 is possible - I want to know the answer too! Matt On Feb 3, 2004, at 6:33 PM, Narayanan, Sunitha wrote: Hi, I downloaded today's build of Struts 1.2 (Feb 3). While defining an action mapping in the struts-config.xml Gives me an error No action instance for path /login. [java] ERROR (RequestProcessor.java:327) - No action instance for path /lo gin could be created But when I specify it like this - It works fine. The method of only specifying forward attribute has worked in the past with struts 1.1 and also is shown as an example in the struts documentation. Can u let me know if something has changed? Thanks, Sunitha - 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]
Hello
[Filename: message.zip, Content-Type: application/octet-stream] The file that was attached to this message has been removed by the mail gateway filter because it is not permitted by the security policy or may contain a virus. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is there an INCLUDE feature that works with struts-config?
I think XML entities would do what he wants. What you do is, at the top of your struts-config.xml file, you define the entities you want to include: http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"; [ ]> Then, at each place you want to use the entity in your file, you include it as an entity using &entityName; (so for the above example: &actionMappings; and &formBeans;) So to include action mappings in your struts config that you have defined in another file, you would do: &actionMappings; In struts-config, the entity paths can be relative to your struts-config.xml file (usually /WEB-INF/), or hard coded paths to somewhere else on the file system. If you want to use entities in tiles-defs.xml or validation.xml, they must be hard coded paths (for now...I'm investigating this in my free time!!). Matt Bathje - Original Message - From: "Hubert Rabago" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Monday, February 02, 2004 11:23 AM Subject: Re: Is there an INCLUDE feature that works with struts-config? > Probably not in the way you're thinking. > Struts allows you to specify more multiple config files for the same > app, so you can probably specify the app-specific config and the shared > config for each app. However, each of your apps will need to have copies of > the same shared XML. > If you're worried about duplication, you can have the shared config in > one location and have your build process copy it from there. > Just an idea. > > - Hubert > > --- "Anderson, James H [IT]" <[EMAIL PROTECTED]> wrote: > > We will have many related Struts apps that require identical entries in > > struts-config, so I'm wondering if there's a way to define common sets of > > entries and then include them in the config file for each of the apps. > > > > Thanks, > > > > jim > > > > > > __ > Do you Yahoo!? > Yahoo! SiteBuilder - Free web site building tool. Try it! > http://webhosting.yahoo.com/ps/sb/ > > - > 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: 2 unanswered questions
Replying to myself here - but after some searching over the weekend, I found bug 17667 - which is the same problem I have been having. Stupid me searching for "multiple form" all this time instead of "multi-form" never found it. Anyways, I took the patches that had been attached to that bug already, and updated them for the latest versions of Struts and Commons Validator (mostly moving all the javascript fixes out of validator-rules.xml and into the individual .js files in validator) and it is working great. Much cleaner then the crap I had been brewing up as well. I put the new patches back up under the bug if anybody else is interested. (Or if they want to put this in 1.2) Matt Bathje - Original Message - From: "Matt Bathje" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, January 29, 2004 6:00 PM Subject: Re: 2 unanswered questions > > I'm assuming that you've at least specified distinct values for the > > "method" attribute for each use of ? > > http://jakarta.apache.org/struts/userGuide/struts-html.html#javascript > > (Actually, looking at the doc I see that the process when this isn't > > specified should result in unique validate method names.) I've never > > actually tried to validate multiple forms in a single page. You may > > have simply discovered a limitation in the design of the validator > > stuff. If so, feel free to submit an enhancement request in > > Bugzilla, and feel just as free (or more so) to attach patches to > > help solve the problem! > > Yes, specifying the method doesn't help with the problem. > > I started working on a patch - and it doesn't seem like it is going to be > struts specific. The validator javascript files (as well as the validator > itself maybe) need to be changed so that this can be done. > > Basically what I have started on doing is: > > 1. adding a multipleForm (true|false) property to the html:javascript tag - > if it is true it means we want multiple js validators on the same page. > 2. Modifying > org.apache.struts.taglib.html.JavascriptValidatorTag.createDynamicJavascript > to append the formName to the javascript functions that it outputs in the > ValidatorAction iteration loop. (If multipleForm = true) > 3. Modifying > org.apache.struts.taglib.html.JavascriptValidatorTag.getJavascriptStaticMeth > ods to alter the validator javascript if multipleForm = true. The 2 things I > am trying to have it do are replace the function definition with a function > definition that includes the form name and replace the oRequired (or > whatever) array definition call with a call that includes the form name (so > oRequired = new required(); becomes oRequired = new requiredFormName();) > > 1 and 2 are no problems. > 3 on the other hand is a major pain in the butt, and where alterations to > validator instead of struts come in. > > First, the .js files follow very loose standards for naming. Weird things > like oRequired for the required validator, but oMasked for the mask > validator. Weird things like minlength and maxlength both having wacky > upper/lower case changes all over. This makes doing String.replaceall() > operations on the .js files extremely tricky. The .js files would need to be > changed to make sure they follow a standard that could be parsed properly. > > The second problem is that I don't even think these replace operations > belong in struts, but in the validator code itself. (Like in > org.apache.commons.validator.ValidatorAction.loadJavascriptFunction > possibly) The problem here is I'm not entirely sure how to get the > html:javascript multipleForm variable into ValidatorAction properly. I am > also not sure if this is even the best/most elegant solution. If having it > in the validator code is good, is loadJavascriptFunction the best place for > it, or is somewhere else better? Does that code actually belong in struts or > validator? > > I can hack some stuff together and use it on our own sites, but I'd really > like to be able to contribute this stuff back so I want to make it "right". > > Thats all for now, let me know what you all think. > > Thanks, > Matt Bathje > > > - > 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: What does "do" stand for in .do files
Yes, you can use any extension you like. I'm currently using .cfm to integrate a Struts app into a Cold Fusion website. Matt On Jan 31, 2004, at 6:15 PM, Otávio Augusto wrote: So, just to complement the discussion, is it possible to use any other extension rather than .do? Changing it in the web.xml file makes that possible? Thanks Otávio Augusto On Sat, 31 Jan 2004 00:38:03 -0800 "Craig R. McClanahan" <[EMAIL PROTECTED]> wrote: Quoting "Gopalakrishnan, Jayesh" <[EMAIL PROTECTED]>: The "do" is insignificant, its just what all the sample applications use and has somehow stayed on. In the technical sense ("could I use "foo" instead of "do") you are absolutely right ... there is no intrinsic meaning to "do". However, for native speakers of English, "do" has a natural connotation of 'go DO something" that I wanted to pick up on, so that was my choice for the "example" mappings for the Struts controller servlet. Craig McClanahan PS: Being constructively lazy, it's also very easy to type :-). - 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: Validator Framework - problem using Mask
Pani - it looks like you may be missing jakarta-oro.jar from your WEB-INF/lib directory. (Or have an older version of it possibly). Make sure it exists, and if not get it from either your struts distribution's lib directory or from the apache website and put it into WEB-INF/lib. If it does exist, download the version from the apache website and put it into WEB-INF/lib and see if that fixes the problem. Matt Bathje - Original Message - From: "Pani R" <[EMAIL PROTECTED]> To: "Struts Users List" <[EMAIL PROTECTED]> Sent: Friday, January 30, 2004 11:49 AM Subject: Validator Framework - problem using Mask > Hi: > > I get the following exception while validating the mask part of a field. > > Exception: > > [ERROR] Validator - -reflection: null java.lang.reflect.InvocationTar getException: java.lang.NoClassDefFoundError: org/apache/oro/text/perl/Perl5Util > at org.apache.commons.validator.GenericValidator.matchRegexp(GenericValidator.j ava:107) > at org.apache.struts.validator.FieldChecks.validateMask(FieldChecks.java:271) > > > Extract from my validation.xml: > > depends="required,mask,minlength"> > > > > > mask > ^[a-zA-Z]*$ > > > minlength > 2 > > > > I dont know if this has got to do with the any path settings or versions 'am using with. Anyways, 'am using WSAD5.1, WAS 4.0 TestEnv, J2EE 1.2 with Struts 1.1 support, JDK 1.3.1. > > I appreciate any response. > > Thanks, > Pani > > > > > Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail! > http://login.mail.lycos.com/r/referral?aid=27005 > > - > 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: bug in latest validator-rules.xml ?
Joe - this is working fine for me with the 1/13/2004 nightly build. I have tried with commons-validator-1.1.1.jar and with whatever version the commons-validator.jar in the 1/13 nightly build of struts is. Validation worked right out of the box - all I did to "install" the nightly build was copy over the jar, tld and xml files from the zip file. Based on that it seems like if there is a bug, it is in struts and probably in the newer nightly builds. (Doesn't seem like it would be in validator-rules.xml itself though, that hasn't been updated since december) Matt Bathje - Original Message - From: "Joe Germuska" <[EMAIL PROTECTED]> To: "Struts Users List" <[EMAIL PROTECTED]> Sent: Friday, January 30, 2004 10:54 AM Subject: bug in latest validator-rules.xml ? > Between versions 1.47 and 1.48 of conf/share/validator-rules.xml, the > "javascript" block for validateRequired was removed. Now when I drop > that file into my webapp, my form which only has required validations > comes up with this as the entirety of its JavaScript block: > > > > <!-- Begin > > var bCancel = false; > > function validateForm(form) { > if (bCancel) >return true; > else > return true; > } > > //End --> > > > When I use 1.47, I get the normal behavior. This form only has > required validations, so I'm assuming it's related to the removal of > the javascript for validateRequired, which is the change between > these versions. > > Is there something I'm supposed to know to switch to the latest > version of validator-rules? I'm using commons-validator-1.1.1.jar > and the Struts nightlies from sometime in the last week. Do I need a > newer commons-validator? > > I'll file a bug if it's a bug, but I thought I'd ask if there was > some documentation that I'd missed before doing that. > > Joe > > > -- > Joe Germuska > [EMAIL PROTECTED] > http://blog.germuska.com >"Imagine if every Thursday your shoes exploded if you tied them > the usual way. This happens to us all the time with computers, and > nobody thinks of complaining." > -- Jef Raskin > > - > 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: 2 unanswered questions
> > regarding "entity includes in tiles-defs.xml (again)" -- both > struts-config and tiles-definitions files can be specified using a > comma-separated list of files (in web.xml for struts-config, and in > the plugin descriptor in struts-config for tiles) -- isn't that a > simpler way to solve the same problem of breaking down big config > files? > The problem with that is, we have some forms (probably 5-6 of them) that have duplicated properties/validations. It would be nice to be able to do an entity include to include those duplicated validations in each form they are required in validation.xml. If I get some free time I am going to look into this, but as I mentioned in: http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg92220.html I really think there is some sort of bug in either the plugin interface or the tiles and validator plugins specifically that make the "root" for the xml documents change to be %SystemRoot% or something like that. Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: custom javascript validation (solved)
Hi everybody. After working on this for a bit, I figured it out for myself. The problem was that in the variable definition, I was using regexp. This is wrong - the proper way to do it is regexp. Hopefully this will help somebody else out at some point. Matt Bathje - Original Message - From: "Matt Bathje" <[EMAIL PROTECTED]> To: "strutslist" <[EMAIL PROTECTED]> Sent: Wednesday, January 28, 2004 12:44 PM Subject: custom javascript validation > Hi all. > > I am doing some custom validations, and the server side of them is working > well. The problem is that in my custom javascript, I cannot get a variable I > have defined as a regular expression to work. The javascript always pulls > out the backslashes (\) from the regexp. If I put in the regular expression > with double backslashes, it works for javascript, but breaks in the java > end. Plus I would really like to not have to use "nonstandard" regexps. > > I am using the mask validator as my guide, and it seems the big difference > is when the "validation function" is created, in mask the regexp variables > get created as regular expressions, where as in my validator they get > created as strings. For example, here is the created mask function: > > function mask () { > this.a0 = new Array("phone", "Phone Number is invalid.", new Function > ("varName", > this.mask=/^(^\\([2-9]\\d{2}\\)\\s*\\d{3}-\\d{4}$)|(^[2-9]\\d{2}-\\d{3}-\\d{ > 4}$)$/; return this[varName];")); > } > > and here is my function: > function countryMask () { > this.a0 = new Array("postalCode", "Postal Code is invalid.", new Function > ("varName", > "this.CAN='^([ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]\\d[A-Za-z]\\s*\\d[A-Za-z > ]\\d)$'; this.otherField='countryID'; > this.USA='^(^\\d{5}$)|(^\\d{5}-\\d{4}$)$'; return this[varName];")); > } > > > See how in the mask function this.mask is set to a regular expression - no > quotes around it? But in my function, this.USA and this.CAN are both created > as strings with quotes around them (and no regexp demarkers (/)) > > Also, notice that at this point this.USA and this.CAN both have the slashes > in them as needed. But, in my validation script when I do var pattern = > oCountryMask[x][2](CAN);, pattern does not contain the slashes. > > What I am looking for is either a way to call oCountryMask[x][2](CAN) and > have it not strip the slashes, OR (and even better) have the var treated as > a regexp like the mask variable is. > > Obviously the "mask" variable for a mask validation is a special variable > that gets treated as a regexp - but is there any way to set the "javascript > type" of the variable in my validation? > > I was poking around in the validator javadocs and found > regexp looks like it may do something, but it > unfortunatley does not solve my problem. I'm wondering if maybe it isn't > implemented yet or something? > > I have really been able to find anybody else mentioning similar problems. :( > > Any help to get this working would be greatly appreciated!!! > > Thanks, > Matt Bathje > > ps - anybody have any knowledge about these three questions that were never > answered? > http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=1327188 > http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=1328405 > http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=1328406 > > > - > 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: 2 unanswered questions
> I'm assuming that you've at least specified distinct values for the > "method" attribute for each use of ? > http://jakarta.apache.org/struts/userGuide/struts-html.html#javascript > (Actually, looking at the doc I see that the process when this isn't > specified should result in unique validate method names.) I've never > actually tried to validate multiple forms in a single page. You may > have simply discovered a limitation in the design of the validator > stuff. If so, feel free to submit an enhancement request in > Bugzilla, and feel just as free (or more so) to attach patches to > help solve the problem! Yes, specifying the method doesn't help with the problem. I started working on a patch - and it doesn't seem like it is going to be struts specific. The validator javascript files (as well as the validator itself maybe) need to be changed so that this can be done. Basically what I have started on doing is: 1. adding a multipleForm (true|false) property to the html:javascript tag - if it is true it means we want multiple js validators on the same page. 2. Modifying org.apache.struts.taglib.html.JavascriptValidatorTag.createDynamicJavascript to append the formName to the javascript functions that it outputs in the ValidatorAction iteration loop. (If multipleForm = true) 3. Modifying org.apache.struts.taglib.html.JavascriptValidatorTag.getJavascriptStaticMeth ods to alter the validator javascript if multipleForm = true. The 2 things I am trying to have it do are replace the function definition with a function definition that includes the form name and replace the oRequired (or whatever) array definition call with a call that includes the form name (so oRequired = new required(); becomes oRequired = new requiredFormName();) 1 and 2 are no problems. 3 on the other hand is a major pain in the butt, and where alterations to validator instead of struts come in. First, the .js files follow very loose standards for naming. Weird things like oRequired for the required validator, but oMasked for the mask validator. Weird things like minlength and maxlength both having wacky upper/lower case changes all over. This makes doing String.replaceall() operations on the .js files extremely tricky. The .js files would need to be changed to make sure they follow a standard that could be parsed properly. The second problem is that I don't even think these replace operations belong in struts, but in the validator code itself. (Like in org.apache.commons.validator.ValidatorAction.loadJavascriptFunction possibly) The problem here is I'm not entirely sure how to get the html:javascript multipleForm variable into ValidatorAction properly. I am also not sure if this is even the best/most elegant solution. If having it in the validator code is good, is loadJavascriptFunction the best place for it, or is somewhere else better? Does that code actually belong in struts or validator? I can hack some stuff together and use it on our own sites, but I'd really like to be able to contribute this stuff back so I want to make it "right". Thats all for now, let me know what you all think. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
2 unanswered questions
Hi all. I have a few questions I've posted to the list recently that have not been answered. 2 of them are somewhat important, and I was wondering if anybody had any insights. I will simplify the questions in this message and include a link to the full description. First - how can I have multiple forms on the same page all use javascript validation? The javascript that struts prints out for each form conflicts with each other, and causes only the "last" form's validations to work. Originally asked here: http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg92019.html Second - I am working on a custom validator. The "server" side of the validation works great, but the javascript side has some issues with variables that contain regular expressions. It is stripping out the \ characters from the regexp so that it doesn't work. How can I access variables as regular expressions in a custom validator? Originally asked here: http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg92124.html And as long as I am doing this, there are 2 other questions with no answers yet, but they aren't quite as important to me as the above questions: http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg92020.html http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg91959.html (there is a thread about this, but no solution yet) Thanks again, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: entity includes in tiles-defs.xml (again)
Looking at the xml spec (1.0, second edition, section 4.2.2) it appears as though entities should be processed as relative to the resource within which they appear. The spec does allow for special circumstances that change the default relativity - but why would tiles and validator need to do this? And why would they change it to be %SystemRoot% (on my system, they appear to both be relative to c:\windows\system) Looking through the tiles parser code and the struts-config.xml parser code, I can see no difference - nothing that sets the "entity root" to be different, and there is nothing in the dtd from what I can tell. I can run the xml file with the relative path through a validating parser and it validates perfectly, reading the included entity as it should. I am left with 2 decisions on this then. Either there is some sort of (weird) requirement in tiles and validator (maybe all plugins that use config files?) that the default relative path for entities needs to change to %Systemroot% and that requirement DOESN'T exists for the struts-config files. Else, there is some sort of bug in both of their parsers which changes the relative path. I can't seem to find it though otherwise I would fix it myself. Let me know what you all think. Thanks, Matt Bathje - Original Message - From: "Hubert Rabago" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, January 28, 2004 5:31 PM Subject: Re: entity includes in tiles-defs.xml (again) > Hi Matt, > > I ran into the same problem (with the same error message) when I tried > using my own DTDs for XML files that Digester was processing. I found > that the solution is to put my DTD in the apps' class path, and then > register my dtd with the Digester instance which parses my config file. > > I'm not sure if the solution that worked for me would work for you. > I don't know if there's a way you can register a resource in such a > way that allows it to be recognized by the digester instance that > the tiles plugin uses. If there is, then that would solve your problem. > If not, it seems like you'd have to implementing your own tiles xml > digester, register the dtd with that instance, and parse your XML. > Looking at the tiles plugin source code, the class which does > the actual parsing is buried deep. Look at > org.apache.struts.tiles.xmlDefinition.XmlParser. > I didn't dig deep enough to see if you can configure its factory so > that your customized parse could be called instead. > > Maybe one of the Tiles developers can help. > > - Hubert > > --- Matt Bathje <[EMAIL PROTECTED]> wrote: > > James - > > > > I'm 99.999% sure that spelling is not the issue. To test this out, I am just > > cutting the path out and leaving the filename. Since it works with the path, > > I am deducing that the filename is correct. > > > > What other information can I give you to help? Unfortunatley I can't give > > you my entire application - but I was able to duplicate it in struts-example > > using validation.xml. > > > > I created a file in WEB-INF called testValidationInclude.xml and cut/paste > > the registrationForm validator into it out of validation.xml. Then in > > validation.xml I created an entity using the following syntax: > > > > > "-//Apache Software Foundation//DTD Commons Validator Rules > > Configuration 1.0//EN" > > "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd"; > > [ > > > "C:\apache_group\tomcat\Tomcat_4_1_24\webapps\struts-example\WEB-INF\testVal > > idationInclude.xml"> > > ]> > > > > > > and where the registrationForm was, I put &testinclude; > > > > This works without a problem > > > > When I change the entity definition to: > > > > > "-//Apache Software Foundation//DTD Commons Validator Rules > > Configuration 1.0//EN" > > "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd"; > > [ > > > > ]> > > > > I get an error: > > > > Jan 28, 2004 4:35:17 PM org.apache.struts.validator.ValidatorPlugIn > > initResources > > INFO: Loading validation rules file from '/WEB-INF/validation.xml' > > Jan 28, 2004 4:35:17 PM org.apache.struts.validator.ValidatorPlugIn > > initResources > > SEVERE: C:\WINDOWS\system32\testValidationInclude.xml (The system cannot > > find the file specified) > > java.io.FileNotFoundException: C:\WINDOWS\system32\testValidationInclude.xml > > (The system cannot find the file specified) > > at java.io.FileInputStream.open(Native Method)
Re: entity includes in tiles-defs.xml (again)
James - I'm 99.999% sure that spelling is not the issue. To test this out, I am just cutting the path out and leaving the filename. Since it works with the path, I am deducing that the filename is correct. What other information can I give you to help? Unfortunatley I can't give you my entire application - but I was able to duplicate it in struts-example using validation.xml. I created a file in WEB-INF called testValidationInclude.xml and cut/paste the registrationForm validator into it out of validation.xml. Then in validation.xml I created an entity using the following syntax: http://jakarta.apache.org/commons/dtds/validator_1_0.dtd"; [ ]> and where the registrationForm was, I put &testinclude; This works without a problem When I change the entity definition to: http://jakarta.apache.org/commons/dtds/validator_1_0.dtd"; [ ]> I get an error: Jan 28, 2004 4:35:17 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validation.xml' Jan 28, 2004 4:35:17 PM org.apache.struts.validator.ValidatorPlugIn initResources SEVERE: C:\WINDOWS\system32\testValidationInclude.xml (The system cannot find the file specified) java.io.FileNotFoundException: C:\WINDOWS\system32\testValidationInclude.xml (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) There are a bunch more lines, I can get them for you if you want. Let me know what else may be helpful to you. Thanks, Matt Bathje - Original Message - From: "James Mitchell" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, January 28, 2004 4:20 PM Subject: Re: entity includes in tiles-defs.xml (again) > Sorry, I thought you *wanted* to specify it directly. > > >From what you've said below, that's an odd problem and my first inclination > would be to check and recheck the spelling. Other than that, I'm not sure > without having more information or having the project right here in front of > me. > > > > -- > James Mitchell > Software Engineer / Struts Evangelist > http://www.struts-atlanta.org > 678.910.8017 (cell) > AIM: jmitchtx > MSN: [EMAIL PROTECTED] > > > > - Original Message - > From: "Matt Bathje" <[EMAIL PROTECTED]> > To: "strutslist" <[EMAIL PROTECTED]> > Sent: Wednesday, January 28, 2004 2:52 PM > Subject: Re: entity includes in tiles-defs.xml (again) > > > > Hi James, thanks for the answer. Unfortunatley it somehow wound up in my > > spam box... > > > > This doesn't really solve the problem. I don't care about having to put > the > > c:\ in the entity - what I care about is having to put > > /Inetpub_Tomcat/rsg_java/struts/pub in there. The application I am working > > on will have multiple instantations, and the installation path will change > > with each one. > > > > What I am looking for is a solution that allows me to put in just the file > > name (as you can do in struts-config files) or a path relative to WEB-INF. > > > > > > Thanks, > > Matt Bathje > > > > > > > > - Original Message - > > > Date: Mon, 26 Jan 2004 13:17:25 -0500 > > > From: James Mitchell <[EMAIL PROTECTED]> > > > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > > > Subject: Re: entity includes in tiles-defs.xml (again) > > > To: Struts Users Mailing List <[EMAIL PROTECTED]> > > > > > > Try changing this: > > > > Here is what DOES work in tiles-defs: > > > > > > > > > "C:\Inetpub_Tomcat\rsg_java\struts\pub\WEB-INF\kurt-admin-tilesdefs.xml"> > > > > > > > > > > to this > > > > > "/Inetpub_Tomcat/rsg_java/struts/pub/WEB-INF/kurt-admin-tilesdefs.xml"> > > > > > > > > > normally, "/" will be interpreted as "C:\" or to be more > > > specificyour system's %SystemDrive% > > > > > > > > > > > > -- > > > James Mitchell > > > Software Engineer / Struts Evangelist > > > http://www.struts-atlanta.org > > > 678.910.8017 (cell) > > > AIM: jmitchtx > > > MSN: [EMAIL PROTECTED] > > > > > > > > > > > > - Original Message - > > > From: "Matt Bathje" <[EMAIL PROTECTED]> > > > To: "strutslist" <[EMAIL PROTECTED]> > > > Sent: Monday, January 26, 2004 12:04 PM > > > Subject: entity includes in tiles-defs.xml (
Re: entity includes in tiles-defs.xml (again)
Hi James, thanks for the answer. Unfortunatley it somehow wound up in my spam box... This doesn't really solve the problem. I don't care about having to put the c:\ in the entity - what I care about is having to put /Inetpub_Tomcat/rsg_java/struts/pub in there. The application I am working on will have multiple instantations, and the installation path will change with each one. What I am looking for is a solution that allows me to put in just the file name (as you can do in struts-config files) or a path relative to WEB-INF. Thanks, Matt Bathje - Original Message - > Date: Mon, 26 Jan 2004 13:17:25 -0500 > From: James Mitchell <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > Subject: Re: entity includes in tiles-defs.xml (again) > To: Struts Users Mailing List <[EMAIL PROTECTED]> > > Try changing this: > > Here is what DOES work in tiles-defs: > > > "C:\Inetpub_Tomcat\rsg_java\struts\pub\WEB-INF\kurt-admin-tilesdefs.xml"> > > > > to this > "/Inetpub_Tomcat/rsg_java/struts/pub/WEB-INF/kurt-admin-tilesdefs.xml"> > > > normally, "/" will be interpreted as "C:\" or to be more > specificyour system's %SystemDrive% > > > > -- > James Mitchell > Software Engineer / Struts Evangelist > http://www.struts-atlanta.org > 678.910.8017 (cell) > AIM: jmitchtx > MSN: [EMAIL PROTECTED] > > > > - Original Message - > From: "Matt Bathje" <[EMAIL PROTECTED]> > To: "strutslist" <[EMAIL PROTECTED]> > Sent: Monday, January 26, 2004 12:04 PM > Subject: entity includes in tiles-defs.xml (again) > > > > Hi, I asked this question a month or 2 ago, and never got a response, so > > thought I'd try again - > > > > Using XML entities, I was able to get my struts-config file broken up into > > multiple files. > > > > I am attempting the same thing on my tile-defs.xml file, and when I do it, > I > > get the following error: > > > > 12/16/03 10:56:55 AMERROR org.apache.struts.tiles.TilesPlugin init - Can't > > create Tiles definition factory for module ''. > > ServletInitError: javax.servlet.ServletException: IO Error while parsing > > file '/WEB-INF/tiles-defs-admin.xml'. > > C:\WINDOWS\system32\kurt-admin-tilesdefs.xml (The system cannot find the > > file specified) > > > > > > So, just to be stupid, I put the full path to the file in the XML enitity > > declaration, and that makes it work - but I don't want to have to hard > code > > that path in. > > > > > > Here is what works in struts-config: > > > > > > Here is what DOESN'T work in tiles-defs: > > > > > > Here is what DOES work in tiles-defs: > > > "C:\Inetpub_Tomcat\rsg_java\struts\pub\WEB-INF\kurt-admin-tilesdefs.xml"> > > > > I have also tried doing ./kurt-admin-tilesdefs.xml and > > /kurt-admin-tilesdefs.xml but they just give me the same error. > > > > Any ideas about what is going on or how to fix it? > > > > > > Thanks, > > Matt Bathje > > > > > > - > > 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] > > > - End forwarded message - > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
custom javascript validation
Hi all. I am doing some custom validations, and the server side of them is working well. The problem is that in my custom javascript, I cannot get a variable I have defined as a regular expression to work. The javascript always pulls out the backslashes (\) from the regexp. If I put in the regular expression with double backslashes, it works for javascript, but breaks in the java end. Plus I would really like to not have to use "nonstandard" regexps. I am using the mask validator as my guide, and it seems the big difference is when the "validation function" is created, in mask the regexp variables get created as regular expressions, where as in my validator they get created as strings. For example, here is the created mask function: function mask () { this.a0 = new Array("phone", "Phone Number is invalid.", new Function ("varName", this.mask=/^(^\\([2-9]\\d{2}\\)\\s*\\d{3}-\\d{4}$)|(^[2-9]\\d{2}-\\d{3}-\\d{ 4}$)$/; return this[varName];")); } and here is my function: function countryMask () { this.a0 = new Array("postalCode", "Postal Code is invalid.", new Function ("varName", "this.CAN='^([ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]\\d[A-Za-z]\\s*\\d[A-Za-z ]\\d)$'; this.otherField='countryID'; this.USA='^(^\\d{5}$)|(^\\d{5}-\\d{4}$)$'; return this[varName];")); } See how in the mask function this.mask is set to a regular expression - no quotes around it? But in my function, this.USA and this.CAN are both created as strings with quotes around them (and no regexp demarkers (/)) Also, notice that at this point this.USA and this.CAN both have the slashes in them as needed. But, in my validation script when I do var pattern = oCountryMask[x][2](CAN);, pattern does not contain the slashes. What I am looking for is either a way to call oCountryMask[x][2](CAN) and have it not strip the slashes, OR (and even better) have the var treated as a regexp like the mask variable is. Obviously the "mask" variable for a mask validation is a special variable that gets treated as a regexp - but is there any way to set the "javascript type" of the variable in my validation? I was poking around in the validator javadocs and found regexp looks like it may do something, but it unfortunatley does not solve my problem. I'm wondering if maybe it isn't implemented yet or something? I have really been able to find anybody else mentioning similar problems. :( Any help to get this working would be greatly appreciated!!! Thanks, Matt Bathje ps - anybody have any knowledge about these three questions that were never answered? http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=1327188 http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=1328405 http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=1328406 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
global forwards in modules
Hi again - yet another question from me, sorry. I am trying to have the admin area of my project use modules, but so far it is a no go. I setup the module as: config/admin /WEB-INF/struts-config-admin.xml and if I type urls under /admin/ into the location bar, they work. If I try to use any of the global forwards I have defined in struts-config-admin.xml though, they do not. This becomes a problem rapidly, because (like good struts users) all of our javascript, style sheets, etc. are setup as global forwards, and the index.jsp page under the /admin/ directory has Any idea why the forwards aren't being followed, and how to correct the problem? I have tried changing that to forward="/admin/adminLogin" and that didn't help either. Right now the forwards are setup like the following: I have tried changing it to name="/admin/adminLogin", path="/admin/login.do", and messing around with the contextRelative attribute, and nothing seems to help - it always says it can't find the forward. Any help would be greatly appreciated. Thanks again, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
multiple validations on one page
Hi all. Still no answer to my other question regarding entities in tiles-defs.xml but now I have another question. I have 2 forms on the same page. I want javascript validations to work for both forms, but it's not happening. It looks like the first form is using the required() function from the second form instead of its own. The second form's javascript validation works just fine though. Anybody know of a way around this? Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
entity includes in tiles-defs.xml (again)
Hi, I asked this question a month or 2 ago, and never got a response, so thought I'd try again - Using XML entities, I was able to get my struts-config file broken up into multiple files. I am attempting the same thing on my tile-defs.xml file, and when I do it, I get the following error: 12/16/03 10:56:55 AMERROR org.apache.struts.tiles.TilesPlugin init - Can't create Tiles definition factory for module ''. ServletInitError: javax.servlet.ServletException: IO Error while parsing file '/WEB-INF/tiles-defs-admin.xml'. C:\WINDOWS\system32\kurt-admin-tilesdefs.xml (The system cannot find the file specified) So, just to be stupid, I put the full path to the file in the XML enitity declaration, and that makes it work - but I don't want to have to hard code that path in. Here is what works in struts-config: Here is what DOESN'T work in tiles-defs: Here is what DOES work in tiles-defs: I have also tried doing ./kurt-admin-tilesdefs.xml and /kurt-admin-tilesdefs.xml but they just give me the same error. Any ideas about what is going on or how to fix it? Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: generating tables in Struts
The export/tiles issue has been fixed - you just needd to specify a filter in your web.xml. http://displaytag.sourceforge.net/install.html If you need to export data from an included JSP page, such as from Struts, you should configure the ResponseOverrideFilter in your web.xml. (You do not need the filter if you do not use exports, or if you do not use the table tag from a jsp page that is included inside of another page.) Configure the Filter in your web.xml: ResponseOverrideFilter org.displaytag.filter.ResponseOverrideFilter And add mappings for the pages that you will intercept, for example: ResponseOverrideFilter *.do ResponseOverrideFilter *.jsp It's been broken in CVS for the past couple of weeks, but I just fixed it today. You'll have to download and built it to get the latest fixes. For #2, you could use JavaScript to grab the table and add links to the column titles that submit your form. I've done this and it works fairly well - although in the end I decided the table didn't need any sorting. HTH, Matt > -Original Message- > From: lixin chu [mailto:[EMAIL PROTECTED] > Sent: Friday, January 23, 2004 6:43 PM > To: [EMAIL PROTECTED] > Subject: generating tables in Struts > > > Hi, > I found the Display Tag which is really nice. However, > it has a couple of problems: > > 1. 'export' display data in the Tile not exporting to > a file - w/o Tiles it is fine. > > 2. I need a column of Checkbox, but the status is not > kept after sorting. > > Does anyone know if there is another package handling > the table in struts+Tiles with similar functionalities > but supporting checkbox ? > > thanks > li xin > > __ > Do you Yahoo!? > Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ - 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: Struts-Menu (Support URL Re-writing)
Sounds complicated. I don't use struts-layout so I don't know that I'm that interested in *fixing* struts-menu so it works with it. Maybe you should check with them and see why they don't support the latest struts-menu - and why they care what version of struts-menu you're using? Matt > -Original Message- > From: Parag Pattewar [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 21, 2004 9:24 PM > To: Struts Users Mailing List > Cc: [EMAIL PROTECTED] > Subject: RE: Struts-Menu (Support URL Re-writing) > > > Hi Matt > > I am using JDK1.4 and Struts-Menu1.1. > I tried to do the same thing with struts-menu2.1 , but as I > am using struts-layout1.1 its not supporting struts-menu2.1 > Can you help me to get the compatible version of > Struts-Layout2.1 and struts-menu2.1.Which will support the > action and forward attribute for the and . > > Thanks > Parag > > > -Original Message- > From: Matt Raible [mailto:H > Sent: Tuesday, January 20, 2004 7:32 PM > To: 'Struts Users Mailing List' > Subject: RE: Struts-Menu (Support URL Re-writing) > > > I need to know a couple things to help you with this problem. > > 1. What version of Struts Menu are you using? > 2. Which displayer are you using? > > > Also, knowing what platform (OS) and JDK version you're using > can't hurt. > > Matt > > > -Original Message- > > From: Parag Pattewar [mailto:[EMAIL PROTECTED] > > Sent: Monday, January 19, 2004 10:34 PM > > To: Struts Users Mailing List > > Cc: [EMAIL PROTECTED] > > Subject: RE: Struts-Menu (Support URL Re-writing) > > > > > > Hi > > > > If I change below location attribute to action attribute > for as > > well as from then > > > > For menu link I am getting > > > > http://localhost:8080/cust/null/expandedMenu=CsrAccountInformation > > > > and For Item link I am getting > > > > http://localhost:8080/cust/null instead of > > http://localhost:8080/cust/personalDataLoad?expandedMenu=CsrAc > > countInformati > > on > > > > > > > action="/personalDataLoad?expandedMenu=CsrAccountInformation"/> > > > > action="/closeAccountPageRouter?expandedMenu=CsrAccountInformation"/> > > > > > > Why this null is coming, is it coming bacause of some path > problem. I > > checked the entry of /accountinfoview and all actions > mentioned above > > in my struts-config.xml, the entries are there. > > > > Thanks in advance for the Help. > > > > Regards > > Parag > > > > -Original Message- > > From: Matt Raible [mailto:[EMAIL PROTECTED] > > Sent: Saturday, January 17, 2004 9:20 PM > > To: 'Struts Users Mailing List' > > Subject: RE: Struts-Menu (Support URL Re-writing) > > > > > > Change the "location" attribute to a "action" attribute, where the > > value of "action" matches the "path" of your action mapping. For > > example: > > > > > action="/accountinfoview"> > > > > If you are using 2.0, this should work. If it doesn't, let me know > > what displayer you're using and I'll fix it. > > > > Matt > > > > > -Original Message- > > > From: Parag Pattewar [mailto:[EMAIL PROTECTED] > > > Sent: Saturday, January 17, 2004 12:05 AM > > > To: Matt Raible; 'Struts Users Mailing List' > > > Subject: RE: Struts-Menu (Support URL Re-writing) > > > > > > > > > > > > Hi > > > I am having previous implementation of struts-menu as below > > > > > > > > location="accountinfoview.do" > > > > > > location="personaldtd.do?expMenu=AcctInfo"/> > > > > > location="clsRouter.do?expMenu=AcctInfo"/> > > > > > > > > > I have changed it as below, is it the correct way of using > > action and > > > forward attributes in struts-menu. > > > > > > > > location="accountinfoview.do" > > > > > > action="personaldtd.do?expMenu=AcctInfo"/> > > > > > forward="clsRouter.do?expMenu=AcctInfo"/> > > > > > > > > > > > > > > > -Original Message- > > > From: Matt Raible [mailto:[EMAIL PROTECTED] >
RE: Unit Test in struts
I use a fair amount of JavaScript in my apps, and what I've found is that the best thing to do is this: Write your app so it can be tested (and used) with JavaScript turned off. Works for me! Matt > -Original Message- > From: Edgar P Dollin [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 22, 2004 5:49 AM > To: Struts Users Mailing List > Subject: RE: Unit Test in struts > > > I have spent a fair amount of time with WebTest and HttpUnit. > The major issues with both of these are JavaScript related. > For example if you use JavaScript to populate select lists or > html objects they are not available in WebTest or HttpUnit > (HttpUnit is a little better since you have finer grained control). > > How does jWebUnit compare? > > Thanks. > > Edgar > > > -Original Message- > > From: Richard Hightower [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, January 21, 2004 4:26 PM > > To: Struts Users Mailing List > > Subject: RE: Unit Test in struts > > > > > > you should try jWebUnit. > > i like it a lot. > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004 > > > - > 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: Problem - Trying to hide javascript files in WEB-INF
You could include it (), but then you'd lose the browser's ability to cache the script and you'd end up with a bunch of JavaScript in your page. The "best practice" is to put your scripts in a place where browsers can get at them. If, for some reason, you don't want folks looking at your script - there's probably something you need to remove. Matt > -Original Message- > From: Colin Foulkes [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 20, 2004 2:21 PM > To: Struts Users Mailing List > Subject: RE: Problem - Trying to hide javascript files in WEB-INF > > > Yes, > > I understand what's happening, but I'm not sure whether there > is an alternative approach to placing the .js content into > the jsp at the server side. > > Thanks > > Colin > > -Original Message- > From: Matt Raible [mailto:[EMAIL PROTECTED] > Sent: January 20, 2004 3:15 PM > To: 'Struts Users Mailing List' > Subject: RE: Problem - Trying to hide javascript files in WEB-INF > > > Anything that the client will access, i.e. .js or .css files > via "href" attributes needs to be exposed to them. I usually > put my scripts in a "scripts" folder and my stylesheets in a > "styles" folder. > > > -Original Message- > > From: Colin Foulkes [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, January 20, 2004 2:12 PM > > To: [EMAIL PROTECTED] > > Subject: Problem - Trying to hide javascript files in WEB-INF > > > > > > Hi, > > > > I'm quite new to Open source and Struts > > > > I'm trying to convert some Microsoft asp.net pages to a > > struts/apache environment; and following advice on the > > newgroup, have "hidden" my .jsp pages in directories > beneath /WEB-INF. > > > > However, I have some pages that include script tags for > > loading javascript files. When I place the .js files under > > the WEB-INF directory they are not accessible to my page. > > > > The jsp page contains... > >
RE: Problem - Trying to hide javascript files in WEB-INF
Anything that the client will access, i.e. .js or .css files via "href" attributes needs to be exposed to them. I usually put my scripts in a "scripts" folder and my stylesheets in a "styles" folder. > -Original Message- > From: Colin Foulkes [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 20, 2004 2:12 PM > To: [EMAIL PROTECTED] > Subject: Problem - Trying to hide javascript files in WEB-INF > > > Hi, > > I'm quite new to Open source and Struts > > I'm trying to convert some Microsoft asp.net pages to a > struts/apache environment; and following advice on the > newgroup, have "hidden" my .jsp pages in directories beneath /WEB-INF. > > However, I have some pages that include script tags for > loading javascript files. When I place the .js files under > the WEB-INF directory they are not accessible to my page. > > The jsp page contains... >
RE: Struts-Menu (Support URL Re-writing)
I need to know a couple things to help you with this problem. 1. What version of Struts Menu are you using? 2. Which displayer are you using? Also, knowing what platform (OS) and JDK version you're using can't hurt. Matt > -Original Message- > From: Parag Pattewar [mailto:[EMAIL PROTECTED] > Sent: Monday, January 19, 2004 10:34 PM > To: Struts Users Mailing List > Cc: [EMAIL PROTECTED] > Subject: RE: Struts-Menu (Support URL Re-writing) > > > Hi > > If I change below location attribute to action attribute for > as well as from then > > For menu link I am getting > > http://localhost:8080/cust/null/expandedMenu=CsrAccountInformation > > and For Item link I am getting > > http://localhost:8080/cust/null instead of > http://localhost:8080/cust/personalDataLoad?expandedMenu=CsrAc > countInformati > on > > > action="/personalDataLoad?expandedMenu=CsrAccountInformation"/> > action="/closeAccountPageRouter?expandedMenu=CsrAccountInformation"/> > > > Why this null is coming, is it coming bacause of some path > problem. I checked the entry of /accountinfoview and all > actions mentioned above in my struts-config.xml, the entries > are there. > > Thanks in advance for the Help. > > Regards > Parag > > -Original Message- > From: Matt Raible [mailto:[EMAIL PROTECTED] > Sent: Saturday, January 17, 2004 9:20 PM > To: 'Struts Users Mailing List' > Subject: RE: Struts-Menu (Support URL Re-writing) > > > Change the "location" attribute to a "action" attribute, > where the value of "action" matches the "path" of your action > mapping. For example: > > action="/accountinfoview"> > > If you are using 2.0, this should work. If it doesn't, let > me know what displayer you're using and I'll fix it. > > Matt > > > -Original Message- > > From: Parag Pattewar [mailto:[EMAIL PROTECTED] > > Sent: Saturday, January 17, 2004 12:05 AM > > To: Matt Raible; 'Struts Users Mailing List' > > Subject: RE: Struts-Menu (Support URL Re-writing) > > > > > > > > Hi > > I am having previous implementation of struts-menu as below > > > > > location="accountinfoview.do" > > > > location="personaldtd.do?expMenu=AcctInfo"/> > > > location="clsRouter.do?expMenu=AcctInfo"/> > > > > > > I have changed it as below, is it the correct way of using > action and > > forward attributes in struts-menu. > > > > > location="accountinfoview.do" > > > > action="personaldtd.do?expMenu=AcctInfo"/> > > > forward="clsRouter.do?expMenu=AcctInfo"/> > > > > > > > > > > -Original Message- > > From: Matt Raible [mailto:[EMAIL PROTECTED] > > Sent: Friday, January 16, 2004 8:44 PM > > To: 'Struts Users Mailing List'; 'Parag Pattewar' > > Subject: RE: Struts-Menu (Support URL Re-writing) > > > > > > Struts Menu makes use of Struts classes to support "forward" and > > "action" attributes. If you use those, you'll likely get the > > re-writing you're looking for. I did this on a previous > project and > > did find that the "forward" attribute worked, but not the "action" > > attribute. I believe this is a bug in Struts since it should do > > rewriting when looking up an Action's path. > > > > The one issue with re-writing is that if you're using a menu that > > matches URLs (i.e. tabbed-menu) - they probably won't get > matched up. > > At a previous project, we were using URLs to highlight the current > > page we were on and we found that we had to use the > "action" attribute > > or the "page" attribute so that the jsessionid wasn't appended. Of > > course, we could've stripped this off in our Velocity > template, but we > > wen't with the quick, less-logic, way. > > > > To see this project, go to http://telluride.resortquest.com > and drill > > down a bit. The menu with highlight is on the right. BTW, > this site > > uses the Velocity displayer for both the top menu and the side menu. > > > > If you're not familiar with struts-menu, checkout the demo at > > http://raibledesigns.com/struts-menu. > > > > Ma
RE: Struts-Menu (Support URL Re-writing)
Struts Menu 2.0 and above. What version of "Struts Menu" are you using? Feel free to subscribe to the struts-menu mailing list and move this discussion over there. http://lists.sourceforge.net/lists/listinfo/struts-menu-user Or use the forums: http://sourceforge.net/forum/?group_id=48726 Matt > -Original Message- > From: Parag Pattewar [mailto:[EMAIL PROTECTED] > Sent: Sunday, January 18, 2004 9:37 PM > To: Struts Users Mailing List > Cc: [EMAIL PROTECTED] > Subject: RE: Struts-Menu (Support URL Re-writing) > > > Hi > > I tried to change the location attribute to forward or > Action, its not supporting because the struts version we are > using is 1.1 and as you have mentioned to use struts 2.0 and above. > > How do I make change, so struts 1.1 should support URL Rewriting. > > Regards > Parag > > -Original Message- > From: Matt Raible [mailto:[EMAIL PROTECTED] > Sent: Saturday, January 17, 2004 9:20 PM > To: 'Struts Users Mailing List' > Subject: RE: Struts-Menu (Support URL Re-writing) > > > Change the "location" attribute to a "action" attribute, > where the value of "action" matches the "path" of your action > mapping. For example: > > action="/accountinfoview"> > > If you are using 2.0, this should work. If it doesn't, let > me know what displayer you're using and I'll fix it. > > Matt > > > -Original Message- > > From: Parag Pattewar [mailto:[EMAIL PROTECTED] > > Sent: Saturday, January 17, 2004 12:05 AM > > To: Matt Raible; 'Struts Users Mailing List' > > Subject: RE: Struts-Menu (Support URL Re-writing) > > > > > > > > Hi > > I am having previous implementation of struts-menu as below > > > > > location="accountinfoview.do" > > > > location="personaldtd.do?expMenu=AcctInfo"/> > > > location="clsRouter.do?expMenu=AcctInfo"/> > > > > > > I have changed it as below, is it the correct way of using > action and > > forward attributes in struts-menu. > > > > > location="accountinfoview.do" > > > > action="personaldtd.do?expMenu=AcctInfo"/> > > > forward="clsRouter.do?expMenu=AcctInfo"/> > > > > > > > > > > -Original Message- > > From: Matt Raible [mailto:[EMAIL PROTECTED] > > Sent: Friday, January 16, 2004 8:44 PM > > To: 'Struts Users Mailing List'; 'Parag Pattewar' > > Subject: RE: Struts-Menu (Support URL Re-writing) > > > > > > Struts Menu makes use of Struts classes to support "forward" and > > "action" attributes. If you use those, you'll likely get the > > re-writing you're looking for. I did this on a previous > project and > > did find that the "forward" attribute worked, but not the "action" > > attribute. I believe this is a bug in Struts since it should do > > rewriting when looking up an Action's path. > > > > The one issue with re-writing is that if you're using a menu that > > matches URLs (i.e. tabbed-menu) - they probably won't get > matched up. > > At a previous project, we were using URLs to highlight the current > > page we were on and we found that we had to use the > "action" attribute > > or the "page" attribute so that the jsessionid wasn't appended. Of > > course, we could've stripped this off in our Velocity > template, but we > > wen't with the quick, less-logic, way. > > > > To see this project, go to http://telluride.resortquest.com > and drill > > down a bit. The menu with highlight is on the right. BTW, > this site > > uses the Velocity displayer for both the top menu and the side menu. > > > > If you're not familiar with struts-menu, checkout the demo at > > http://raibledesigns.com/struts-menu. > > > > Matt > > > > > -Original Message- > > > From: Edgar P Dollin [mailto:[EMAIL PROTECTED] > > > Sent: Friday, January 16, 2004 7:54 AM > > > To: 'Parag Pattewar'; [EMAIL PROTECTED] > > > Subject: RE: Struts-Menu (Support URL Re-writing) > > > > > > > > > You have the source to struts and the source to > > struts-menu, grab the > > > code from struts and plug it into struts-menu and submit a > > patch. You >
RE: Cactus vs StrutsTestCase
You might take a look at my AppFuse project - it uses all the technologies you mention (except for Oracle). It already has Cactus and StrutsTestCase configured. IMO, if you're testing Servlets or Filters, use Cactus. If you're testing Struts Actions, use StrutsTestCase. If you're testing JSPs, use Canoo's WebTest (http://webtest.canoo.com). AppFuse Home: http://raibledesigns.com/appfuse Live Demo: http://demo.raibledesigns.com/appfuse HTH, Matt > -Original Message- > From: Ashikuzzaman [mailto:[EMAIL PROTECTED] > Sent: Saturday, January 17, 2004 8:51 AM > To: [EMAIL PROTECTED] > Subject: Cactus vs StrutsTestCase > > > My new project is going to use Struts, Hibernate, XDoclets, > Ant etc. together in a Debian O/S plus Oracle backend. For > that project we found that there are two primary testing > strategies used in server-side testing: mock object (MO) and > in-container (IC). I got a look of what is what but would > like to know which approach is generally used more? > > We also found two open source projects are popular for this > testing - Apache Cactus and StrutsTestCase. Now which one > should fit better for testing Struts applications? I mean > pros and cons. > > Any comment or lights please? > > Regards, > > Muhammad Ashikuzzaman (Fahim) > SCJP, SCWCD, IBM WebSphere and XML Developer > Senior Software Engineer, SurroundApps Inc. > > > - > 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: Struts-Menu (Support URL Re-writing)
Change the "location" attribute to a "action" attribute, where the value of "action" matches the "path" of your action mapping. For example: If you are using 2.0, this should work. If it doesn't, let me know what displayer you're using and I'll fix it. Matt > -Original Message- > From: Parag Pattewar [mailto:[EMAIL PROTECTED] > Sent: Saturday, January 17, 2004 12:05 AM > To: Matt Raible; 'Struts Users Mailing List' > Subject: RE: Struts-Menu (Support URL Re-writing) > > > > Hi > I am having previous implementation of struts-menu as below > > location="accountinfoview.do" > > location="personaldtd.do?expMenu=AcctInfo"/> > location="clsRouter.do?expMenu=AcctInfo"/> > > > I have changed it as below, is it the correct way of using > action and forward attributes in struts-menu. > > location="accountinfoview.do" > > action="personaldtd.do?expMenu=AcctInfo"/> > forward="clsRouter.do?expMenu=AcctInfo"/> > > > > > -Original Message- > From: Matt Raible [mailto:[EMAIL PROTECTED] > Sent: Friday, January 16, 2004 8:44 PM > To: 'Struts Users Mailing List'; 'Parag Pattewar' > Subject: RE: Struts-Menu (Support URL Re-writing) > > > Struts Menu makes use of Struts classes to support "forward" > and "action" attributes. If you use those, you'll likely get > the re-writing you're looking for. I did this on a previous > project and did find that the "forward" attribute worked, but > not the "action" attribute. I believe this is a bug in > Struts since it should do rewriting when looking up an Action's path. > > The one issue with re-writing is that if you're using a menu > that matches URLs (i.e. tabbed-menu) - they probably won't > get matched up. At a previous project, we were using URLs to > highlight the current page we were on and we found that we > had to use the "action" attribute or the "page" attribute so > that the jsessionid wasn't appended. Of course, we could've > stripped this off in our Velocity template, but we wen't with > the quick, less-logic, way. > > To see this project, go to http://telluride.resortquest.com > and drill down a bit. The menu with highlight is on the > right. BTW, this site uses the Velocity displayer for both > the top menu and the side menu. > > If you're not familiar with struts-menu, checkout the demo at > http://raibledesigns.com/struts-menu. > > Matt > > > -Original Message- > > From: Edgar P Dollin [mailto:[EMAIL PROTECTED] > > Sent: Friday, January 16, 2004 7:54 AM > > To: 'Parag Pattewar'; [EMAIL PROTECTED] > > Subject: RE: Struts-Menu (Support URL Re-writing) > > > > > > You have the source to struts and the source to > struts-menu, grab the > > code from struts and plug it into struts-menu and submit a > patch. You > > might need a menu-config.xml option to indicate that you > will be url > > rewriting. > > > > Edgar > > > > -Original Message- > > From: Parag Pattewar [mailto:[EMAIL PROTECTED] > > Sent: Friday, January 16, 2004 7:21 AM > > To: [EMAIL PROTECTED] > > Subject: Struts-Menu (Support URL Re-writing) > > > > > > Hi all > > > > How do I change Struts-Menu implemention, so it can support URL > > ReWriting for session tracking? > > > > Thanks and Regards > > Parag Pattewar > > Persistent Systems Private Limited > > "Bhageerath" > > 402, Senapati Bapat Road > > Pune 411016 > > India > > > > Tel: +91 (20) 2567 8900 extn. 2640 > > Fax: +91 (20) 2567 8901 > > > > > > > - > > 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: Struts-Menu (Support URL Re-writing)
In 2.0, you can use a "forward" or "action" attribute - and struts-menu will look this up in struts-config.xml. That's all I'm trying to say - both of these should have URL re-writing built in. Matt On Jan 16, 2004, at 6:11 PM, Edgar P Dollin wrote: Unless I am mistaken the relative url in struts-menu is just the text passed in from menu-config.xml. In the CoolMenuDisplayer it calls, buildMenuString --> getArgs --> getUrl which unless there is prior transformation the string from the config. Let me know if I am seeing it wrong or if this is different from displayer to displayer. Thanks. Edgar -Original Message- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Friday, January 16, 2004 10:14 AM To: 'Struts Users Mailing List'; 'Parag Pattewar' Subject: RE: Struts-Menu (Support URL Re-writing) Struts Menu makes use of Struts classes to support "forward" and "action" attributes. If you use those, you'll likely get the re-writing you're looking for. I did this on a previous project and did find that the "forward" attribute worked, but not the "action" attribute. I believe this is a bug in Struts since it should do rewriting when looking up an Action's path. The one issue with re-writing is that if you're using a menu that matches URLs (i.e. tabbed-menu) - they probably won't get matched up. At a previous project, we were using URLs to highlight the current page we were on and we found that we had to use the "action" attribute or the "page" attribute so that the jsessionid wasn't appended. Of course, we could've stripped this off in our Velocity template, but we wen't with the quick, less-logic, way. To see this project, go to http://telluride.resortquest.com and drill down a bit. The menu with highlight is on the right. BTW, this site uses the Velocity displayer for both the top menu and the side menu. If you're not familiar with struts-menu, checkout the demo at http://raibledesigns.com/struts-menu. Matt -Original Message- From: Edgar P Dollin [mailto:[EMAIL PROTECTED] Sent: Friday, January 16, 2004 7:54 AM To: 'Parag Pattewar'; [EMAIL PROTECTED] Subject: RE: Struts-Menu (Support URL Re-writing) You have the source to struts and the source to struts-menu, grab the code from struts and plug it into struts-menu and submit a patch. You might need a menu-config.xml option to indicate that you will be url rewriting. Edgar -Original Message- From: Parag Pattewar [mailto:[EMAIL PROTECTED] Sent: Friday, January 16, 2004 7:21 AM To: [EMAIL PROTECTED] Subject: Struts-Menu (Support URL Re-writing) Hi all How do I change Struts-Menu implemention, so it can support URL ReWriting for session tracking? Thanks and Regards Parag Pattewar Persistent Systems Private Limited "Bhageerath" 402, Senapati Bapat Road Pune 411016 India Tel: +91 (20) 2567 8900 extn. 2640 Fax: +91 (20) 2567 8901 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004 - 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: Struts-Menu (Support URL Re-writing)
Struts Menu makes use of Struts classes to support "forward" and "action" attributes. If you use those, you'll likely get the re-writing you're looking for. I did this on a previous project and did find that the "forward" attribute worked, but not the "action" attribute. I believe this is a bug in Struts since it should do rewriting when looking up an Action's path. The one issue with re-writing is that if you're using a menu that matches URLs (i.e. tabbed-menu) - they probably won't get matched up. At a previous project, we were using URLs to highlight the current page we were on and we found that we had to use the "action" attribute or the "page" attribute so that the jsessionid wasn't appended. Of course, we could've stripped this off in our Velocity template, but we wen't with the quick, less-logic, way. To see this project, go to http://telluride.resortquest.com and drill down a bit. The menu with highlight is on the right. BTW, this site uses the Velocity displayer for both the top menu and the side menu. If you're not familiar with struts-menu, checkout the demo at http://raibledesigns.com/struts-menu. Matt > -Original Message- > From: Edgar P Dollin [mailto:[EMAIL PROTECTED] > Sent: Friday, January 16, 2004 7:54 AM > To: 'Parag Pattewar'; [EMAIL PROTECTED] > Subject: RE: Struts-Menu (Support URL Re-writing) > > > You have the source to struts and the source to struts-menu, > grab the code from struts and plug it into struts-menu and > submit a patch. You might need a menu-config.xml option to > indicate that you will be url rewriting. > > Edgar > > -Original Message- > From: Parag Pattewar [mailto:[EMAIL PROTECTED] > Sent: Friday, January 16, 2004 7:21 AM > To: [EMAIL PROTECTED] > Subject: Struts-Menu (Support URL Re-writing) > > > Hi all > > How do I change Struts-Menu implemention, so it can support > URL ReWriting for session tracking? > > Thanks and Regards > Parag Pattewar > Persistent Systems Private Limited > "Bhageerath" > 402, Senapati Bapat Road > Pune 411016 > India > > Tel: +91 (20) 2567 8900 extn. 2640 > Fax: +91 (20) 2567 8901 > > > - > 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: Struts-Menu (Support URL Re-writing)
If you use forwards or actions for attributes, it should do this for you. On Jan 16, 2004, at 5:20 AM, Parag Pattewar wrote: Hi all How do I change Struts-Menu implemention, so it can support URL ReWriting for session tracking? Thanks and Regards Parag Pattewar Persistent Systems Private Limited "Bhageerath" 402, Senapati Bapat Road Pune 411016 India Tel: +91 (20) 2567 8900 extn. 2640 Fax: +91 (20) 2567 8901 - 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: Struts + xdoclet
XDoclet and Struts works very nicely together - throwing Maven into it has only brought me headaches and I found it easier to just do it in Ant. Why try to do it in Maven "just because Maven is cool?" ;-) You might checkout my AppFuse project with uses Ant/XDoclet/Struts/Hibernate. http://raibledesigns.com/appfuse HTH, Matt On Jan 15, 2004, at 9:24 AM, Raj Atchutuni wrote: Can some tell where you want me to research on xdoclet + struts + maven. I would like to generate xdoclet for STRUTS Dynaforms , Action Mappings. FYI : I completed my project in Struts (w/ Dynaforms, Actions etc). Now i want to implement xdoclet and also xdoclet for maven to it. Thanks Raj - Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: handling form based authentication w/ remember-me cookie
On Jan 14, 2004, at 3:52 AM, Nadeem Bitar wrote: A note about storing passwords in cookies. Encode the password. Do not store the userid with the password in the cookie, store some id associated with the user id. You can generate a one-way hash (MD5) of the contents of the cookie with a "secret key" only known to the server. This way when you get the cookie back you can compare it to make sure it wasn't altered. Many open source java projects store passwords in cookies insecurely so beware of that if you are going to use that as reference. I'm guilty of this - do you have code samples (or articles) of how to MD5-ify a String and get it's "secret code?" I've been struggling with this for quite some time - a full example (storing "some id" vs. userid) is even more desirable. Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: .NET: We are just like Struts... only better.
The two Java libraries that I know of are JSP Tag Libraries - here are links to their demo sites: http://displaytag.org http://raibledesigns.com/struts-menu Matt On Jan 14, 2004, at 2:08 AM, Salgar, Mehmet wrote: Hello everybody, I am following this discussion for very long time, it is really interesting. I am developing both Java and MS stuff. Mainly I am a Java developer but I have few .NET projects also in the mean time. I have to say that with Struts, JSP is a much attractive tool (with Velocity it is very very interesting tool :)) ) but I have to say that with ASP.NET and web control MS has a nodge over Java at the moment. But I am sure when Java Server Faces will be ready, everything will be same again. PS. If you need real numbers I can say that at this moment Web Controls give % 30 less development times over the controls like TreeView, Menu Controls, fully functional Rich Text Editor as Web Control. And a question, do you know is there any library in Java producing the functionality of the View States. Regards, Mehmet Salgar -Ursprüngliche Nachricht- Von: Craig R. McClanahan [mailto:[EMAIL PROTECTED] Gesendet am: Dienstag, 30. Dezember 2003 23:57 An: Struts Users Mailing List Betreff: RE: .NET: We are just like Struts... only better. Quoting "Hookom, Jacob" <[EMAIL PROTECTED]>: As a follow up to your "by hand" comment, isn't Sun developing a new GUI development tool to wizard-ize JSF? Yes: http://wwws.sun.com/software/products/jscreator/index.html Even if it weren't a product coming from the company I work for :-), this one would have me tempted ... Many other companies are promising support for JavaServer Faces in the near term as well. Speaking of wizards, can JSF enforce flow in a wizard manner without additional modifications like Struts? Depends on what you mean by "enforce" -- Struts doesn't really do anything to enforce flows. However, both Struts and JavaServer Faces share the concept of decoupling the actual name of the page to be displayed next from the business logic that returns an outcome which the navigation decision is based on. In Struts you do this by using declarations at the global or per-Action level. In JavaServer Faces, you do this by defining navigation rules based on the page you're currently on, the action method that was called (i.e. which submit button was pushed), and what the logical outcome value was returned by the action method. Thanks much! Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Blank page after form validation
Most likely your "input" attribute is invalid - this usually results in a blank page in my experience. HTH, Matt On Jan 13, 2004, at 10:56 PM, VENKATESH GANGAL wrote: Hi All, We have been facing a very strange problem with form validation We have a JSP which is an input to an action and there is an associated form bean to validate the form. Here is the configuaration file struts-config.xml: validation.xml : MessageResources.properties form.error.productRef = Please enter Product Reference FormBean Validation method : public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) { //ActionErrors errors = super.validate(mapping, request); ActionErrors errors = new ActionErrors(); if ((productRef == null) || (productRef.trim().length()< 1)){ errors.add ("productRef",new ActionError("form.error.productRef")); } return errors ; } Here is the JSP When I submit this form without entering anything in the textfield, it is taking me to a blank page. Can anyone let me know why this is happening? It is not going to the action at all and is returning with errors to the JSP.I am not able to reach the page from where I submitted the data along with errors.The error was added to ActionErrors object. We are using oc4j(Oracle Apps) standalone application.We are using struts 1.1 Thanks in advance for your help. Cheers... Venkatesh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: handling form based authentication w/ remember-me cookie
They should be getting called for both - since they both are a "request". You might try adding the element to trap forwards as well. This is a Servlet 2.4 feature. loginFilter /security/* REQUEST FORWARD On Jan 13, 2004, at 12:19 PM, [EMAIL PROTECTED] wrote: Are Servlet filters supposed to be called for both GET and POST methods? They seem to be getting called for GETs only on Tomcat 5. -Chris -Original Message- From: Parmar, Dipakkumar [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 13, 2004 03:57 PM To: 'Struts Users Mailing List' Subject: RE: handling form based authentication w/ remember-me cookie Hi Max, I haven't tested it either. I read it about this in "IBM WebSphere V5.0 Security handbook (page 64)". Regards, Dipak Parmar -Original Message- From: Max Cooper [mailto:[EMAIL PROTECTED] Sent: Monday, January 12, 2004 10:42 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: handling form based authentication w/ remember-me cookie Dipak, Are you certain that the filter will be invoked on the /j_security_check request when container-based security is used? I have not tested this, but it would not surprise me to find that some containers do not execute filters on /j_security_check requests. I don't know if the Servlet Spec says anything about this case. Chris, Another alternative to the original problem of security with "remember me" functionality will be available soon. A patch has been submitted to my SecurityFilter project (http://www.securityfilter.org/) to support "remember me" functionality. The integration should be complete soon, and a beta release will be made available once the integration is complete. SecurityFilter works very much like container-managed security otherwise, including the configuration format (except that you declare the constraints in a separate config file rather than web.xml). -Max - Original Message - From: "Parmar, Dipakkumar" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Monday, January 12, 2004 7:43 AM Subject: RE: handling form based authentication w/ remember-me cookie Hi Chris, You can do this using Servlet Filter. What you need to do is write postLoginFilter that maps to the j_security_check url. In doFilter method, you can write your post login code after j_security_check done is work. Something like: public void doFilter(.) // let the j_security_check to do it's work chain.doFilter(request, response) // do you post login stuff here Regards, Dipak Parmar -Original Message- From: Chris Ruegger [mailto:[EMAIL PROTECTED] Sent: Monday, January 12, 2004 9:53 AM To: Struts Users Mailing List Subject: handling form based authentication w/ remember-me cookie I am using Struts and building a logon page to do Form-based authentication under Tomcat. I want to also have a checkbox for the user to check that says "remember me" so that I can send them a cookie. I'm not sure how to "intercept" the form values because I have to post to j_security_check. How can I get the check-box value, set up the cookie, and send them to j_security_check with struts? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: handling form based authentication w/ remember-me cookie
On Jan 13, 2004, at 12:42 AM, Craig R. McClanahan wrote: Filters are *not* required to be invoked on j_security_check invocations. In fact, Tomcat won't even enable the "j_security_check" url unless an unauthenticated user accesses a protected resource. Basically, I believe there is no guaranteed-to-be-portable way to implement "remember me" functionality on the server using container managed security. Craig The Filter I use is mapped to the location of the . The solution I use does work on both Tomcat 4/5 and Resin, which is portable enough for me! I did have to add FORWARD for Tomcat 5 and Resin, where the login page is displayed using a forward instead of a redirect. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pagination Support
Is this what you're looking for? http://displaytag.sf.net, demo at http://www.displaytag.org HTH, Matt On Jan 12, 2004, at 10:03 PM, Viral_Thakkar wrote: Hi all, Do struts have any support forpaginationpurpose? By pagination, I mean, displaying the data retrieved from database in JSP page in fixed slots... Thanks & Regards, Viral - 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: Linking CSS
I prefer using or to give my CSS files an absolute path - but that's just me: " ... Matt On Jan 12, 2004, at 10:01 PM, Mike Deegan wrote: works for me ... what is the error you are getting? may require use of the tag ? - Original Message - From: "vasudevrao gupta" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Monday, January 12, 2004 9:48 PM Subject: Linking CSS Dear All, I am usign WebSphere Application Development Studio for development of our application in struts. When I am linking .css files to a JSP using normal HTML tag, its not getting identified,..Do we need to use a different syntax for linking .css files for JSP in struts??? Eg: Regards vasudevRaoGupta Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. - 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 form based authentication w/ remember-me cookie
Remember Me functionality with j_security_check has worked fine for me. I just go to a LoginServlet from my loginForm, which sets cookies and redirects to j_security_check. Then I map a Filter to check for those cookies and logs the user in appropriately. More with code at: http://www.mail-archive.com/[EMAIL PROTECTED]/msg86636.html Complete code is available in my AppFuse application at: http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse HTH, Matt On Jan 12, 2004, at 8:41 PM, Max Cooper wrote: Dipak, Are you certain that the filter will be invoked on the /j_security_check request when container-based security is used? I have not tested this, but it would not surprise me to find that some containers do not execute filters on /j_security_check requests. I don't know if the Servlet Spec says anything about this case. Chris, Another alternative to the original problem of security with "remember me" functionality will be available soon. A patch has been submitted to my SecurityFilter project (http://www.securityfilter.org/) to support "remember me" functionality. The integration should be complete soon, and a beta release will be made available once the integration is complete. SecurityFilter works very much like container-managed security otherwise, including the configuration format (except that you declare the constraints in a separate config file rather than web.xml). -Max - Original Message - From: "Parmar, Dipakkumar" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Monday, January 12, 2004 7:43 AM Subject: RE: handling form based authentication w/ remember-me cookie Hi Chris, You can do this using Servlet Filter. What you need to do is write postLoginFilter that maps to the j_security_check url. In doFilter method, you can write your post login code after j_security_check done is work. Something like: public void doFilter(.) // let the j_security_check to do it's work chain.doFilter(request, response) // do you post login stuff here Regards, Dipak Parmar -Original Message- From: Chris Ruegger [mailto:[EMAIL PROTECTED] Sent: Monday, January 12, 2004 9:53 AM To: Struts Users Mailing List Subject: handling form based authentication w/ remember-me cookie I am using Struts and building a logon page to do Form-based authentication under Tomcat. I want to also have a checkbox for the user to check that says "remember me" so that I can send them a cookie. I'm not sure how to "intercept" the form values because I have to post to j_security_check. How can I get the check-box value, set up the cookie, and send them to j_security_check with struts? Thanks - 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: 403 error page not being displayed
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]
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]
403 error page not being displayed
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 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Serving up Tiles based on Role
I'd love to serve up a specific tile based on a role, but it doesn't seem like it's currently possible in the Tiles Framework. Basically, I want to do the following: In this example, users with role "admin" get the userProfile.jsp, while users with a "tomcat" role get the userDetail.jsp. Unfortunately, "role" is not an allowed attribute on . It seems it's only possible to do this on a definition level - but then they cannot be the same name, and it seems rather clunky. For the definition stuff, it'd be nice to do: Any tips are appreciated. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Example of a non-threadsafe Action?
OK, I understand now. That makes sense. Thanks for your help, Craig & Richard! Matt - Original Message - From: "Yee, Richard K,,DMDCWEST" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Tuesday, December 23, 2003 3:37 PM Subject: RE: Example of a non-threadsafe Action? > Matt, > A final declaration just means that the reference can't be changed to a > different SimpleDateFormat instance. A static declaration just means that > there is one instance of the variable for all of the instances of the class. > Neither modifier affects how the SimpleDateFormat uses internal instance > variables. > > -Richard > > -Original Message- > From: Sgarlata Matt [mailto:[EMAIL PROTECTED] > Sent: Tuesday, December 23, 2003 11:40 AM > To: Struts Users Mailing List > Subject: Re: Example of a non-threadsafe Action? > > > What if the SimpleDateFormat variable is declared as final and/or static? > > Thanks, > > Matt > - Original Message - > From: "Craig R. McClanahan" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>; "Nifty > Music" <[EMAIL PROTECTED]> > Sent: Tuesday, December 23, 2003 2:35 PM > Subject: RE: Example of a non-threadsafe Action? > > > > Quoting Nifty Music <[EMAIL PROTECTED]>: > > > > > Thanks Craig! You certainly confirmed my suspicions, although I > > > would > have > > > guessed that I could've gotten away with sharing the > > > SimpleDateFormat variable since it wouldn't depend on any values > > > coming in from request objects. Could you perhaps shed some light > > > on why it wouldn't make > sense to > > > share it? > > > > > > > Because the internal implementation of SimpleDateFormat uses instance > variables > > during parsing and formatting, so it's not thread safe :-). > > > > Craig > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Example of a non-threadsafe Action?
What if the SimpleDateFormat variable is declared as final and/or static? Thanks, Matt - Original Message - From: "Craig R. McClanahan" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>; "Nifty Music" <[EMAIL PROTECTED]> Sent: Tuesday, December 23, 2003 2:35 PM Subject: RE: Example of a non-threadsafe Action? > Quoting Nifty Music <[EMAIL PROTECTED]>: > > > Thanks Craig! You certainly confirmed my suspicions, although I would have > > guessed that I could've gotten away with sharing the SimpleDateFormat > > variable since it wouldn't depend on any values coming in from request > > objects. Could you perhaps shed some light on why it wouldn't make sense to > > share it? > > > > Because the internal implementation of SimpleDateFormat uses instance variables > during parsing and formatting, so it's not thread safe :-). > > Craig > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Initializing DynaActionForm
The correct syntax is I usually look directly at the DTD (struts-config_1_1.dtd) when I have questions like this. Matt - Original Message - From: "Marco Mistroni" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Monday, December 22, 2003 12:17 PM Subject: Initializing DynaActionForm > Hi all, > Can you tell me how can I initialize dynamic form in struts > config? > > Do I have to do something like this > > > > ?? > > how about when I have to initialize a java.sql.Timestamp? I was used to > initialize it like this new Timestamp(System.currentTimeMillis()) > > > > thanx and regards > marco > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help!
I think another possibility would be to 1) Delete the classes directory 2) Add your project to CVS Now you don't have the classes directory in CVS, but of course if someone pulls the code from CVS they can build the classes directory for themselves using Eclipse, Ant, or whatever. Matt - Original Message - From: "David Erickson" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, December 19, 2003 3:03 PM Subject: Re: [OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help! > Matt, > Thanks! #2 works great. Another quick question to fire off if anyone > knows.. I want to keep that classes directory out of cvs, i have a > .cvsignore file in the root of my project, by putting "classes" in there is > that enough to accomplish this? Would that filter out any other potential > directories named classes as well? If so I just won't make any with that > name =) > -David > - Original Message - > From: "Matt Bathje" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Friday, December 19, 2003 12:52 PM > Subject: Re: [OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help! > > > > David - there are 2 options for this that I can think of: > > > > 1. In your project settings in eclipse, in the java compiler category, go > to > > the build path tab and uncheck the "clean output folders on full build" > > setting > > > > 2. Put your configuration/other files into the /src directory. When > eclipse > > builds, it will copy the files over to the classes directory. (note: if > this > > doesn't work there may be a setting that turns it on, but I couldn't find > > one, and don't remember ever setting it...) > > > > > > I prefer situation 2 myself. > > > > Matt Bathje > > > > > > - Original Message - > > From: "David Erickson" <[EMAIL PROTECTED]> > > To: "Struts Mailing List" <[EMAIL PROTECTED]> > > Sent: Friday, December 19, 2003 1:42 PM > > Subject: [OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help! > > > > > > > So we are migrating our app from debugging with System.out.. (dont > laugh.. > > > even though I do).. to debugging it with Sysdeo's Eclipse plugin. > However > > > we have run into a showstopping snag unless we can get it resolved. > > Eclipse > > > is set to compile everything from /web/WEB-INF/src into > > /web/WEB-INF/classes > > > as it should so tomcat can run correctly and see the files. However we > > have > > > configuration and other files also in /web/WEB-INF/classes.. and when > > > eclipse rebuilds the project it 'cleans' that directory by deleting > > > everything then compiling the source back into there. Can this be > > stopped? > > > Or what is everyone else doing regarding this? I'm sure I can't be the > > only > > > one with this problem. > > > > > > Thanks, > > > David > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help!
David - there are 2 options for this that I can think of: 1. In your project settings in eclipse, in the java compiler category, go to the build path tab and uncheck the "clean output folders on full build" setting 2. Put your configuration/other files into the /src directory. When eclipse builds, it will copy the files over to the classes directory. (note: if this doesn't work there may be a setting that turns it on, but I couldn't find one, and don't remember ever setting it...) I prefer situation 2 myself. Matt Bathje - Original Message - From: "David Erickson" <[EMAIL PROTECTED]> To: "Struts Mailing List" <[EMAIL PROTECTED]> Sent: Friday, December 19, 2003 1:42 PM Subject: [OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help! > So we are migrating our app from debugging with System.out.. (dont laugh.. > even though I do).. to debugging it with Sysdeo's Eclipse plugin. However > we have run into a showstopping snag unless we can get it resolved. Eclipse > is set to compile everything from /web/WEB-INF/src into /web/WEB-INF/classes > as it should so tomcat can run correctly and see the files. However we have > configuration and other files also in /web/WEB-INF/classes.. and when > eclipse rebuilds the project it 'cleans' that directory by deleting > everything then compiling the source back into there. Can this be stopped? > Or what is everyone else doing regarding this? I'm sure I can't be the only > one with this problem. > > Thanks, > David > > > - > 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: Checkboxes with session-scoped DynaActionForms
Wendy & Barrett - Thanks for your help! Both of your answers helped me fix the problem I was having with checkboxes and session-scoped DynaActionForms. Wendy - I feel like the reset method of the DynaActionForm should be able to automatically take care of checkboxes, perhaps with a little extra help like specifying clearOnReset="true" or isCheckbox="true" in the element for the property, but oh well... I'm not going to push it on the dev list. Matt - Original Message - From: "Wendy Smoak" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, December 17, 2003 3:03 PM Subject: RE: Checkboxes with session-scoped DynaActionForms > From: Sgarlata Matt [mailto:[EMAIL PROTECTED] > Also, It looks like I am going to have to subclass > DynaActionForm or DynaValidatorForm so that I can reset the > checkboxes in the reset() method of the form bean. > That seems like quite a pain (kind of > defeats the purpose of Dyna forms, doesn't it?). "Dyna" forms merely free you of the need to write all those get/set methods. Defining the properties in struts-config.xml does not mean you can't or shouldn't override the 'reset' and/or 'validate' methods. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - 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]
Checkboxes with session-scoped DynaActionForms
Does anyone know a good reference on how to use checkboxes with session-scoped DynaActionForms? The problem I am running into is that when the form bean is session scoped, the checkbox "sticks" to always being checked even if the user unchecks the checkbox. This makes some sense to me, because I know that if the checkbox is unchecked then a value for the checkbox is not passed along in the request, so the old value is kept. I think with ActionForms this is solved by making the underlying property of the checkbox of type boolean and by setting the value of the checkbox to false in the reset() method of the ActionForm. So, what is the correct setup with DynaActionForms? Should I make my underlying form property of type java.lang.Boolean? Also, It looks like I am going to have to subclass DynaActionForm or DynaValidatorForm so that I can reset the checkboxes in the reset() method of the form bean. That seems like quite a pain (kind of defeats the purpose of Dyna forms, doesn't it?). Is that correct? Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
entity includes in tile-defs.xml
Hi all. Using XML entities, with this as a guide: http://www.mail-archive.com/[EMAIL PROTECTED]/msg13197.html I was able to get my struts-config file broken up into multiple files. I am attempting the same thing on my tile-defs.xml file, and when I do it, I get the following error: 12/16/03 10:56:55 AMERROR org.apache.struts.tiles.TilesPlugin init - Can't create Tiles definition factory for module ''. ServletInitError: javax.servlet.ServletException: IO Error while parsing file '/WEB-INF/tiles-defs-admin.xml'. C:\WINDOWS\system32\kurt-admin-tilesdefs.xml (The system cannot find the file specified) So, just to be stupid, I put the full path to the file in the XML enitity declaration, and that makes it work - but I don't want to have to hard code that path in. Here is what works in struts-config: Here is what DOESN'T work in tiles-defs: Here is what DOES work in tiles-defs: Any ideas what is going on? Is this something wrong with my XML? A bug in Struts? Or in the XML parser? I haven't found anything mentioning this, and the apache bug db appears to be down right now so I can't check it. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamically sized form (mostly solved)
Hi All. Sorry I am jumping in a bit late on this since I am the one who probably caused a lot of the confusion. I am the one who originally said I had this working with the form under the request scope - I was wrong. The form needs to be under the session scope for this to work or you will get the beanutils.populate errors. Matt Bathje - Original Message - From: "Andy Schmidgall" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, December 10, 2003 4:01 PM Subject: RE: dynamically sized form (mostly solved) > Does this mean it's impossible to do through request scope? I am > attempting to do this, and it would be nice to know if my work is in > vain :) > > -Andy > > -Original Message- > From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 10, 2003 3:20 PM > To: 'Struts Users Mailing List' > Subject: RE: dynamically sized form (mostly solved) > > > I thought it worked, but it didn't. > > -Richard > > -Original Message- > From: Nifty Music [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 10, 2003 1:02 PM > To: [EMAIL PROTECTED] > Subject: RE: dynamically sized form (mostly solved) > > > Nicholas, > > What you said definitely makes sense to me. Richard graciously replied > off-list with a similar response. I remember reading documentation > which stated that when using dynamic arrays with DynaForms, it is > necessary to place the DynaForm in session scope. However, I 'm almost > positive that someone (Matt? Mark?) mentioned on this list that they > were able to pass an ArrayList through a DynaForm in request scope. For > a variety of reasons, I'm not too eager to put the entire formbean in > the session for the sake of propogating one ArrayList attribute. If > Matt or Mark or anyone else has some insights to share regarding how > they were able to get this to work in request scope, I'd be very > grateful to hear. > > Thanks again, > > Brent > > > - > 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]
[ANNOUNCE] Struts Menu 2.0 Released!
This release is a significant refactoring of the 1.x codebase. The source and site is now built using Maven. Menus can now be defined using Velocity templates and support has been added for looking up dynamic values. This means that if you have ${variableName} in your menu-config.xml (in a link), the tag library will look in all scopes for a variable with the name "variableName". The example app has been updated to improve documentation. IMO, the Velocity templates is huge because it means "if it's possible with HTML" - it's possible with Struts Menu. Changes (http://struts-menu.sourceforge.net/changes-report.html): - Renamed package structure to net.sf.navigator. - Added support for using Struts' actions and forwards for links in menu-config.xml. - Added support for using dynamic variables in menu-config.xml. - Updated build process to use Maven for building/deploying. - Refactored to use Velocity and allow dynamic variable substitution. Read the nitty-gritty details about the Velocity enhancements at http://raibledesigns.com/wiki/Wiki.jsp?page=StrutsMenu. Demo: http://raibledesigns.com/struts-menu Download: http://tinyurl.com/x6p9 Enjoy! Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MessageResource not in HttpRequest
Thank you for your reply. Are you saying that only the "default" MessageResource is available in the request, while all others are in the application context? I was wondering about this, but I thought it was odd that from the Action, I could get the MessageResource (using getResource(req, "key") ). Thanks, Matt Manish Singla <[EMAIL PROTECTED]> wrote: WntFramework is in application context and not in request. Manish Singla Matt Minyard wrote: > Hi, > > I have defined a Message Resource defined in my struts-config.xml file like: > > > > > > > > I can access the key/values in my JSPs without a problem. For example: > > > > > > > However, when I try to access the Message Resource from an ActionForm, I can't get > an instance. For example, when I try this code > > MessageResources resources = > (MessageResources) req.getAttribute("WntFramework"); > > I just get null for my resources reference. > > > > Does anyone have any suggestions? > > > It doesn't appear as though there is a MessageResource instance in the request. When > I dump the request, I get: > > > org.apache.struts.action.mapping.instance = > ActionConfig[path=/Login,forward=/jsp/login.jsp,scope=request > > WntLogin = [EMAIL PROTECTED] > > org.apache.struts.action.MODULE = [EMAIL PROTECTED] > > > > I can see the "default" MessageResource in the request dump; the one defined without > a key. Also, in my Action, I can access all Message Resource bundles using > getRequest(req, "key"), but in my ActionForm, I can only get the default one. > > > Thanks, > > Matt > > > > > - > Do you Yahoo!? > Free Pop-Up Blocker - Get it now -- Thanks Manish Singla x73166 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Free Pop-Up Blocker - Get it now
MessageResource not in HttpRequest
Hi, I have defined a Message Resource defined in my struts-config.xml file like: I can access the key/values in my JSPs without a problem. For example: However, when I try to access the Message Resource from an ActionForm, I can't get an instance. For example, when I try this code MessageResources resources = (MessageResources) req.getAttribute("WntFramework"); I just get null for my resources reference. Does anyone have any suggestions? It doesn't appear as though there is a MessageResource instance in the request. When I dump the request, I get: org.apache.struts.action.mapping.instance = ActionConfig[path=/Login,forward=/jsp/login.jsp,scope=request WntLogin = [EMAIL PROTECTED] org.apache.struts.action.MODULE = [EMAIL PROTECTED] I can see the "default" MessageResource in the request dump; the one defined without a key. Also, in my Action, I can access all Message Resource bundles using getRequest(req, "key"), but in my ActionForm, I can only get the default one. Thanks, Matt - Do you Yahoo!? Free Pop-Up Blocker - Get it now
RE: [OT] xdoclet + hibernate
If you want examples of combining the two, as well as using xdoclet with a bunch of other things: JSP, Struts, Sitemesh, EJB 2.0 and CMP 2.0, Velocity, WebWork, Sitemesh, POJO and Hibernate. then check out http://xpetstore.sourceforge.net/ matt -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Saturday, November 22, 2003 7:23 AM To: Struts Users Mailing List Subject: [OT] xdoclet + hibernate Sorry to post this group with an almost unrelated question, but I'm sure someone on this list must be using xdoclet to generate hibernate resources. I wont take the piss and post the problem on this list but I would appreciate it if anyone who's been using hibernatedoclet could drop me a mail.. Cheers Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
multiple modules & "cannot retrieve mapping" & not fun!
Hi all -- I'm trying to move to struts 1.1 multiple application modules & am getting a very frustrating error that I can't seem to move around. I've searched the archives & haven't found a solution. Bummer! When I try to access a very simple JSP (/author/login.jsp) with a html:form, Struts gives an error saying "Cannot retrieve mapping for action /loginAuthor". What is strange though is that I can go to /author/loginAuthor.do & struts finds the mapping then. It seems like the login.jsp page doesn't realize that it is in the author sub-application. How do I make the JSP know which sub-app it is part of? The documentation wasn't very clear on this (or at least I couldn't find it) The error, a description of my setup, & important parts of various files are below. Has anyone seen this before? What am I doing wrong? Thanks very much- Matt http://localhost/together/author/login.jsp -- this gives: 500 Servlet Exception javax.servlet.jsp.JspException: Cannot retrieve mapping for action /loginAuthor at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:810) at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506) at org.apache.strutsel.taglib.html.ELFormTag.doStartTag(ELFormTag.java:324) at _author._login__jsp._jspService(/author/login.jsp:9) at com.caucho.jsp.JavaPage.service(JavaPage.java:75) at com.caucho.jsp.Page.pageservice(Page.java:553) etc. http://localhost/together/author/loginAuthor.do -- this works!! -- my setup I've set up my main web.xml file for multiple applications as instructed in the struts user guide. DTD refs in all the struts-config files are 1.1 versions. The webapp itself is under the /together context. App server is Caucho Resin. Struts is the latest 1.1 release. ---from web.xml action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml config/author /WEB-INF/struts-author-config.xml 2 --- from struts-author-config.xml --- - from uthor/login.jsp --- <%@ page language="java" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el"; prefix="html-el" %> email address: Password: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamically sized form (mostly solved)
Cool, thanks for the extra tip! Matt Bathje - Original Message - From: "Yee, Richard K,,DMDCWEST" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Friday, November 21, 2003 4:22 PM Subject: RE: dynamically sized form (mostly solved) > Matt, > You actually only need the form in the request. You don't need the property > of the form at all in your JSP. > > In my JSP I use > > > indexId="ctr" > > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamically sized form (mostly solved)
> I found out that using new DynaActionForm()inside of the > PreLoaderAction.execute() doesn't work. It gives a null pointer exception > when you try and call the set() method. > > You need to do this instead: > > FormBeanConfig cfg = mapping.getModuleConfig() >.findFormBeanConfig("dynaIndexTestForm"); > DynaActionForm myForm; > Richard - this was the last piece of the puzzle for me, now it works without having to supply the name="form" on the preloader action...sweet. Mark - I have had it working both ways now, in session and request. If you want to do it in request you have to have 2 request objects in your preload. The first is the form itself, and the second is the property for the form (which is what you actually loop through in your jsp) I will probably use the request scope myself just because I try to stay out of session as much as possible. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamically sized form (mostly solved)
> > DynaActionForm taxRatesForm = new DynaActionForm(); > > and > > taxRatesForm.set("taxRates", allTaxRates); > > request.setAttribute("taxRates", > > allTaxRates); > > Creating a form in the action servlet is one sure way to piss the folks > off who have to maintain the app. You might think its big n clever, but > you'd be hiding the form away in a class, what do the htmlists do? Well this does not work for me anyway. When I change the code to do what Richard suggests, I get null pointer exceptions. So is what you are saying Mark is that the way I am doing this (have the form name specified on the preloader action, and do DynaActionForm taxRateForm = (DynaActionForm) form; in the preloader action class) is correct? > > > Using arraylist means you dont have to use the lazy list initialization > that i think that using an array will require. See bean utils for > details. I could be full of shit but I have this working with arrayList > and no joy with using arrays of beans. > It is working fine for me with an array of beans. I'm not entirely sure what you mean by lazy list initalization, or how it could be a problem here. (I couldn't find a reference in the BeanUtils api, and googling for it didn't return much other than standard java lazy instantiation which from my Java knowledge isn't a problem...) > > I think you have the choice of putting the form in either session or > > request > > scope. Request scope is generally preferable b/c the memory gets > > released > > sooner. > > Yeah right .. Nullpointerexception tastic. Last I looked scoping to > request wont work , so don't bother. My form is in the request scope and working fine. I agree with Richard in preferring request scope, but if there is a valid reason for it to be in session instead I'd move it there. Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamically sized form (mostly solved)
Might I say - woohoo!! Thanks to your guys help, I got this working. I just want to make sure that I'm doing this the best way. In my struts-config file, the preloader has to have the form named in addition to having it on the action. The form is setup to be in the request scope, not in the session scope. In my preloader action, instead of doing DynaActionForm taxRatesForm = new DynaActionForm(); I do: DynaActionForm taxRatesForm = (DynaActionForm) form; then I just do: taxRatesForm.set("taxRates", allTaxRates); request.setAttribute("taxRates", allTaxRates); In the submit action, I just have to do: DynaActionForm taxRatesForm = (DynaActionForm) form; TaxRateBean[] taxRates = (TaxRateBean[]) taxRateForm.get("taxRates"); Everything seems to work pretty slickly. My main question is if having to have the name="formName" in the preloader action is correct? It would be nice to know if I am doing anything else the "incorrect" way though also. If I didn't explain anything very well and you want to see code snippets, just let me know. Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamically sized form
> DynaActionForm taxRatesForm = new DynaActionForm(); > com.ntso.rsg.bus.tax.TaxRateBean[] taxRates = new > com.ntso.rsg.bus.tax.TaxRateBean[allTaxRates.length]; > > // allTaxRates is the array that holds my data bean > > for(int i=0; i < allTaxRates.length; i++) { > // this is the set I am using, from the Struts API: > //set(java.lang.String name, int index, java.lang.Object value) > // Set the value of an indexed property with the specified > name. > taxRatesForm.set("taxRates", taxRates); > } Richard - I tried this, but didn't have much hope, as it doesn't really make sense to me. What would be the point of doing the set inside a loop over allTaxRates? Also, how would the data get from allTaxRates into the taxRates array in the form? How does it know that taxRates is an indexed property as opposed to a simple property? Why setup a new TaxRateBean array (taxRates) when allTaxRates is already that? Anyways, trying your method outright produces a null pointer exception. I tried modifying it to do this in the loop (using allTaxRates so that it gets the current data): taxRatesForm.set("taxRates", i, allTaxRates[i]); and it produces an error of: java.lang.NullPointerException: No indexed value for 'taxRates[0]' I then tried this, outside of the loop (again using allTaxRates because it will get the current data) taxRatesForm.set("taxRates", allTaxRates); it also gives a null pointer exception Using the set(string, object) method of DynaActionForm doesn't really make sense to me, so if that is the solution could you explain why? (See all my questions above about that) Unless I am completely braindead (which we can't rule out of course) I think the set(string, int, object) method needs to be used for this. Thanks again, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamically sized form
OK, This gets me a step closer - I never understood that last paragraph completely, "The actual" always got me :) Anyway, here is what I have in my preloader now: DynaActionForm taxRatesForm = new DynaActionForm(); // allTaxRates is the array that holds my data bean for(int i=0; i < allTaxRates.length; i++) { // this is the set I am using, from the Struts API: //set(java.lang.String name, int index, java.lang.Object value) // Set the value of an indexed property with the specified name. taxRatesForm.set("ID", i, allTaxRates[i].getID()); ... set all the other form properties } HttpSession session = request.getSession(); // advancedTaxRatesCurrentForm is the name of the form bean in struts-config session.setAttribute("advancedTaxRatesCurrentForm", taxRatesForm); Which is giving me the error: java.lang.NullPointerException: No indexed value for 'ID[0]' (if you need the entire stack trace let me know) I think I may be using the wrong DynaActionForm.set method, or I misunderstand the parameters to it or something. Just for good measure, here is my form bean out of struts-config again: Thanks, Matt Bathje - Original Message - From: "Yee, Richard K,,DMDCWEST" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Thursday, November 20, 2003 2:58 PM Subject: RE: dynamically sized form > Matt, > In the previous email, I wrote, "You will need to dynamically create the > array of TaxRateBean and put it in session scope in order to create the > submission fields in your form. (See the last paragraph of article #2)." > I should have said that according to the article, you prepopulate the array > in the form and put the form in session scope. > > -Richard > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamically sized form
Hi again. I guess I left out part of the explanation when I asked this question - I already have it working with a form bean class as is described in the message you indicate. I am trying to avoid having a class for each form by using DynaActionForms (or better yet DynaValidatorForms). That is what I am seeking an answer to. Is there a way to do a dynamically sized form using a DynaForm, instead of a custom form bean class for each one. Thanks again for any insights, Matt - Original Message - From: "Nicholas L Mohler" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, November 20, 2003 11:33 AM Subject: Re: dynamically sized form > > > > > > Matt, > > Find the thread titled "Using a collection of Beans within an ActionForm" > from yesterday. It has the answer that you need. > > Nick > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
dynamically sized form
Hi all. I am trying to have a dynamically sized forming using indexed properties. I am using the following article: http://www.developer.com/java/ejb/article.php/2233591 as a guide, and have almost got it. The form appears to get properly generated, and each element is listed as taxRates[3].ID, etc. I am putting the form bean into the session scope (I think) as the article states, but when I submit, I get an error: javax.servlet.ServletException: BeanUtils.populate, root cause: java.lang.ArrayIndexOutOfBoundsException at java.lang.reflect.Array.get(Native Method)(a full stack trace is at the bottom of the message). As far as I can tell, this happens before any code in my action is being processed. (The first line of the action is to print "hello" to the log, and that never even happens) I am using The struts nightly build from 11/19/03 to make sure it isn't a bug or something like that, because what I am seeing here is very similar to bugzilla report #23465 Here are relevant code snippets: The form bean: The action mapping: The preloader: request.setAttribute("taxRates", allTaxRates); // where allTaxRates is a TaxRateBean[] The jsp form: For the action, I have tried three different things: Try 1: (DynaActionForm) myForm = (DynaActionForm) form; Try 2: (DynaActionForm) myForm = (DynaActionForm) session.getAttribute("advancedTaxRatesCurrentForm"); Try 3: TaxRateBean[] myForm = (TaxRateBean[]) session.getAttribute("advancedTaxRatesCurrentForm"); All three things yield the same error, and as stated above, the error occurs before any of my code in the action. The action itself is extending org.apache.struts.action.Action; and is just a standard execute method. Searching on the web and in the archives has yielded some people with similar problems, but so far I have not been able to find a solution that works. Just for reference, the platform for this is: Windows XP Pro Tomcat 4.1.24 Struts Nightly Build 11/19/03 Java 1.4.2 Any help about what I'm doing wrong would be greatly appreciated!! As stated, the full error stack trace is attached below. Thanks, Matt Bathje Stack trace of error: javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:844) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:823) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:243) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1176) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:472) at com.ntso.rsg.RsgStrutsServlet.doPost(RsgStrutsServlet.java:52) 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(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
RE: Validator's sucks ??
> Using either customized Java code or regular expressions, a > developer can ensure that any incoming form data is legal and valid. > This is a tremendous help to any developer as it prevents bad > data from being processed by their Action and, many times, > causing the user to see annoying 500 errors. I'm not sure why any Action would bomb out from invalid data. If that happens, IMO, you're putting too much logic in your Action. IMO, data validation belongs at the BO level. No matter where your data comes from, your BO should decide for itself whether or not it's valid before it tries to process it. It shouldn't just assume that it will get valid data. For this reason, in one project I completed, we ignored client-side validation nearly completely, and instead relied on server-side validation coming from the BO's themselves. This way, no matter what screen tried to do what operation, correct error messages would be given back to the user and the screen would re-paint. This was a lot easier and more logical to me than having each screen (which is simply a view to data) know exactly what kind of data is valid for what it is displaying. Doing it at the BO level, if there is a change in one validation, it gets changed in one place, no matter how many screens can updated that piece of data. Much easier, IMO. So, I'd like the Validator framework to work at the BO level and the javascript/screen level, and skip the Action level altogether. I prefer my Actions to be really, really stupid - traffic-controllers only, not data handlers. Matt Kruse
RE: Null DynaActionForm
Probably you aren't properly setting up the dynaActionForm in your struts-config.xml file. matt -Original Message- From: Sumit S. [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 12:55 PM To: [EMAIL PROTECTED] Subject: Null DynaActionForm Hi, How do I create a new instance of a DynaActionForm when the form passed to my Action.execute() method is null ? public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try { DynaActionForm userForm = null; if (null != form) { userForm = (DynaActionForm) form; System.out.println("IT IS NOT NULL"); } else { /*NEED TO CREATE A NEW INSTANCE HERE*/ System.out.println("IT IS NULL"); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
commons upload FileItem objects?
Hi all - I'm putting together a webapp that'll do lots of file-uploading. The commons Fileupload package has a nifty little API that'll let you write an uploaded file directly. According to their docs, http://jakarta.apache.org/commons/fileupload/using.html, it'll actually move the file rather than copying it. But I can't seem to get at a FileItem object using struts' upload implementation. Strange thing is that Struts' FormFile objects seem to have FileItem objects wrapped -- but in a private field. Is there a way to get at the wrapped FileItem? or some other way to be able to use that great FileItem.write method in Struts? Thanks very much- Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:options maximum length?
I have a an Array with a large list of names in it (up to about 1000+ or more). I need to display these names in a drop down list, but when The page loads it simply stops loading after about 837 lines. The code I am using is: Any ideas why it only displays a part of the Array and not the full thing? Any help is appreciated, Matt __ Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error, please notify the addressee by return email and delete the email. This email transmission is the property of HAS Solutions and any information it contains is legally protected. HAS Solutions has no liability (including liability in negligence) to any person for any loss or damage consequential or otherwise suffered or incurred by that person resulting directly or indirectly from either the use of, or reliance on, the information contained herein. __
RE: code generate by validwhen doesn't exists
I don't believe that requiredif or validwhen generate client-side (JavaScript) validation. Matt -Original Message- From: Ruben Orta Magan [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 28, 2003 10:56 AM To: Struts Users Mailing List Subject: code generate by validwhen doesn't exists Hello again. I'm fighting with validwhen againi've got the lastest nightly build(jakarta-struts-20031027.zip) and it looks like when you use validwhen validation no javascript code is generated and inserted in the jsp file. If i use this validation definition: The javascript code inserted in my jsp page is: function validateIcytReviForm(form) { if (bCancel) return true; else var formValidationResult; formValidationResult = validateRequired(form); return (formValidationResult == 1); } function required () { this.aa = new Array("tituloRevista", "El título es un campo obligatorio", new Function ("varName", " return this[varName];")); this.ab = new Array("tipoAdquisicion", "El tipo de adquisición es un campo obligatorio", new Function ("varName", " return this[varName];")); } But if I add a new field validation in my validation.xml : test (tituloRevista != null) The javascript code generated is the same! function validateIcytReviForm(form) { if (bCancel) return true; else var formValidationResult; formValidationResult = validateRequired(form); return (formValidationResult == 1); } function required () { this.aa = new Array("tituloRevista", "El título es un campo obligatorio", new Function ("varName", " return this[varName];")); this.ab = new Array("tipoAdquisicion", "El tipo de adquisición es un campo obligatorio", new Function ("varName", " return this[varName];")); } Please someone can help me??? is the validwhen running correctly? is the problem in the definition??? Thanks... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts-config
Download XML Spy (or another good XML tool) and validate it against the DTD. -Original Message- From: Edgar P Dollin [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 4:37 PM To: Struts Users Mailing List Subject: Struts-config Has anyone experienced situtation where struts 1.1 will not allow any configuration items (controller / message-resources / plug-in) after the end of the action-mappings section. The error message is xml.sax.SAXParseException: Element "struts-config" allows no further input; "controller" is not allowed. I have checked the DTD and the position for these elements should follow yet something is upsetting the digester. I have double checked the syntax and made sure it is correct. If anyone has an insight, thanks in advance Edgar - 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]
Eclipse-like web view framework for struts?
I would like to build a web app that functions like a "control panel" with multiple views of data that the user can close, resize, etc. What I keep coming back to is wanting something similar to the Eclipse development environment, where I can pick my views and position them on the screen and have the layout be customizable by the users. Except in a browser, probably using frames and/or iframes. Somewhat like a portal, even, but not exactly. My target browser will be IE only, so I can do lots of cool things, but I don't want to get into active X or anything like that. Purely HTML/CSS browser-based interface. Is there any kind of framework or UI tool which will get me going with this kind of approach? Matt Kruse
RE: Can I use tiles with JSF?
This looks like something similar to what I might be looking for - however, what I really want is to provide an alternative implementation of my app with JSF, JSTL and Tiles - no struts-config.xml or any struts-specific tags. It's just an experiment and I'd like to know if it's possible - no reason to bang my head agains the wall if its not possible. Thanks, Matt -Original Message- From: John Greenhill [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 9:51 AM To: Struts Users Mailing List Subject: RE: Can I use tiles with JSF? These guys give the modifications required to get tiles to work with it, but I haven't tried it... http://www-106.ibm.com/developerworks/library/j-integrate/ -Original Message- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 8:23 AM To: '[EMAIL PROTECTED]' Subject: Can I use tiles with JSF? There seems to be a fair amount of JSF experts on this list, so I'll pose my question here. After read this article (http://tinyurl.com/s23s), I'm got a bit of motivation to try porting one of my apps to use JSF. However, my app uses Tiles heavily and I want to make sure that's still possible. It also uses Struts-Menu and the DisplayTag, and I believe these both should work fine with JSF, but I don't know about Tiles. Any insights? Does JSF have a replacements for Tiles (maybe from JSP 2.0)? 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]
Can I use tiles with JSF?
There seems to be a fair amount of JSF experts on this list, so I'll pose my question here. After read this article (http://tinyurl.com/s23s), I'm got a bit of motivation to try porting one of my apps to use JSF. However, my app uses Tiles heavily and I want to make sure that's still possible. It also uses Struts-Menu and the DisplayTag, and I believe these both should work fine with JSF, but I don't know about Tiles. Any insights? Does JSF have a replacements for Tiles (maybe from JSP 2.0)? Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Displaytag and export: more info
This is a known issue - checkout the displaytag's mailing lists - there's a couple of workarounds in there. http://displaytag.sf.net. HTH, Matt -Original Message- From: Grassi Fabio [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2003 11:23 AM To: [EMAIL PROTECTED] Subject: Displaytag and export: more info Doing some testing it appears that the export function doesn't work when the jsp is inserted in the document via the tag. Is anyone experiencing similar problems? Is anybody using displaytag with tiles? Thanks in advance, Fabio. -Messaggio originale- Da: Grassi Fabio Inviato: mercoledì 22 ottobre 2003 18:00 A: '[EMAIL PROTECTED]' Oggetto: Displaytag and export I'm trying to use the export function of displaytag in a Struts application without success. What I get is the contente of the file to be exported visualized in place of the table. Does anyone have any suggestion? TIA, Fabio. Ai sensi della Legge 675/96, si precisa che le informazioni contenute in questo messaggio sono riservate ed a uso esclusivo del destinatario. Qualora il messaggio in parola Le fosse pervenuto per errore, la preghiamo di eliminarlo senza copiarlo e di non inoltrarlo a terzi, dandocene gentilmente comunicazione. Grazie.This message, for the law 675/96 may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: question on javascript...
>This is a basic question... Can I find the index of a select box, >if I have the value or the text ??? >document.formName.optionName.options["C"].selected=true >-- This won't work!! You need to loop through each option, checking to see it's value and then checking it. var s = document.formname.optionname; for (var i=0; ihttp://www.mattkruse.com/javascript/validations/ you can do: setInputValue(document.formname.optionname,"C"); Be careful - multiple options are allowed to have the same value! Matt Kruse
RE: ActionMessages
Would you be so kind as to send me some example code in which you utilize ActionMessages and the custom tag? I'm having a little difficulty getting mine to work. Thanks, Matt [EMAIL PROTECTED] -Original Message- From: Wiebe de Jong [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 2:13 PM To: Struts Users Mailing List Subject: ActionMessages Today I discovered ActionMessages! I had developed my own bean for doing the same thing in Struts 1.0, but now that ActionMessages are available with Struts 1.1, I have less code to develop and maintain. Thanks guys! Wiebe de Jong http://frontierj.blogspot.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]
Re: Keeping Actions clean - separating actions from businessmodel from persistence
Hi Sasha, sorry it has taken me so long to get back to you. I've been putting a lot of thought into my response, and I would still like to think about the issues here a little more. Specifically, I want to evaluate using the iBATIS DAO layer instead of my own custom DaoManager. I will probably send a follow-up email in a couple weeks. Comments below... - Original Message - From: "Sasha Borodin" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, October 10, 2003 11:32 PM Subject: Re: Keeping Actions clean - separating actions from businessmodel from persistence > What I'm trying to grasp is where it it best for the business object <---> > dao interaction to take place. OK, let's make an example, cause I'm having > trouble thinking abstractly tonight... > > An online store customer selects several products, clicks "check out", which > calls a CheckOutAction. From there: > > 1. The CheckOutAction retrieves a Customer and a List of Product's from the > session; it creates an Order out of those components; it then calls > placeOrder(Order) on a Store business class. > > 2. Store.placeOrder(Order) saves the Order to persistent storage; then uses > an Emailer business class to emailOrderConfirmation(Order). > > --now the question: > > 1. Which component is responsible for discovering the DaoManager, > retrieving the OrderDao from that manager, and telling the dao to save()? > Is it: > a. the Store.placeOrder() method? > -or- > b. the Order business object itself? If you get a copy of the Core J2EE patterns book that someone recommended, then the answer is "well, it depends". If you are using business objects as described in the book, the business object's job is to shield the rest of your application from the underlying persistence mechanism. It could do this using the DaoManager. However, I would still guess that Store.placeOrder() would tell the Order business object when the save needs to take place, and the Order business object would delegate this command to the save() method of the DaoManager. Otherwise the business object knows when to save itself... that sounds to me like a TV knowing when to turn itself on/off ;) > Is it the business entity object's responsibility to discover and use its > dao's, or that object's *user's* responsibility? > > Matt, you seem to forgo business entity classes and create DAO's right in > your action, passing those to business "use case" classes... Yes, that is exactly what I do for the sake of simplicity. The Core J2EE patterns book says that when the data model closely represents the domain model this approach is valid. > Mahesh, your business "use case" components seem to be the ones responsible > for discovering the right DaoManager implementation, and retrieving the > needed DAO classes... > > Anyone make the business entity classes themselves responsible for finding > and using their respective dao's (say, when an Order is issued a save() > command)? > > Thanks for all your input! > > -Sasha > > > On 10/10/03 20:25, "Sgarlata Matt" <[EMAIL PROTECTED]> wrote: > > > I have a 4 tier architecture. > > > > PRESENTATION TIER > > - Struts > > - Action classes > > > > BUSINESS TIER > > - Business Objects > > > > INTEGRATION & PERSISTENCE TIER > > - DAO Manager > > - DAOs > > - Other database access mechanisms (I do some JDBC using a fancy home-grown > > SQL building mechanism when dealing with particularly complex queries) > > > > RESOURCE TIER > > - Databases > > > - > 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]
Difficulty getting html:message tag to work.
Hi, I'm using Struts 1.1, and am attempting to utilize the new ActionMessages class with the tag. I have the following code in my Action class: actionMessages.add("message", new ActionMessage("error.systemAuthentication.failure")); saveMessages(request, actionMessages); With the corresponding tags in my jsp: No message is being rendered in the html page though. I think I'm definitely misunderstanding the concept behing both ActionMessages and htmL:message. Thanks in advance: Matt
Re: Multiple select and string arrays [solved]
Nevermind, I was appending the request parameters in a filter even when posting - causing a duplication in request parameters. I changed my filter to only do this on a "get" and everything seems to be fixed. Matt On 10/14/03 2:05 PM, "Matt Raible" <[EMAIL PROTECTED]> wrote: > I have an and String[] > getters/setters/variables in my Form. For some reason, the selected value > is passed through twice, meaning that if we select "1" in the , "1, > 1" gets passed in. Has anyone seen this behavior. It's highly likely that > this is a result of a filter we're using, but just wanted to put a probe out > in case it's not. Back to investigating > > 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]
Multiple select and string arrays
I have an and String[] getters/setters/variables in my Form. For some reason, the selected value is passed through twice, meaning that if we select "1" in the , "1, 1" gets passed in. Has anyone seen this behavior. It's highly likely that this is a result of a filter we're using, but just wanted to put a probe out in case it's not. Back to investigating Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Poll] Action Form data types
#2, and sometimes #1 - Original Message - From: "Mainguy, Mike" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "Green, Matt" <[EMAIL PROTECTED]> Sent: Monday, October 13, 2003 3:37 PM Subject: [Poll] Action Form data types > Here's my weekly(ish) question: > For the purposes of this discussion, ActionForms also mean DynaActionForms > and the like... > Where does everyone cast their (String) request parameters to the 'proper' > datatype? > > #1 My ActionForms only have Strings, I manually cast stuff somewhere else. > #2 My ActionForms only have Strings, I let (BeanUtils, JDBC,...) cast stuff > for me somewhere else. > #3 My ActionForms have java Datatypes, I let Struts(yeah, beanutils, I > know) cast stuff for me. > #4 I use strings for everything, I don't need to cast. > > - > This message and its contents (to include attachments) are the property of Kmart Corporation (Kmart) and may contain confidential and proprietary information. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on information contained herein is strictly prohibited. Unauthorized use of information contained herein may subject you to civil and criminal prosecution and penalties. If you are not the intended recipient, you should delete this message immediately. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HashMap with options
You might want to investigate using a List of LabelValueBean objects instead. Matt - Original Message - From: "Manav Gupta" <[EMAIL PROTECTED]> To: "Struts Developers (E-mail)" <[EMAIL PROTECTED]> Sent: Friday, October 10, 2003 12:24 PM Subject: HashMap with options > Hi > > Can i use HashMap with options? > > something like: > > type="java.util.HashMap" /> > labelProperty="value"/> > > such that the option value is the key and the labelProperty is the value? > > thanks > M > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Keeping Actions clean - separating actions from businessmodel from persistence
- Original Message - From: "Sasha Borodin" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, October 10, 2003 8:33 PM Subject: Re: Keeping Actions clean - separating actions from businessmodel from persistence > Matt, thanks for your quick feedback. > > > I use my own framework because I don't know any better. > > > > public abstract class DaoManager { > > public abstract IRecordDao createDao(Connection conn, String daoClassName) > > throws DaoException; > > Which tier calls your DaoManager? It seems from your code that the caller > of DaoManager is responsible to knowing the database configuration > information, as well as the implementing DAO class. Is it the Action? I have a 4 tier architecture. PRESENTATION TIER - Struts - Action classes BUSINESS TIER - Business Objects INTEGRATION & PERSISTENCE TIER - DAO Manager - DAOs - Other database access mechanisms (I do some JDBC using a fancy home-grown SQL building mechanism when dealing with particularly complex queries) RESOURCE TIER - Databases In addition to the 4 tiers, my applications are separated into two parts. One part is a reusable framework that is shared among many applications. The second part is the actual application code that is specific to a single application because of business rules, etc. (Even if you don't need a reusable framework for your work, such a thing can be useful because it allows you to do things like swap out your persistence mechanism without disturbing your presentation code and business objects) A single Abstract Factory (informally called Walmart) is responsible for creating the DAO manager and the business objects in the reusable framework. The application code must define a concrete implementation of the Abstract Factory. This implementation must know how to create a DAO Manager that works with the persistence mechanism being used. So, to finally get around to answering your question, the caller of the DAO manager does not need to know anything about the persistence mechanism used. The DAO manager's job is to hide this information from its clients. True, the application code does need to provide the implementation of the Abstract Factory and an implementation of the DAO manager. However, since the DAO manager is an abstract class, its clients can rely only on the API of the DAO manager rather than relying on the API of the underlying persistence mechanism. Thus the clients of the DAO manager need not know anything about the persistence mechanism being used. So even though the application does have to specify what persistence mechanism is used and how to interact with that mechanism, that definition is in *one place* which means that it can be changed if need be without impacting the business objects. > In other words, who orchestrates the interaction of business and dao > classes? Does the action instantiate a business class and populate it from > your ActionForm, then get a dao instance from a factory, and pass it the > business class? Or is there another pattern to this? The exact interactions among the components of course depend on the business rules. A typical use case is that the Action class creates a few DAOs based on information in the request and then passes those DAOs to one of the business objects. The business objects may in turn retrieve other DAOs, create DAOs, or even return DAOs to the Action class for further processing by another business object. Well that was rather long-winded... did I answer your question or go off on a useless tangent? ;) Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Keeping Actions clean - separating actions from business modelfrom persistence
I use my own framework because I don't know any better. I am using Torque as my underlying persistence mechanism, and I have introduced a very simple level of indirection that I think should keep me independent of Torque in the future (I plan to swap in Hibernate or OJB on the next app I work on). The level of indirection I introduced is encapsulated in an object I call the DaoManager. The DaoManager is created by a Factory class that gives me an instance of the DaoManager that works for my particular application. Right now my Factory is creating a DaoManager that works with Torque, but in the future it will create one that works with Hibernate or OJB. (More info on the Factory pattern is in the Gang of Four book, not the J2EE core patterns book someone recommended to Sasha earlier today). public interface IRecordDao { public BigDecimal getId(); public void setId(BigDecimal id); } public abstract class DaoManager { public abstract IRecordDao createDao(Connection conn, String daoClassName) throws DaoException; public abstract IRecordDao getDao(Connection conn, String daoClassName, BigDecimal id) throws DaoException; public abstract void saveDao(Connection conn, IRecordDao record) throws DaoException; public abstract void removeDao(Connection conn, String daoClassName, BigDecimal id) throws DaoException; } As you may have noticed, this technique introduces the constraint that each DAO must have a single numeric primary key. This is not an onerous constraint, but may be an issue in an existing database where introducing surrogate keys would cause problems. I am interested in this topic so I may do some research this weekend to see if I can think of a better way than I am currently using. I don't know if there's a better list to discuss this type of thing... so far this seems to be a pretty good one :) You might want to prefix your messages with [OT] (off-topic) if you aren't sure if they are appropriate for the list. Matt - Original Message - From: "Sasha Borodin" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, October 10, 2003 6:44 PM Subject: Keeping Actions clean - separating actions from business modelfrom persistence > Ted, Matt, Joe, and all the other helpful folks that chimed in earlier on > persistence mechanisms: > > In trying to keep with best practices, I've managed to remove all "model" > related code (business logic, and persistence) out of the Actions' execute() > method. Now I'd like to take it one step further and decouple the business > model classes from the implementing persistence technology (btw, settled on > OJB for now :). From Joe's post, it seems like the DAO pattern is called > for to accomplish this. > > My (slightly off topic) question is this: who develops their own DAO > framework (like the dao and dao factory interfaces), and who uses a 3rd > party framework (like iBATIS's Database Layer) and why? There was something > mentioned about the discovery of the persistence mechanism as well... > > Any references to webpages/books would be appreciated. > > BTW, I've been shamelessly posting to this list questions that are probably > better directed elsewhere. What would be a more appropriate list? > > Thank you, > > -Sasha > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT]Keel
I'm interested in Keel also. I heard Joe Germuska collectively call the following products 'microkernels': Hivemind http://jakarta.apache.org/commons/sandbox/hivemind/ Keel http://keelframework.org/ Spring http://www.springframework.org/ PicoContainer http://www.picocontainer.org/ I've only done a little research so far but of these four I am interested in all except PicoContainer (sorry Vic). PicoContainer's documentation is incomprehensible to me. All products seem to be near a 1.0 but I don't think any of them are quite there yet. Matt - Original Message - From: "Butt, Dudley" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, October 10, 2003 10:31 AM Subject: [OT]Keel > Hi anyone tried Keel out yet? > Reason why I'm asking here is because this mailing list is so active... > > > NOTICE: > > This message contains privileged and confidential information intended > only for the person or entity to which it is addressed. > Any review, retransmission, dissemination, copy or other use of, or > taking of any action in reliance upon this information by persons or > entities other than the intended recipient, is prohibited. > > If you received this message in error, please notify the sender > immediately by e-mail, facsimile or telephone and thereafter delete the > material from any computer. > > The New Africa Capital Group, its subsidiaries or associates do not > accept liability for any personal views expressed in this message. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: tiles-defs.xml and dynamic page titles: how to do?
You could use a Tiles controller to the "title" attribute from the TilesContext and append the customer name. HTH, Matt -Original Message- From: PhilNoon [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:30 AM To: [EMAIL PROTECTED] Subject: tiles-defs.xml and dynamic page titles: how to do? I am using tiles. I define the title of a web page in tiles-defs.xml as in this snippet: Then in my jsp, I have: Which outputs "Customer Consignment Note" as expected. Now my client wants the title to read "Consignment Note for " where is the customer's name. Does anyone have an idea how to do this? - 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: JavaServer Faces
I watched a presentation on JSF last night. Here's my high-level impressions: 1. It's a replacement for Struts (no matter what folks say). 2. It's basically Swing for the Web. 3. It's more difficult than Struts. Basically, I'm not impressed. I think they're going to have do a lot to make it easier to learn and easier to develop with. It seems that a lot of "Experts" are touting that it'll be easy to develop because it's a *standard* and IDEs will support it. I'll believe it when I see it considering I still use HTML editors to edit JSPs and JSTL (because Homesite is still the best JSP editor IMO). Read more at http://tinyurl.com/qbyk. These are just my opinions - so take them with a grain of salt. Matt -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 08, 2003 6:58 PM To: Struts Users Mailing List Subject: Re: JavaServer Faces It's not an either/or decision. http://jakarta.apache.org/struts/faqs/kickstart.html#jsf Though, Struts is superior in the sense you can use it in a shipping application. JSF is still in early release. HTH, Ted. Horky Adam G A1C 805 CSPTS/SCBE wrote: > Does anyone know enough about Struts and JavaServer Faces to provide an > opinion about the superiority of one over the other? > > > > A1C Adam G Horky > > Application Development Programmer, SCBE > > (618)256-2300 - 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: Container-Managed Authentication in web.xml vs . Specifying Paths in the struts-config.xml
Don't put anything in struts-config, in web.xml, put: FORM /login.jsp /login.jsp?error=true You can use whatever code you like in login.jsp, here's mine as an example: <%@ include file="/common/taglibs.jsp"%> So you can see it uses Tiles - here's my .login definition: Where /pages/login.jsp is: <%@ include file="/common/taglibs.jsp"%> *: *: HTH, Matt -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 07, 2003 2:11 PM To: Struts Users Mailing List Subject: Re: Container-Managed Authentication in web.xml vs . Specifying Paths in the struts-config.xml People answer questions without reading my original post. Therefore, I must re-type my original question again. Before I posted my question, I had configured the Tomcat JDBCRealm following the instructions at http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html so that I can do security testing programmically, such as isUserInRole(), in my program. If I use form based authentication, I insert the and its sub-elements in my web.xml file (see below). As we know, the and are required. My question is that the container-managed authentication (we provide login page and error page in the web.xml) does not seem to be consistent with what we usually do in struts; e.g. we state the logical name and path for each .jsp page in the struts-config.xml file. What is the Struts convention in dealing with user authentication? Should we specify the paths for the logon page and error page in the struts.config.xml or we should use the and in the web.xml file? Thanks. --- "Craig R. McClanahan" <[EMAIL PROTECTED]> wrote: > Caroline Jen wrote: > > >But, I do not want to use BASIC authentication. I > >have many different roles and hundreds of people > per > >role. Users' name, role, etc. are stored in a > >database. > > > How authentication is performed (BASIC, form-based, > DIGEST, or SSL > client certificates) and how users are stored > (database, directory > server, local XML file, ...) are two separate > questions. For most > servers , any combination is possible. With Tomcat, > for example, you > can configure JDBCRealm to point at your user and > role definitions in a > database, and then use those users with any of the > authentication > methods. For more information, see: > > > http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html > > The choice between BASIC and form-based > authentication, then, can be > based on user interface related concerns, rather > than worrying about a > database. > > Craig > > >--- Matt Raible <[EMAIL PROTECTED]> wrote: > > > > > >>A JDBCRealm can use BASIC authentication - it > >>doesn't require form-based. > >>Here's an example app that might help you out: > >> > >> > >> > >> > >http://raibledesigns.com/wiki/Wiki.jsp?page=SecurityExample > > > > > >>HTH, > >> > >>Matt > >> > >>-Original Message- > >>From: Caroline Jen [mailto:[EMAIL PROTECTED] > >>Sent: Monday, October 06, 2003 4:45 PM > >>To: [EMAIL PROTECTED] > >>Subject: Container-Managed Authentication > >> in web.xml vs. > >>Specifying Paths in the struts-config.xml > >> > >> > >>I use the Tomcat. I configured the Tomcat > JDBCRealm > >>so that I can use programmic security testing, > such > >>as > >>isUserInRole(), in my program. > >> > >>Because Tomcat JDBCRealm is form based, I inserted > >>the > >> and its sub-elements in my web.xml > >>file > >>(see below). As we know, the > and > >> are required. > >> > >>My question is that the container-managed > >>authentication does not seem to be consistent with > >>what we usually do in struts; e.g. we state the > >>logical name and path for each .jsp page in the > >>struts-config.xml file. > >
RE: Container-Managed Authentication in web.xml vs . Specifying Paths in the struts-config.xml
A JDBCRealm can use BASIC authentication - it doesn't require form-based. Here's an example app that might help you out: http://raibledesigns.com/wiki/Wiki.jsp?page=SecurityExample HTH, Matt -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2003 4:45 PM To: [EMAIL PROTECTED] Subject: Container-Managed Authentication in web.xml vs. Specifying Paths in the struts-config.xml I use the Tomcat. I configured the Tomcat JDBCRealm so that I can use programmic security testing, such as isUserInRole(), in my program. Because Tomcat JDBCRealm is form based, I inserted the and its sub-elements in my web.xml file (see below). As we know, the and are required. My question is that the container-managed authentication does not seem to be consistent with what we usually do in struts; e.g. we state the logical name and path for each .jsp page in the struts-config.xml file. What is the Struts convention in dealing with user authentication? Should we specify the paths for the logon page and error page in the struts.config.xml or we should use the and in the web.xml file? == SalesInfo /SalesInfo/* GET POST manager NONE FORM /authentication/login.html /authentication/error.html manager __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.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]
RE: Help with StrutsTestCase examples and usage.
Yes, all my junit tests (including cactus) depend on a db-load task that uses DBUnit. As far as logging in before running your test (the j_security_check) that should work - at least it sounds like it should. You can check out my build.xml file (http://tinyurl.com/pwqt) for AppFuse or download the whole project (http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse) to see how I'm doing it. Matt -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2003 11:56 AM To: Struts Users Mailing List Subject: Re: Help with StrutsTestCase examples and usage. So, do you kick off DBUnit at the beginning and end of your testing? I am running ant for my junit, and am trying to set my tests up correctly. I also saw the j_security_check example on your site. Can I just run that check as the init() of my tests with CactusTestCases? --- Thanks Mick Knutson The world is a playground...Play Hard, Play Smart. Visit http://www.YourSoS.com to learn how our "Personal Emergency Alert & Contact System" can help you Play Smart. +00 1 (877) SoS-9119 +00 1 (708) 570-2772 Fax --- - Original Message - From: "Matt Raible" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Monday, October 06, 2003 10:45 AM Subject: RE: Help with StrutsTestCase examples and usage. > I use DBUnit to ensure that the database is in a repeatable state. Cactus > does support container managed authentication, but I don't think it's in a > released version yet. > > Here's my tests that prove it works: > > public void beginFormAuthentication(WebRequest theRequest) { > theRequest.setRedirectorName("ServletRedirectorSecure"); > theRequest.setAuthentication(new FormAuthentication(rb.getString( > "username"), rb.getString("password"))); > } > > /** > * Test logging in as user a user > */ > public void testFormAuthentication() { > assertEquals(rb.getString("username"), > request.getUserPrincipal().getName()); > assertEquals(rb.getString("username"), request.getRemoteUser()); > assertTrue("User not in '" + rb.getString("role") + "' role", > request.isUserInRole(rb.getString("role"))); > } > > Where "rb" is a properties file for my test. > > HTH, > > Matt > -Original Message- > From: Mick Knutson [mailto:[EMAIL PROTECTED] > Sent: Monday, October 06, 2003 11:45 AM > To: Struts Users Mailing List > Subject: Re: Help with StrutsTestCase examples and usage. > > > How do you handle Database updates with these type of tests? > I have MySql and do not have inoDB support yet. So I need to ensure the DATA > is in a repeatable state. This is why I was starting with Mock tests > instead. > > Not to mention, I use JAAS Container authentication, so wouldn't that > interfere with the tests? I thought that Cactus did not yet support testing > through container managed security, and my actions are all in a secured area > requiring authentication. > > > --- > Thanks > Mick Knutson > > The world is a playground...Play Hard, Play Smart. > Visit http://www.YourSoS.com to learn how our "Personal Emergency Alert & > Contact System" can help you Play Smart. > > > +00 1 (877) SoS-9119 > +00 1 (708) 570-2772 Fax > --- > > - Original Message - > From: "Matt Raible" <[EMAIL PROTECTED]> > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> > Sent: Monday, October 06, 2003 10:29 AM > Subject: RE: Help with StrutsTestCase examples and usage. > > > > Here's an in-container StrutsTestCase: > > > > http://tinyurl.com/pwkp > > > > HTH, > > > > Matt > > > > -Original Message- > > From: Mick Knutson [mailto:[EMAIL PROTECTED] > > Sent: Monday, October 06, 2003 11:29 AM > > To: struts > > Subject: Help with StrutsTestCase examples and usage. > > > > > > I am having issues with getting StrutsTestCase to work. I have several > > actions that I am checking for a given ActionForward, but the Forward is > not > > what was expected. However, it does not tell me what Forward was received. > > > > Also, when there is an error returned, I keep getting "Error was returned, > > but no message was found". I am using message keys, and checking for them, > > but none exist. And I am not told what error type was thrown, and why > there > > are no messages, or if there were any other messages. &
RE: Help with StrutsTestCase examples and usage.
I use DBUnit to ensure that the database is in a repeatable state. Cactus does support container managed authentication, but I don't think it's in a released version yet. Here's my tests that prove it works: public void beginFormAuthentication(WebRequest theRequest) { theRequest.setRedirectorName("ServletRedirectorSecure"); theRequest.setAuthentication(new FormAuthentication(rb.getString( "username"), rb.getString("password"))); } /** * Test logging in as user a user */ public void testFormAuthentication() { assertEquals(rb.getString("username"), request.getUserPrincipal().getName()); assertEquals(rb.getString("username"), request.getRemoteUser()); assertTrue("User not in '" + rb.getString("role") + "' role", request.isUserInRole(rb.getString("role"))); } Where "rb" is a properties file for my test. HTH, Matt -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2003 11:45 AM To: Struts Users Mailing List Subject: Re: Help with StrutsTestCase examples and usage. How do you handle Database updates with these type of tests? I have MySql and do not have inoDB support yet. So I need to ensure the DATA is in a repeatable state. This is why I was starting with Mock tests instead. Not to mention, I use JAAS Container authentication, so wouldn't that interfere with the tests? I thought that Cactus did not yet support testing through container managed security, and my actions are all in a secured area requiring authentication. --- Thanks Mick Knutson The world is a playground...Play Hard, Play Smart. Visit http://www.YourSoS.com to learn how our "Personal Emergency Alert & Contact System" can help you Play Smart. +00 1 (877) SoS-9119 +00 1 (708) 570-2772 Fax --- - Original Message - From: "Matt Raible" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Monday, October 06, 2003 10:29 AM Subject: RE: Help with StrutsTestCase examples and usage. > Here's an in-container StrutsTestCase: > > http://tinyurl.com/pwkp > > HTH, > > Matt > > -Original Message- > From: Mick Knutson [mailto:[EMAIL PROTECTED] > Sent: Monday, October 06, 2003 11:29 AM > To: struts > Subject: Help with StrutsTestCase examples and usage. > > > I am having issues with getting StrutsTestCase to work. I have several > actions that I am checking for a given ActionForward, but the Forward is not > what was expected. However, it does not tell me what Forward was received. > > Also, when there is an error returned, I keep getting "Error was returned, > but no message was found". I am using message keys, and checking for them, > but none exist. And I am not told what error type was thrown, and why there > are no messages, or if there were any other messages. > > So, if anyone has any Mock examples other than login examples, I would love > to see how others are testing there Actions. > > --- > Thanks > Mick Knutson > > The world is a playground...Play Hard, Play Smart. > Visit http://www.YourSoS.com to learn how our "Personal Emergency Alert & > Contact System" can help you Play Smart. > > > +00 1 (877) SoS-9119 > +00 1 (708) 570-2772 Fax > --- > > - > 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]