Re: colection use in html:options and logic:iterate
Or put better from the index of the javadoc setCollection(Object) - Method in class org.apache.struts.taglib.EnumerateTag Set the collection over which we will be enumerating. setCollection(Object) - Method in class org.apache.struts.taglib.IterateTag Set the collection over which we will be iterating. setCollection(Object) - Method in class org.apache.struts.taglib.bean.SizeTag setCollection(Object) - Method in class org.apache.struts.taglib.logic.IterateTag setCollection(String) - Method in class org.apache.struts.taglib.html.OptionsTag Spot the odd one out. At 02:55 PM 7/06/01 +1000, you wrote: Why does logic:iterate/ use a collection as A runtime expression that evaluates to a collection to be iterated over. and html:options Name of the JSP bean (in some scope) which is itself a Collection of other beans, each of which has properties named by the property and labelProperty attributes that are used to retrieve the value and label for each option, respectively. [RT Expr] effective, if I use logic:iterate I can do (something like) this logic:iterate id=template collection=%= (SortedMap) application.getAttribute(\template\)).getEntries() % /logic:iterate which is really handy, but for html:options I have to do % pageContext.setAttribute(catalog, myCatalogCollection); % html:select property=catalog_id html:options collection=catalog property=value.id labelProperty=value.description/ /html:select I'd rather have in the middle html:options collection=%= catalog % property=value.id labelProperty=value.description/ or similar, like I can do with iterate. -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html
Re: cvs commit: jakarta-struts/src/share/org/apache/struts/action ActionServlet.java
Man I love open source ... Modified:src/share/org/apache/struts/action ActionServlet.java Log: Allow initDataSources() to throw ServletException like the other initialization methods do, to indicate a fatal initialization error. PR: Bugzilla #1672 Submitted by: Jim Richards [EMAIL PROTECTED]
html:options collection attribute
I'm not if this has ben pointed out before (way too much email at the moment) but I find that the html:options tag has some discrepency in the collection attribute. At the moment I do this: % pageContext.setAttribute(catalog, ((SystemManager) application.getAttribute(SystemManager.THIS)).getCatalog(skill_catalog_user_years).entrySet()); % html:select property=%= \skillTree.skill[\ + ((SkillEntry) ((Map.Entry) entry).getValue()).getParentId() + \].entry[\ + ((SkillEntry) ((Map.Entry) entry).getValue()).getSkillId() + \].years\ % html:options collection=catalog property=value.id labelProperty=value.description/ /html:select Sorry about the long property value, I have fairly heavily nested structures at the moment, (A subject for a longer email). I would expect the html:options collection to be more like the logic:iterate collection and take something like html:options collection=%= some collection here % property=value.id labelProperty=value.description/ so I didn't have to set a pageContext as I do now before the html:select tag. Any comments? -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html
Re: Form population
I think this is how I might have to treat my code. It's a shame really because I've got a good connection between my forms being dynmically built at the data beans the data comes from. For something like dates though, I'll use some funky JavaScript to handle the formating. Dmitri Plotnikov wrote: I don't know if my understanding of the purpose of ActionForm is correct, but I have been treating them as part of the View. Hence I have been designing the APIs of ActionForm with the needs of the JSP(s) in mind. For example, all attributes bound to text fields are declared as Strings. My ActionForms function as adapters to the model JavaBeans and EJBs, they are responsible for necessary type convertions. For example, field "dateOfBirth" is always declared as String on the ActionForm, but as Date on the model bean. An action method (e.g. "save()") pushes data into the model, converting types as needed. When my ActionForm needs nested objects, I create new, UI-oriented classes for those as well. If my understanding of the role of ActionForms is right, no enhancement of the form population mechanism is needed.
Re: Form population
I'm pretty sure it was all as expected. Although I find it interesting that it works with "int" rather then "Integer", from what I saw of the code. I've changed it all the String and it works now, but I was poking around in BeanUtils and PropertyUtils and so on (don't have the reference here) and it seems that for nested properties it only handles a String (haven't fully checked it yet). "Natra, Uday" wrote: yeah that was a good point from Dmitri. I tried to define two setter methods for my date field. one is a String argument and the other one is a date argument. When I ran the App, it complained about not able to find the setter method. So may be there is some thing like that happening in ur code. Thanks, Uday.
Form population
I've been having a dig around, and have found that the BeanUtils.populate doesn't really handle very many datatypes. Or more specifically, I can't get it to set an integer value, where my bean has public void setKey(int key); or public void setKey(Integer key); neither get called. What I am finding is the BeanUtils only finds String values when it process the results of the form, and so thinks all the setter methods are Strings as well. There doesn't seem anyway to force the html:text/ tag to be an Integer value. I can understand why the first won't work (non-object type), but not the second. Any suggestions, or this is a feature/bug? -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html
RE: Form population
What sort of field on the form is it (not that it should matter)? a html:text or something else. And is it a "Integer" or "int" for the setter? I'm using it as a nested property as well, so the jsp looks like html:text property="user.key" size="20" maxlength="80"/ But I couldn't see anything in the code that would cause a problem with this. At 11:36 AM 15/04/01 -0500, you wrote: It does work for me. I use a setter method with an integer argument in my FormBean and FormBean invokes that method to change the data. Thanks, Uday. -Original Message- From: Jim Richards [mailto:[EMAIL PROTECTED]] Sent: Sunday, April 15, 2001 2:28 AM To: [EMAIL PROTECTED] Subject: Form population I've been having a dig around, and have found that the BeanUtils.populate doesn't really handle very many datatypes. Or more specifically, I can't get it to set an integer value, where my bean has public void setKey(int key); or public void setKey(Integer key); neither get called. What I am finding is the BeanUtils only finds String values when it process the results of the form, and so thinks all the setter methods are Strings as well. There doesn't seem anyway to force the html:text/ tag to be an Integer value. I can understand why the first won't work (non-object type), but not the second. Any suggestions, or this is a feature/bug? -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html
Re: Window Resize == Form Submit?
At 09:46 AM 13/04/01 -0400, you wrote: I have a general question being new to struts...I am starting on a project that is currently using the struts framework. I have noticed that every JSP page will actually do a form submit everytime I resize my browser window?? Is this something that is related/known to the struts framework, or is it something in the application itself (jsp pages)? It depends on the browser. This is not a struts feature but (and I think) a netscape feature. Because a page built by a form submit is usually dynamic, netscape re-requests the page so it can build it again, whereas IE will cache the output, as it can resize visually as you move the window border. This can also affect DHTML quite badly. -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html
Re: development issues
In Dec-2000 issue of Javaworld, there was an article by "Thor Kristmundsson" about enhancing Struts framework with regex validation and automatic properties. Though the article is outdated due to recent development in Struts but I liked the idea and spent some time implementing it. I'm not keen of using regex for the validation of form fields, as I find them too limiting. There are somethings you just can't do with regex that a general bit of coding can handle (eg, credit card validation and good date checking). -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html
RE: development issues
But its not bad either for basic form validation (null, range checks like) and much better than using Javascript. I dont think any backend will rely upon JSP validation and wont perform its own tests prior to saving the data. Well, one of the 1.1 discussions is client side validation using JavaScript, which as of JavaScript1.2 has regext facilties built in, so I'd expect they'd be used. But that stops older browsers from working. But as you point out, server side validation should be done as well to correctly check the data against a greater number of tests. -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html
Re: Upload Field Repopulation
It's a security precaution that browser developers put in. Otherwise I could have a 1 pixel frame with a file upload field with /etc/password or c:\windows\*.acl in it that uploads automatically with a document.form[1].submit() at the end. Nick Pellow wrote: I am just curious why the html:file / field does not get repopulated when the page is redisplayed after a validation error? Is it to do with the multipart request?
Re: missing onmousexxx attributes of img tag in struts-html.tld
At 10:38 AM 19/02/01 +0100, Christophe Thibaud wrote: the onmouseover, onmousedown, etc. attributes of the tag img, class org.apache.struts.taglib.html.ImgTag, seem to be missing from the struts-html.tld file. Those particular events are generally handed with an anchor tag around the img tag. Thanks for the answer. The anchor will be fine for me. Internet explorer handles those events for almost any element within a page. Netscape Navigator haowever does not. So, yes wrap it with an anchor tag. -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html
Re: [VOTE] Struts 1.0-beta-1 Release Plan
I still have an outstanding issue with database connection with PostgreSQL that effective cripples the system. I've posted about it to the users mailing list, and didn't put it into the bug system (silly me). I won't have time before the vote closes to log the bug. Any suggestions? "Craig R. McClanahan" wrote: Now that the TODO list for 1.0 (and the bug reports in Bugzilla) are dwindling away, it's time for a 1.0-beta-1 release of Struts! I just checked in an initial draft of a release plan that talks about what will happen, and the criteria for release. Please take a moment to review this document: http://jakarta.apache.org/struts/release-plan-1.0b1.html and vote on your acceptance of this plan. Release plans must pass by a majority vote of committers on the project, but all other interested parties are welcome to cast their votes (and/or make comments or suggestions on the plan) as well. Craig McClanahan