Re: Remembering form values across requests
Hmmm I would think that html:reset would tie into the Form.reset() method, but you said you are using a DynaForm so I'm not sure how that would work (I hard code all my forms because I like wasting time :) Michael Weaver wrote: I am new to Struts and have tried to used a DynaActionForm to hold the users form choices across requests by setting the form to session scope. This causes a problem with html:reset since I get back the same values on reset and in effect nothing is reset. I could be committing a big design no no here. Maybe I should be using a different bean to hold the form choices across requests but it seems redundant. Any thoughts on if this is a misuse of forms or not would be appreciated. If someone can point out a repository of programs demonstrating good Struts usages that would be helpful also. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Array (or List, or Map) Validation
My solution to highlight error fields was to create a custom tag which checks if the property associated with the tag has an error in the ActionErrors object - other than the tag I use the standard struts validation - nothing extra required in the Actions. Source code is here: http://www.niallp.pwp.blueyonder.co.uk/#errortag Niall - Original Message - From: "Domingo A. Rodriguez S." <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Saturday, May 01, 2004 2:26 AM Subject: Re: Array (or List, or Map) Validation > > my problem.. > > I have a list-backed actionform... > That list can have more than one locationObject javabean... > The locationObject javabean has some fields, including an errorFormat > field.. > That errorFormat field can be set using a mutator method from the javabean > called setErrorFormat("BACKGROUND:#00;COLOR:#FF;").. > I am not using the validate method of the actionForm.. > > my solution.. > from inside an Action I do the following.. > > LocationObjectForm lof= (LocationObjectForm)form; > LDHelper ldh= LDHelper(); > LocationObject lob= new LocationObject(); > List locations= lof.getLocations(); > Iterator cnt= locations.iterator(); > boolean isDirty= false; > while(cnt.hasNext()){ > lob= (LocationObject)cnt.next(); > if(!ldh.validateRecord(lob.getCompareField1, lob.getCompareField2)){ > // if the record is not correct, > // then i set the errorformat css style > lob.setErrorFormat("BACKGROUND:#00;COLOR:#FF;"); > isDirty= true; > }else{ > // i dont want any error format for good records.. > lob.setErrorFormat(""); > } > > // put the checked list back to the session > req.getSession().setAttribute("locations", locations); > > if(isDirty){ > // forwarded to the same page or tile definition.. > // just to refresh and show the error style where needed.. > return map.findForward("refreshThisDefinition"); > } > // if there is no problem then jump to the next definition or page.. >return map.findForward("nextDefinition"); > } > > then.. in the page where i display the records.. > > > > <% > List locations= locationform.getLocations(); > LocationObject lob= locations.get( cnt.intValue() ); > String estilo= lob.getErrorFormat(); > %> > > > > > > > > > > > > > > > Using this I accomplished one of my latest tasks.. :) I highlight the > incorrect records, so the users will see their errors easier. > > Atte. > Domingo A. Rodriguez S. > > --- Niall Pemberton <[EMAIL PROTECTED]> escribió: > To > make this kind of feature useful there needs to be some way of > > indicating > > which occurance of the "indexed" property is in error. So, for example, > > if > > you had a bunch of "order" beans and were validating the order value I > > would > > want to be able to output a message along the lines of... > > > >"Order value for order number 12345 is invalid" > > or > >"Order value on line 5 is invalid" > > > > ... where order number or line number are other properties from the bean > > being validated. Otherwise if you had 20 errors on order value then you > > just > > get 20 indetical messages along the lines of "Order value is invalid" - > > which isn't very useful. > > > > I looked at trying to do this in the current validator but can't see how > > to - have a missed something or am I right and its not possible? > > > > This is an issue for me with the existing functionality where it stops > > on > > the first indexed field in error - we got round it by outputing a > > message > > which doesn't indicate which indexed occurance is in error, but by > > highlighting the field in error, which works reasonably well. > > > > That also would be another type of solution, validate all the indexed > > properties, only show one generic message but highlight all the fields > > in > > error. > > > > I'd be happy if someone would either put me right on this, or say how > > they > > dealt with this scenario. > > > > Niall > > > > > > - Original Message - > > From: "Robert Leland" <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > Sent: Friday, April 30, 2004 1:12 AM > > Subject: Re: Array Validation > > > > > > > > -Original Message Slightly rearranged - > > > > From: Glenn, Scott [mailto:[EMAIL PROTECTED] > > > > > > > > If there are any Struts developers listening can you explain this .. > > is > > it a > > > > bug or by design? > > > > > > Doesn't matter. What matters is that it's not the behavior you need > > right > > ? > > > If someone would like to develop and test a patch that adds an option > > to: > > > A) The XML element in the struts-config.xml > > > This would change the default behavior to not stop validating on > > an > > > error for a given module. > > > or > > > B) The Validator.xml itself, which would require a change to the > > > validator.dtd, either to: > > > B1) The f
Re: Can I specify DynaFormProperties at Run Time
I developed LazyDynaBean and LazyDynaClass (which implements MutableDynaClass) which don't need their properties to be pre-defined. I have also used them to create LazyValidatorForm which is a version of DynaValidatorForm backed by a LazyDynaBean. All thats needed in the struts-config.xml is: Source Code is here: http://www.niallp.pwp.blueyonder.co.uk Niall - Original Message - From: "Joe Germuska" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, April 30, 2004 6:54 PM Subject: Re: Can I specify DynaFormProperties at Run Time > At 8:24 AM -0700 4/30/04, Steve Lewis wrote: > >Given that the Dynaform is dynamic I am wondering why I need to > >declare a dynaform and list its properties in struts-config. I would > >prefer to have my action populate a form adding properties that it > >knows without having to declare the form in struts-config. > >1) Is this possible > >2) If so how do you do that? > >3) Is anyone doing this? > > It's difficult to do because of the process by which dynabeans are > defined and managed. One of my colleagues worked on a project where, > in one case, form fields were defined by database data. We > implemented this with a PlugIn which, at initialization time, > registered its own dynaforms using the static > DynaActionFormClass.createDynaActionFormClass() method. Even this, > then, isn't truly dynamic, but that's part of how DynaActionFormClass > is designed. > > I think that we should steer Struts to having one or more ActionForm > factories which can produce forms in more flexible ways. I don't > have any specific design ideas in mind, but I've seen how annoying it > is to get instances of DynaForms (for example, if you want to prefill > a form), as well as the use case we're discussing right now. > > As always, I encourage interested Struts users to grab the source > code and wrap their heads around how Struts works, possibly coming up > with specific suggestions on how things can be improved (and perhaps > even patches!) -- the more minds the better... > > A simpler solution might be to simply declare a DynaActionForm which > has a single mapped property. You could probably get a good bit of > what you need there with less investment. > > 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: Array (or List, or Map) Validation
my problem.. I have a list-backed actionform... That list can have more than one locationObject javabean... The locationObject javabean has some fields, including an errorFormat field.. That errorFormat field can be set using a mutator method from the javabean called setErrorFormat("BACKGROUND:#00;COLOR:#FF;").. I am not using the validate method of the actionForm.. my solution.. from inside an Action I do the following.. LocationObjectForm lof= (LocationObjectForm)form; LDHelper ldh= LDHelper(); LocationObject lob= new LocationObject(); List locations= lof.getLocations(); Iterator cnt= locations.iterator(); boolean isDirty= false; while(cnt.hasNext()){ lob= (LocationObject)cnt.next(); if(!ldh.validateRecord(lob.getCompareField1, lob.getCompareField2)){ // if the record is not correct, // then i set the errorformat css style lob.setErrorFormat("BACKGROUND:#00;COLOR:#FF;"); isDirty= true; }else{ // i dont want any error format for good records.. lob.setErrorFormat(""); } // put the checked list back to the session req.getSession().setAttribute("locations", locations); if(isDirty){ // forwarded to the same page or tile definition.. // just to refresh and show the error style where needed.. return map.findForward("refreshThisDefinition"); } // if there is no problem then jump to the next definition or page.. return map.findForward("nextDefinition"); } then.. in the page where i display the records.. <% List locations= locationform.getLocations(); LocationObject lob= locations.get( cnt.intValue() ); String estilo= lob.getErrorFormat(); %> Using this I accomplished one of my latest tasks.. :) I highlight the incorrect records, so the users will see their errors easier. Atte. Domingo A. Rodriguez S. --- Niall Pemberton <[EMAIL PROTECTED]> escribió: > To make this kind of feature useful there needs to be some way of > indicating > which occurance of the "indexed" property is in error. So, for example, > if > you had a bunch of "order" beans and were validating the order value I > would > want to be able to output a message along the lines of... > >"Order value for order number 12345 is invalid" > or >"Order value on line 5 is invalid" > > ... where order number or line number are other properties from the bean > being validated. Otherwise if you had 20 errors on order value then you > just > get 20 indetical messages along the lines of "Order value is invalid" - > which isn't very useful. > > I looked at trying to do this in the current validator but can't see how > to - have a missed something or am I right and its not possible? > > This is an issue for me with the existing functionality where it stops > on > the first indexed field in error - we got round it by outputing a > message > which doesn't indicate which indexed occurance is in error, but by > highlighting the field in error, which works reasonably well. > > That also would be another type of solution, validate all the indexed > properties, only show one generic message but highlight all the fields > in > error. > > I'd be happy if someone would either put me right on this, or say how > they > dealt with this scenario. > > Niall > > > - Original Message - > From: "Robert Leland" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Friday, April 30, 2004 1:12 AM > Subject: Re: Array Validation > > > > > -Original Message Slightly rearranged - > > > From: Glenn, Scott [mailto:[EMAIL PROTECTED] > > > > > > If there are any Struts developers listening can you explain this .. > is > it a > > > bug or by design? > > > > Doesn't matter. What matters is that it's not the behavior you need > right > ? > > If someone would like to develop and test a patch that adds an option > to: > > A) The XML element in the struts-config.xml > > This would change the default behavior to not stop validating on > an > > error for a given module. > > or > > B) The Validator.xml itself, which would require a change to the > > validator.dtd, either to: > > B1) The form definition, so the behavior could be changed on a > > per form basis. > > The Option (whenInvalid ? ) would probably have four possible > > values. [stop, inherit, all]. > > stop = This is the current default behavior > > go = This is the behavior you want, where it doesn't > stop > >at the first error but attempts to validate all > data. > > inherit = This would inherit the behavior from the parent > form. > > This assumes using Validator 1.2 which has a > > validator form inheritance. > > module = Defers to what the modules default behavior is, > > assuming that option A) is also implemented. > > or > > B2) The validator definition
Remembering form values across requests
I am new to Struts and have tried to used a DynaActionForm to hold the users form choices across requests by setting the form to session scope. This causes a problem with html:reset since I get back the same values on reset and in effect nothing is reset. I could be committing a big design no no here. Maybe I should be using a different bean to hold the form choices across requests but it seems redundant. Any thoughts on if this is a misuse of forms or not would be appreciated. If someone can point out a repository of programs demonstrating good Struts usages that would be helpful also.
Re: Array Validation
To make this kind of feature useful there needs to be some way of indicating which occurance of the "indexed" property is in error. So, for example, if you had a bunch of "order" beans and were validating the order value I would want to be able to output a message along the lines of... "Order value for order number 12345 is invalid" or "Order value on line 5 is invalid" ... where order number or line number are other properties from the bean being validated. Otherwise if you had 20 errors on order value then you just get 20 indetical messages along the lines of "Order value is invalid" - which isn't very useful. I looked at trying to do this in the current validator but can't see how to - have a missed something or am I right and its not possible? This is an issue for me with the existing functionality where it stops on the first indexed field in error - we got round it by outputing a message which doesn't indicate which indexed occurance is in error, but by highlighting the field in error, which works reasonably well. That also would be another type of solution, validate all the indexed properties, only show one generic message but highlight all the fields in error. I'd be happy if someone would either put me right on this, or say how they dealt with this scenario. Niall - Original Message - From: "Robert Leland" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, April 30, 2004 1:12 AM Subject: Re: Array Validation > > -Original Message Slightly rearranged - > > From: Glenn, Scott [mailto:[EMAIL PROTECTED] > > > > If there are any Struts developers listening can you explain this .. is it a > > bug or by design? > > Doesn't matter. What matters is that it's not the behavior you need right ? > If someone would like to develop and test a patch that adds an option to: > A) The XML element in the struts-config.xml > This would change the default behavior to not stop validating on an > error for a given module. > or > B) The Validator.xml itself, which would require a change to the > validator.dtd, either to: > B1) The form definition, so the behavior could be changed on a > per form basis. > The Option (whenInvalid ? ) would probably have four possible > values. [stop, inherit, all]. > stop = This is the current default behavior > go = This is the behavior you want, where it doesn't stop >at the first error but attempts to validate all data. > inherit = This would inherit the behavior from the parent form. > This assumes using Validator 1.2 which has a > validator form inheritance. > module = Defers to what the modules default behavior is, > assuming that option A) is also implemented. > or > B2) The validator definition itself so it could be changed on a > per type basis. > > > Of these A) Is the simplest and hence the fastest to develop and hence test. > Because it?s the fastest it?s more likely to be in the > 1.2.1 release because. > > > Long term Option B1) probably makes the most sense, but since it > requires a change to the commons Validator DTD, it won't make it into > Struts 1.2.1 since that will be using validator 1.1.3 which will be > released this weekend. > > The patch should include a unit test showing that the default behaviour > in the same as in Struts 1.1, along with tests for each option. > > > > > Thanks, > > > > Scott. > > > > > > > > > > FYI: Looks like this is a bug/feature of Struts validation. If you have a > > List of indexed properties, it stops validating them once it has discovered > > the first error. > > > > The code below is from the Validator class - it loops around all indexed > > fields (indexedList), calling the appropriate validate rule > > (validateFieldForRule()). However if this validate rule return false into > > the "good" variable, then the method exits without completing the loop. > > > > for (int pos = 0; pos < indexedList.length; pos++) > > { > >ValidatorResults results = new ValidatorResults(); > >StringTokenizer st = new StringTokenizer(field.getDepends(), ","); > >while (st.hasMoreTokens()) { > >String depend = st.nextToken().trim(); > >ValidatorAction action = (ValidatorAction) actions.get(depend); > >if (action == null) { > >log.error("No ValidatorAction called " > > + depend > > + " found for field " > > + field.getProperty()); > >return; > > } > > > > boolean good = validateFieldForRule(field, action, results, actions, > > pos); > > allResults.merge(results); > > if (!good) > > { > > return; > > } > > } > > > > > > > > -
null shows in tag
I am using the for displaying the error messages. In the properties file, I have the following entry ApplicationResources.properties == error.emptyUserid=• Please enter a username. In the HTML, it shows the null in the beginning and end. Why? Please help! null • Please enter a username. null Billy Ng - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [SOLVED] Indexed Properties Validation - SF/SV Struts presntation next week
James Turner also has a way of doing multi row validation, but I think bellow is a better approach. FYI, I am doing another seminar in SF next week, linked bellow and release a few more Struts web apps, I linked a very big ones from the link bellow. I will try to keep my “blog” updated: http://jroller.com/page/netsql2/20040430#more_struts_sites This way I spam the list less. Also, I will post my trainings on here: http://groups.yahoo.com/group/RIA_CMS/links .V Amin Lalji wrote: For anybody who might be interested in a solution: After some considerable research and wheel spinning, I was able to implement some level of validation for using the validator and DynaValidatorForms ... the solution at this time is only stable for client side (javascript) validation... I obtained a copy of Vic Cekvenich's MultiRowValidator implementation (http://www.mail-archive.com/[EMAIL PROTECTED]/msg19122.html) and used that to come up with a workaround Server-side caveat: Within the MultiRowValidator, Vic casts the object (bean) passed to the validation as a Collection... from my tests, the object being passed ends up being a DynaValidatorForm instead of a Collection... and thus we end up with A Classcast Exception... hence I stuck to the javascript validation which works well... Possible solution ... Rewrite the implementation to cast the object to a DynaValidatorForm, and then look up the collection from there... Hope this helps some of you /A -Original Message- From: Amin Lalji [mailto:[EMAIL PROTECTED] Sent: Thursday, April 29, 2004 12:09 PM To: 'Struts Users Mailing List' Subject: Indexed Properties Validation Hey All, I am trying to perform client side validation of my form using the Validator Framework... I have set up my forms as required and do see the javascript and rules imported into my page... problem is I ended up with empty methods which cause validation to be skipped/pass... function DateValidations () { } My validation.xml entry: indexedListProperty="verification" depends="date"> Are there any workarounds to this situation? Thanks, /A - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Vic Cekvenich Development Engineer Struts Portal / RIA CMS <http://www.baseBeans.com> NYC/Silicon Valley cell: 917 825 3035 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Date format.
Use a String for the form's fields (be it Date, int, double, whatever). Format the data before it's shown and parse it upon submission. --- "Inamdar, Anil - Cons" <[EMAIL PROTECTED]> wrote: > Hello, > I have a getter and setter on a Date field in my Action form. > When I display the field struts seems to call toString on the object. > Is there a way I can control the formatting on the Date object > thanks > Anil > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Date format.
> I have a getter and setter on a Date field in my Action form. > When I display the field struts seems to call toString on the > object. Is there a way I can control the formatting on the > Date object thanks Anil Yes! Use the JSTL tag. -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Date format.
Hello, I have a getter and setter on a Date field in my Action form. When I display the field struts seems to call toString on the object. Is there a way I can control the formatting on the Date object thanks Anil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java Resources
How about: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&group=comp.lang. java.programmer for the java programming part? -Original Message- From: Irfandhy Franciscus [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 28, 2004 10:53 AM To: [EMAIL PROTECTED] Subject: Java Resources Hi, Does any of you know a good mailing list under one these topics : 1. IT Project Management 2. Java programming Thank you. Best Regards, Irfandhy Franciscus - 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]
Java Resources
Hi, Does any of you know a good mailing list under one these topics : 1. IT Project Management 2. Java programming Thank you. Best Regards, Irfandhy Franciscus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where to use ConvertUtils.register ?
At 2:29 PM +0200 4/30/04, Nicolas De Loof wrote: Hello, I just discovered the use of BeanUtils.copyProperties to populate my formbeans from business objets. I would like to know where to configure my Converters (using ConvertUtils.register) ? I use a static initialiser in my BaseAction class. Do you have something better to suggest ? A PlugIn would probably be cleaner (or, if you are using Servlet 2.3 and if you prefer, a ServletContextListener). See http://jakarta.apache.org/struts/api/org/apache/struts/action/PlugIn.html http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContextListener.html 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]
Re: Can I specify DynaFormProperties at Run Time
At 8:24 AM -0700 4/30/04, Steve Lewis wrote: Given that the Dynaform is dynamic I am wondering why I need to declare a dynaform and list its properties in struts-config. I would prefer to have my action populate a form adding properties that it knows without having to declare the form in struts-config. 1) Is this possible 2) If so how do you do that? 3) Is anyone doing this? It's difficult to do because of the process by which dynabeans are defined and managed. One of my colleagues worked on a project where, in one case, form fields were defined by database data. We implemented this with a PlugIn which, at initialization time, registered its own dynaforms using the static DynaActionFormClass.createDynaActionFormClass() method. Even this, then, isn't truly dynamic, but that's part of how DynaActionFormClass is designed. I think that we should steer Struts to having one or more ActionForm factories which can produce forms in more flexible ways. I don't have any specific design ideas in mind, but I've seen how annoying it is to get instances of DynaForms (for example, if you want to prefill a form), as well as the use case we're discussing right now. As always, I encourage interested Struts users to grab the source code and wrap their heads around how Struts works, possibly coming up with specific suggestions on how things can be improved (and perhaps even patches!) -- the more minds the better... A simpler solution might be to simply declare a DynaActionForm which has a single mapped property. You could probably get a good bit of what you need there with less investment. 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]
Re: Redirect from one path to another
Hi it seems that you can use the Struts DispatchAction to do this. Please refer this: http://www.jguru.com/faq/view.jsp?EID=995474 Paulo Murphy wrote: Hi again all, I have a couple of actions with respective forwards that are all working fine. Now what I am trying to do is use a single url to redirect to whichever action, based on a url parameter. So I added the following to my struts config : Then I created the class Redirect : public class Redirect { public Redirect() { } public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { String path = "./" + (String)request.getParameter("path") + ".do"; if ((path != null) && (path != "")) { if (path == "showthis") { path += "?parentid=" + (String)request.getParameter ("parentid"); } else if (path == "showthat") { path += "?id=" + (String)request.getParameter("id"); } } return new ActionForward(path, true); } } So I would visit http://here.there.com:7874/redirect.do?id=3&path=showthat and it would be interpreted as : http://here.there.com:7874/showthat.do?id=3 Can anyone shed some light on the subject. Am I going about this the wrong way completely? Thanks in advance for any help /Paulo Murphy de Freitas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Can I specify DynaFormProperties at Run Time
Given that the Dynaform is dynamic I am wondering why I need to declare a dynaform and list its properties in struts-config. I would prefer to have my action populate a form adding properties that it knows without having to declare the form in struts-config. 1) Is this possible 2) If so how do you do that? 3) Is anyone doing this? Steven M. Lewis PhD 4221 105th Ave NE Kirkland, WA 98033 425-889-2694 206-384-1340 (cell) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
where to use ConvertUtils.register ?
Hello, I just discovered the use of BeanUtils.copyProperties to populate my formbeans from business objets. I would like to know where to configure my Converters (using ConvertUtils.register) ? I use a static initialiser in my BaseAction class. Do you have something better to suggest ? Nico. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to iterate a bean's list of String in a JSP
Hi try adding this method in your ActionForm: public String getToto(int i) { return (String)toto.get(i); } The struts logic:iterate will automatically pass in an index value to the method in order to get the object inside the Array. Hope this works Francois Boccou wrote: Hello, I have a problem displaying on my jsp pages a list of String that is part of my bean. Here is my bean: myBean { ArrayList toto; //of type String } here is my JSP: + This doesn't work, I miss something but I can't find what, someone would give me a tip ? Name is a required property for bean:write tag but I really don't know what as value. What is the way to iterate a list of String ? Thanks, François - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Indexed properties working formbean->htmlform, not working htmlform->formbean
Scott, That was it. Thanks a bunch. One thing I don't understand though. If the setProperty for the BeanUtils couldn't find an appropriate setter (which it couldn't until I declared setIsf() in the form), shouldn't it have squawked about it with TRACE level logging? Wayne -Original Message- From: Glenn, Scott [mailto:[EMAIL PROTECTED] Sent: Friday, April 30, 2004 11:10 AM To: 'Struts Users Mailing List' Subject: RE: Indexed properties working formbean->htmlform, not working htmlform->formbean I think the id attribute on the iterate tag must match the getter on the "get row (index)" method of your form bean. For example I have:- and my form bean is:- private List rows = null; public FormRow getRows (int index) { return (RenamePDFFormRow)rows.get(index); } When the form is submitted, the getRows(int) method is called to retrieve the relevant entry in the collection, which is then reflected to set the individual properties. So try adding this to your form:- public FundamentalsInfo getIsf (int index) { return fundInfo.get(index); } Hope that helps, Scott. > -Original Message- > From: Berke, Wayne [IT] [mailto:[EMAIL PROTECTED] > Sent: 30 April 2004 15:50 > To: Struts Users Mailing List > Subject: Indexed properties working formbean->htmlform, not working > htmlform->formbean > > I've been tearing my hair out trying to get indexed properties > to work. Apparently, there is some correspondence between the HTML > fields and the ActionForm indexed properties because when the ActionForm > is initialized, it does correctly populate the default HTML form fields. > However, when I modify an HTML field that corresponds to an indexed > property and submit the form, that change does not get reflected in > the ActionForm. > > I tried turning on log4j trace in BeanUtils and PropertyUtils and it seems > like the correct setProperty calls are being made, but printing out the > ActionForm fields shows no change from the defaults. > > Any information, including suggestions for how to further debug this > would be greatly appreciated. > > My JSP looks like this: > > class="bglt3"> > >indexId="ix"> > > NM: > property="colName" indexed="true" size="10" > styleClass="t11" /> > > DISP: > property="displayName" indexed="true" size="10" > styleClass="t11" /> > > > > > > > > > The ActionForm is: > > public class ISF extends ActionForm { > > private List fundInfo = new ArrayList(); > { > System.out.println("INITIALIZING!"); > fundInfo.add(new FundamentalsInfo("ONE", "1")); > fundInfo.add(new FundamentalsInfo("TWO", "2")); > fundInfo.add(new FundamentalsInfo("THREE", "3")); > } > public List getFundInfo() { > return fundInfo; > } > public void setFundInfo(List fi) { > fundInfo = fi; > } > public FundamentalsInfo getFundInfo(int index) { > return (FundamentalsInfo) fundInfo.get(index); > } > public void setFundInfo(int index, FundamentalsInfo fi) { > fundInfo.set(index, fi); > } > > public void reset(ActionMapping mapping, HttpServletRequest request) > { > } > } > > A FundamentalsInfo object is just a simple bean with two attributes, > colName and > displayName. > > The associated Action simply prints out the contents of the fundInfo list > and it > shows that the fields never change from the values they were initialized > with. > > Wayne > > - > 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]
[SOLVED] Re: Multiple action for one (1) form
Hello there, The problem using multiple actions for one form is solved :-) I followed exactly the instructions in the API reference for the class org.apache.struts.actions.LookupDispatchAction (like explained in the newbie faq), and everything is fine. Sincerly Samuel --- andinasoft SA - Software y Consulting --- Mariano Aguilera 276 y Almagro - Quito, Ecuador Tel. +593 2 290 55 18 Cel. +593 9 946 4046 - http://www.andinasoft.com - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[SOLVED] Re: Action mapping mismatch
Hello, I had an error in my jsp page, there still was a lost tag before my tag. Samuel --- andinasoft SA - Software y Consulting --- Mariano Aguilera 276 y Almagro - Quito, Ecuador Tel. +593 2 290 55 18 Cel. +593 9 946 4046 - http://www.andinasoft.com - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ArrayList and DynaActionForm--ISSUE TRACKED DOWN--NEED HELP
Little more input to the issue.It's working when i have this . So that mean that the lazyList trick is not working for some reason.see the commented codes public class myTestForm extends DynaActionForm { public void reset(ActionMapping mapping, HttpServletRequest request) { // List nameList = ListUtils.lazyList(new ArrayList(), new Factory() { //public Object create() { //return new String(); //} //}); List nameList = getMyList(); set("friendName", nameList); } private List getMyList() { List mList = new ArrayList(); for (int i = 0; i < 5; i++) { mList.add("fakeName"); }return mList; } } Thank-you, Manoj Mathew GIS-Systems (515-362-0539) -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Thursday, April 29, 2004 5:03 PM To: Struts Users Mailing List Subject: RE: ArrayList and DynaActionForm--need help very badly Well, I'm back at nothing. Maybe someone else can spot what's happening. --- "Mathew, Manoj" <[EMAIL PROTECTED]> wrote: > Thanks God. I thought people lost interest in this one and i am left > alone.Man i am having a tough time with this. All these days because of > this Indexoutofbond, when evenr we needed a List as form element,we used to > go for actionForm unnecessary. I thought of cleaning up some code and thats > how i started this. > > type="com.principal.group.acquire.proposal.ui.benefits.MyTestOpenAction" > name="mytestform" scope="request"> > > >type="com.principal.group.acquire.proposal.ui.benefits.MyFormPost" > name="mytestform" scope="request"> > > > > open action seems to be working as i am able to see the values populated in > the open action in the jsp page. > But when i click on the submit button "mytestjsppostaction.do" is called > and i have break points in my dynaactionform as wel as in the first line of > MyFormPost.java. The control first comes to the dyna actionform and then it > seems like calling beanutil.populate where the exception is thrown. It > never comes to the MyFormPost.java > > Thank-you, > Manoj Mathew > > > r > > > > > > I still get the same and agian nameList = null > > > > > > [Servlet Error]-[BeanUtils.populate]: > > > java.lang.IndexOutOfBoundsException: Index: 4, Size: > > > 0 > > > at > > > > > > c > > > Mathew, > > > Okay, forget about my previous email. Try this > > > instead. I didn't look at your code that closely > > > before. > > > > > > List mm = new ArrayList(); > > > List nameList = ListUtils.lazyList(mm, new > > > Factory() { > > > public Object create() { > > > return new String(); > > > } > > > }); > > > set("friendName", nameList); > > > > > > Regards, > > > > > > Richard > > > > > > > > > 1) define the the > > > --- "Mathew, Manoj" <[EMAIL PROTECTED]> > > > wrote: > > > > Richard > > > > when i use that wasy i get this error > > > > The following exception was logged > > > > java.lang.NullPointerException: The type for > > > > property friendName is invalid > > > > at > > > > > > > > > org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:414) > > > > > > > > struts config > > > > > > > > > > > type="org.apache.struts.action.DynaActionForm"> > > > > > > > > > > > > type="org.apache.commons.collections.ListUtils.LazyList" > > > > /> > > > > > > > > Thank-you, > > > > Manoj Mathew > > > > GIS-Systems > > > > (515-362-0539) > > > > > > > > > > > > -Original Message- > > > > From: Richard Yee [mailto:[EMAIL PROTECTED] > > > > Sent: Thursday, April 29, 2004 12:06 PM > > > > To: Struts Users Mailing List > > > > Subject: RE: ArrayList and DynaActionForm--need > > > help > > > > very badly > > > > > > > > > > > > Mathew, > > > > I think you are mixing the instructions that > > > > everyone > > > > has given you. If you use the LazyList as your > > > > form-property type in your form-bean, then you > > > don't > > > > need to put this code, > > > > > List mm = new ArrayList(); > > > > > List nameList = ListUtils.lazyList(mm, new > > > > > Factory() { > > > > > public Object create() { > > > > > return "fakeName"; > > > > > } > > > > > }); > > > > > set("friendName", nameList); > > > > > > > > in your reset() method. In fact, you don't have to > > > > put > > > > any code that initializes your list because the > > > > LazyList takes care of that for you. > > > > > > > > In the solution I proposed in my previous emails, > > > I > > > > told you to
How to iterate a bean's list of String in a JSP
Hello, I have a problem displaying on my jsp pages a list of String that is part of my bean. Here is my bean: myBean { ArrayList toto; //of type String } here is my JSP: + This doesn't work, I miss something but I can't find what, someone would give me a tip ? Name is a required property for bean:write tag but I really don't know what as value. What is the way to iterate a list of String ? Thanks, François
RE: ArrayList and DynaActionForm--need help very badly
Little more input to the issue.It's working when i have this . So that mean that the lazyList trick is not working for some reason.see the commented codes public class myTestForm extends DynaActionForm { public void reset(ActionMapping mapping, HttpServletRequest request) { // List nameList = ListUtils.lazyList(new ArrayList(), new Factory() { //public Object create() { //return new String(); //} //}); List nameList = getMyList(); set("friendName", nameList); } private List getMyList() { List mList = new ArrayList(); for (int i = 0; i < 5; i++) { mList.add("fakeName"); }return mList; } } Thank-you, Manoj Mathew GIS-Systems (515-362-0539) -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Thursday, April 29, 2004 5:03 PM To: Struts Users Mailing List Subject: RE: ArrayList and DynaActionForm--need help very badly Well, I'm back at nothing. Maybe someone else can spot what's happening. --- "Mathew, Manoj" <[EMAIL PROTECTED]> wrote: > Thanks God. I thought people lost interest in this one and i am left > alone.Man i am having a tough time with this. All these days because of > this Indexoutofbond, when evenr we needed a List as form element,we used to > go for actionForm unnecessary. I thought of cleaning up some code and thats > how i started this. > > type="com.principal.group.acquire.proposal.ui.benefits.MyTestOpenAction" > name="mytestform" scope="request"> > > >type="com.principal.group.acquire.proposal.ui.benefits.MyFormPost" > name="mytestform" scope="request"> > > > > open action seems to be working as i am able to see the values populated in > the open action in the jsp page. > But when i click on the submit button "mytestjsppostaction.do" is called > and i have break points in my dynaactionform as wel as in the first line of > MyFormPost.java. The control first comes to the dyna actionform and then it > seems like calling beanutil.populate where the exception is thrown. It > never comes to the MyFormPost.java > > Thank-you, > Manoj Mathew > > > r > > > > > > I still get the same and agian nameList = null > > > > > > [Servlet Error]-[BeanUtils.populate]: > > > java.lang.IndexOutOfBoundsException: Index: 4, Size: > > > 0 > > > at > > > > > > c > > > Mathew, > > > Okay, forget about my previous email. Try this > > > instead. I didn't look at your code that closely > > > before. > > > > > > List mm = new ArrayList(); > > > List nameList = ListUtils.lazyList(mm, new > > > Factory() { > > > public Object create() { > > > return new String(); > > > } > > > }); > > > set("friendName", nameList); > > > > > > Regards, > > > > > > Richard > > > > > > > > > 1) define the the > > > --- "Mathew, Manoj" <[EMAIL PROTECTED]> > > > wrote: > > > > Richard > > > > when i use that wasy i get this error > > > > The following exception was logged > > > > java.lang.NullPointerException: The type for > > > > property friendName is invalid > > > > at > > > > > > > > > org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:414) > > > > > > > > struts config > > > > > > > > > > > type="org.apache.struts.action.DynaActionForm"> > > > > > > > > > > > > type="org.apache.commons.collections.ListUtils.LazyList" > > > > /> > > > > > > > > Thank-you, > > > > Manoj Mathew > > > > GIS-Systems > > > > (515-362-0539) > > > > > > > > > > > > -Original Message- > > > > From: Richard Yee [mailto:[EMAIL PROTECTED] > > > > Sent: Thursday, April 29, 2004 12:06 PM > > > > To: Struts Users Mailing List > > > > Subject: RE: ArrayList and DynaActionForm--need > > > help > > > > very badly > > > > > > > > > > > > Mathew, > > > > I think you are mixing the instructions that > > > > everyone > > > > has given you. If you use the LazyList as your > > > > form-property type in your form-bean, then you > > > don't > > > > need to put this code, > > > > > List mm = new ArrayList(); > > > > > List nameList = ListUtils.lazyList(mm, new > > > > > Factory() { > > > > > public Object create() { > > > > > return "fakeName"; > > > > > } > > > > > }); > > > > > set("friendName", nameList); > > > > > > > > in your reset() method. In fact, you don't have to > > > > put > > > > any code that initializes your list because the > > > > LazyList takes care of that for you. > > > > > > > > In the solution I proposed in my previous emails, > > > I > > > > told you to put
Re: Drop down population question
Hello Abhi, I am sorry, which one is the storeToBean and storeToProperty with reference to my example? I can't say, cause your example show me only the code in the JSP. Think about where do you want to store the object selected in your option. I assume it is in a bean in which you'll store the content of your form. In my example, the bean where you store the result is the storeToBean. For each field in your form, you will store the result in a property (attribute) of your bean class. The storeToProperty indicates in which field of your bean you'll store the result. If you don't have this bean class yet, you should create it. Sincerly Samuel --- andinasoft SA - Software y Consulting --- Mariano Aguilera 276 y Almagro - Quito, Ecuador Tel. +593 2 290 55 18 Cel. +593 9 946 4046 - http://www.andinasoft.com - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] log per session
Hi, Is it practical to have a log file created per sessoin? I am using log4j 1.2.8. It logs all messages to one log file. What is your suggestion? Thanks, Chiming __ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:img define src dynamicly
Hello there, I'vesolved it like this, using the bean tag inside the html src tag: Sincerly Samuel --- andinasoft SA - Software y Consulting --- Mariano Aguilera 276 y Almagro - Quito, Ecuador Tel. +593 2 290 55 18 Cel. +593 9 946 4046 - http://www.andinasoft.com - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Drop down population question
Samuel: I am sorry, which one is the storeToBean and storeToProperty with reference to my example? The vector lstCountry contains CountryObject beans that have getters and setters for country_id and name. Thanks, Abhi -Original Message- From: Samuel Rochas [mailto:[EMAIL PROTECTED] Sent: Friday, April 30, 2004 11:12 AM To: Struts Users Mailing List Subject: Re: Drop down population question Hello Abhi, > request.setAttribute("lstCountry", v) So the bean with you list is "lstCountry". JSP: Explanation: -storeTo is the bean where to store the result -storeToProperty is the property of the bean storeTo where to store the result -lstCountry: your bean with the collection of beans -id: the property of the bean contained in you collection that you use for the "value" part of the option (the value returned to storeToProperty when you select an option) -name: the property of the bean contained in you collection that you use for the content shown to the users of you site Sincerly Samuel --- andinasoft SA - Software y Consulting --- Mariano Aguilera 276 y Almagro - Quito, Ecuador Tel. +593 2 290 55 18 Cel. +593 9 946 4046 - http://www.andinasoft.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: Drop down population question
Hello Abhi, request.setAttribute("lstCountry", v) So the bean with you list is "lstCountry". JSP: Explanation: -storeTo is the bean where to store the result -storeToProperty is the property of the bean storeTo where to store the result -lstCountry: your bean with the collection of beans -id: the property of the bean contained in you collection that you use for the "value" part of the option (the value returned to storeToProperty when you select an option) -name: the property of the bean contained in you collection that you use for the content shown to the users of you site Sincerly Samuel --- andinasoft SA - Software y Consulting --- Mariano Aguilera 276 y Almagro - Quito, Ecuador Tel. +593 2 290 55 18 Cel. +593 9 946 4046 - http://www.andinasoft.com - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Indexed properties working formbean->htmlform, not working ht mlform->formbean
I think the id attribute on the iterate tag must match the getter on the "get row (index)" method of your form bean. For example I have:- and my form bean is:- private List rows = null; public FormRow getRows (int index) { return (RenamePDFFormRow)rows.get(index); } When the form is submitted, the getRows(int) method is called to retrieve the relevant entry in the collection, which is then reflected to set the individual properties. So try adding this to your form:- public FundamentalsInfo getIsf (int index) { return fundInfo.get(index); } Hope that helps, Scott. > -Original Message- > From: Berke, Wayne [IT] [mailto:[EMAIL PROTECTED] > Sent: 30 April 2004 15:50 > To: Struts Users Mailing List > Subject: Indexed properties working formbean->htmlform, not working > htmlform->formbean > > I've been tearing my hair out trying to get indexed properties > to work. Apparently, there is some correspondence between the HTML > fields and the ActionForm indexed properties because when the ActionForm > is initialized, it does correctly populate the default HTML form fields. > However, when I modify an HTML field that corresponds to an indexed > property and submit the form, that change does not get reflected in > the ActionForm. > > I tried turning on log4j trace in BeanUtils and PropertyUtils and it seems > like the correct setProperty calls are being made, but printing out the > ActionForm fields shows no change from the defaults. > > Any information, including suggestions for how to further debug this > would be greatly appreciated. > > My JSP looks like this: > > class="bglt3"> > >indexId="ix"> > > NM: > property="colName" indexed="true" size="10" > styleClass="t11" /> > > DISP: > property="displayName" indexed="true" size="10" > styleClass="t11" /> > > > > > > > > > The ActionForm is: > > public class ISF extends ActionForm { > > private List fundInfo = new ArrayList(); > { > System.out.println("INITIALIZING!"); > fundInfo.add(new FundamentalsInfo("ONE", "1")); > fundInfo.add(new FundamentalsInfo("TWO", "2")); > fundInfo.add(new FundamentalsInfo("THREE", "3")); > } > public List getFundInfo() { > return fundInfo; > } > public void setFundInfo(List fi) { > fundInfo = fi; > } > public FundamentalsInfo getFundInfo(int index) { > return (FundamentalsInfo) fundInfo.get(index); > } > public void setFundInfo(int index, FundamentalsInfo fi) { > fundInfo.set(index, fi); > } > > public void reset(ActionMapping mapping, HttpServletRequest request) > { > } > } > > A FundamentalsInfo object is just a simple bean with two attributes, > colName and > displayName. > > The associated Action simply prints out the contents of the fundInfo list > and it > shows that the fields never change from the values they were initialized > with. > > Wayne > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate and smart search
You don't understand me ( probably) I don't want set criteria for every class - I want features btw search, like load, find, save etc session.search(PermanentClass.class,BeanClass.class) for any PermanentClass and any BeanClass method search find properties in BeanClass like properties in PermanentClass and automatic make query regards p.s. this is question for hiberante list, sorry for mistake On Friday 30 April 2004 11:42 am, Nicolas de Amorrortu wrote: > Take a look to the Criterion Object at Hibernate > (http://www.hibernate.org/hib_docs/reference/en/html_single/#querycriter > ia). > You can implement something like a "Chain of Responsiblity" where each > Handler is an adaptor to a Criterion (using Expression). You can define > one Adaptor for each Expression, so then you can externalize (¿?) your > criteria definition to an XML File. > > saludos, > Nicolás > > -Original Message- > From: snpe [mailto:[EMAIL PROTECTED] > Sent: Viernes, 30 de Abril de 2004 02:19 a.m. > To: 'Struts Users Mailing List' > Subject: Hibernate and smart search > > > Hello > I have bean with table propeties (web or swing form field) and I > want next seach : > > - if property is null no seach for this property > - if property is not null create query for value of property (where > clause in table) > - if value property btw 'TH%' or 'TH_' (value with character %, _ ..) > then use LIKE clause > - if value is '>xxx' query is "where prop > 'xxx' " > etc > > I want search like > List list = dao.search(BeanClass.class) > > I can make query for any class easy, but I want this for every class > > My goal is that user populate bean and with search button find rows with > populated field > > Is it possible ? > > regards > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > NOTA DE CONFIDENCIALIDAD > Este mensaje (y sus anexos) es confidencial, esta dirigido exclusivamente a las > personas direccionadas en el mail y puede contener informacion (i)de propiedad > exclusiva de Interbanking S.A. o (ii) amparada por el secreto profesional. Cualquier > opinion en el contenido, es exclusiva de su autor y no representa necesariamente la > opinion de Interbanking S.A. El acceso no autorizado, uso, reproduccion, o > divulgacion esta prohibido. Interbanking S.A no asumira responsabilidad ni > obligacion legal alguna por cualquier informacion incorrecta o alterada contenida en > este mensaje. Si usted ha recibido este mensaje por error, le rogamos tenga la > amabilidad de destruirlo inmediatamente junto con todas las copias del mismo, > notificando al remitente. No debera utilizar, revelar, distribuir, imprimir o copiar > este mensaje ni ninguna de sus partes si usted no es el destinatario. Muchas gracias. > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to create a custom tag which returns struts tag ?
Hi, Won\t logic:iterate help somewhere, along with tiles? Regards marco -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Ludovic Bailly Sent: 30 April 2004 15:54 To: [EMAIL PROTECTED] Subject: Re: How to create a custom tag which returns struts tag ? Hi, Thanks for your response. I'm agree with you there must be a better approach :-) What I want to do is really simple. In a jsp page I want to display a collection of products. I've created a custom tag that takes a product object as parameter and display it using a velocity template. Each products must have a link or a button image which forward to a details page. My concern is about this link which has to be rendered with a struts tag. I've done like this in order to simplify the jsp code and allow easier modification of the product appearance. Maybe using tiles is a solution ? Ludo. James Mitchell wrote: >>Is there a solution ? > > > Yes, the solution is to rethink what you've done. From what you've > described, it sounds like pretty big hack. Perhaps you can back up a few > steps and explain to us what you are doing and someone might offer you a > better approach. > > > > -- > James Mitchell > Software Engineer / Open Source Evangelist > EdgeTech, Inc. > > > > > - Original Message - > From: "Ludovic Bailly" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, April 30, 2004 8:17 AM > Subject: How to create a custom tag which returns struts tag ? > > > >>Hi, >> >>I'm writing a simple custom tag with a doEndTag method writing html >>code. This html code contains struts html tags that are not interpreted >>by tomcat. The result is instead of the result of the tag. >> >>Is there a solution ? >> >>Thanks. >> >>Ludo. >> >> >>- >>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: How to create a custom tag which returns struts tag ?
Hi, Thanks for your response. I'm agree with you there must be a better approach :-) What I want to do is really simple. In a jsp page I want to display a collection of products. I've created a custom tag that takes a product object as parameter and display it using a velocity template. Each products must have a link or a button image which forward to a details page. My concern is about this link which has to be rendered with a struts tag. I've done like this in order to simplify the jsp code and allow easier modification of the product appearance. Maybe using tiles is a solution ? Ludo. James Mitchell wrote: Is there a solution ? Yes, the solution is to rethink what you've done. From what you've described, it sounds like pretty big hack. Perhaps you can back up a few steps and explain to us what you are doing and someone might offer you a better approach. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. - Original Message - From: "Ludovic Bailly" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, April 30, 2004 8:17 AM Subject: How to create a custom tag which returns struts tag ? Hi, I'm writing a simple custom tag with a doEndTag method writing html code. This html code contains struts html tags that are not interpreted by tomcat. The result is instead of the result of the tag. Is there a solution ? Thanks. Ludo. - 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]
Indexed properties working formbean->htmlform, not working htmlform->formbean
I've been tearing my hair out trying to get indexed properties to work. Apparently, there is some correspondence between the HTML fields and the ActionForm indexed properties because when the ActionForm is initialized, it does correctly populate the default HTML form fields. However, when I modify an HTML field that corresponds to an indexed property and submit the form, that change does not get reflected in the ActionForm. I tried turning on log4j trace in BeanUtils and PropertyUtils and it seems like the correct setProperty calls are being made, but printing out the ActionForm fields shows no change from the defaults. Any information, including suggestions for how to further debug this would be greatly appreciated. My JSP looks like this: NM: DISP: The ActionForm is: public class ISF extends ActionForm { private List fundInfo = new ArrayList(); { System.out.println("INITIALIZING!"); fundInfo.add(new FundamentalsInfo("ONE", "1")); fundInfo.add(new FundamentalsInfo("TWO", "2")); fundInfo.add(new FundamentalsInfo("THREE", "3")); } public List getFundInfo() { return fundInfo; } public void setFundInfo(List fi) { fundInfo = fi; } public FundamentalsInfo getFundInfo(int index) { return (FundamentalsInfo) fundInfo.get(index); } public void setFundInfo(int index, FundamentalsInfo fi) { fundInfo.set(index, fi); } public void reset(ActionMapping mapping, HttpServletRequest request) { } } A FundamentalsInfo object is just a simple bean with two attributes, colName and displayName. The associated Action simply prints out the contents of the fundInfo list and it shows that the fields never change from the values they were initialized with. Wayne - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Action mapping mismatch
Hello there, The link: http://project:8080/start.do shows me the page configured in struts-config.xml: This form contains a tag which looks like that in the generated html page: If I press the submit button, the page shown is: http://project:8080/start.do?category=4 ... and not, like I would expect: http://project:8080/myAction.do?category=4 ... Why am I not directed to the new defined action "myAction.do" like the form says? Why the URL stays with the original "start.do" action from the page where I am, and which is not defined anywhere in my form? Any hint? Thanx in advance Samuel --- andinasoft SA - Software y Consulting --- Mariano Aguilera 276 y Almagro - Quito, Ecuador Tel. +593 2 290 55 18 Cel. +593 9 946 4046 - http://www.andinasoft.com - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Drop down population question
Sorry, this is the exception I get: javax.servlet.ServletException: Cannot find bean c in any scope > -Original Message- > From: Basu, Abhijit (Abhi) > Sent: Friday, April 30, 2004 9:58 AM > To: '[EMAIL PROTECTED]' > Subject: Drop down population question > > I am new to Struts and am having problems populating drop-downs from the > database. I am actually getting a little frustrated with these tags, seems > like > no coding in java anymore. :) > > > 1. ActionClass code excerpt: > > mBean.makeConnection(); > > //get country list vector > Vector v = (Vector)mBean.getCountryList(); > > request.setAttribute("lstCountry", v) > > 2. JSP code excerpt: > > The vector lstCountry contains CountryObject beans that have getters > and setters > for country_id and name. > > > > property="country_id" labelProperty="name"/> > > > Any help is greatly appreciated! > > Thanks, > > Abhi > > >
Drop down population question
I am new to Struts and am having problems populating drop-downs from the database. I am actually getting a little frustrated with these tags, seems like no coding in java anymore. :) 1. ActionClass code excerpt: mBean.makeConnection(); //get country list vector Vector v = (Vector)mBean.getCountryList(); request.setAttribute("lstCountry", v) 2. JSP code excerpt: The vector lstCountry contains CountryObject beans that have getters and setters for country_id and name. Any help is greatly appreciated! Thanks, Abhi