Re: Is Struts still a better choice over JSF as on today ?
Sorry, I couldn't resist. On 7/26/07, souravm <[EMAIL PROTECTED]> wrote: > > Regarding going for JSF due to componentization, I'm again not sure what > additional componentizations JSF does compared to struts. Apart from the fact > that JSF does not need a layer like Action Classes, all other components > (validator, managed bean, html tag libs etc.) are already there in Struts. I don't know where you got the idea that JSF does not need a layer like Action Classes. This layer is where your UI logic will go - it's the layer that converts the incoming request parameters into an object that your backend/business layer can understand. It's true that you won't be required to extend a base action class, but make no mistake, you'll still have these objects. The only way you can avoid this layer is if you use a framework that allowed web requests to directly call your business logic object and pass fully populated business domain objects. I've experimented with one just for fun but if I were to ever use it in an actual app, I'd still have an "action" object layer for web-specific logic (redirection, view preparation, etc). One way to find out what JSF won't provide, or needs improvement on, in a bullet-list format, would be to take a look at what they've listed for the next major version. Read Section 2 of JSF 314 [1]. Hubert [1] http://www.jcp.org/en/jsr/detail?id=314 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts/FormDef formatting question
Yeap, that's what I'd do. Hubert On 4/26/07, Givler, Eric <[EMAIL PROTECTED]> wrote: The problem I'm having with it is how to use the converter when the DB type is java.lang.String, and the conversion target type (for the form) will be java.lang.String? Apologies on this -- I didn't notice the source and destination types. Even if they are the same data types, I can at least see if the destination type is a subclass of Actionform and format accordingly. Sound ok? -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Thursday, April 26, 2007 12:37 PM To: Struts Users Mailing List Subject: Re: Struts/FormDef formatting question Then you'll have to have code to convert between the two. If you're using Formdef, you can put this logic in Converter and associate that converter with the field in the form you're using. If not, you'll have to handle this within your Action when you prepopulate your outgoing form or parse the incoming form. Hubert On 4/26/07, Givler, Eric <[EMAIL PROTECTED]> wrote: > Thanks for the quick response. > > The field in the db is to be stored stripped of formatting. However, the display and entry of the field should include the formatting. > > -Original Message- > From: Hubert Rabago [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 26, 2007 11:21 AM > To: Struts Users Mailing List > Subject: Re: Struts/FormDef formatting question > > > Your form field will come in as String. If you'll be storing the data > as string as well, maybe you don't need any more conversion between > the two. > > Hubert > > On 4/26/07, Givler, Eric <[EMAIL PROTECTED]> wrote: > > I was reading on the Formdef site about using a formatter (converter) for handling a phone number for dynamic form beans in Struts. I have a situation that is very similar to this but I'm not sure how to go about writing it. The existing table has numeric phone fields which will not be changed, and will have two new phone fields added which are varchar2(14). In the case of a converter, I could see writing one for the Numeric since I could say that the converter is going from Number to String. However, what about where the db field is String already? I'm trying to use iBATIS for the db layer. > > If this is the incorrect place to ask this question, can you point me to the correct one? > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts/FormDef formatting question
Then you'll have to have code to convert between the two. If you're using Formdef, you can put this logic in Converter and associate that converter with the field in the form you're using. If not, you'll have to handle this within your Action when you prepopulate your outgoing form or parse the incoming form. Hubert On 4/26/07, Givler, Eric <[EMAIL PROTECTED]> wrote: Thanks for the quick response. The field in the db is to be stored stripped of formatting. However, the display and entry of the field should include the formatting. -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Thursday, April 26, 2007 11:21 AM To: Struts Users Mailing List Subject: Re: Struts/FormDef formatting question Your form field will come in as String. If you'll be storing the data as string as well, maybe you don't need any more conversion between the two. Hubert On 4/26/07, Givler, Eric <[EMAIL PROTECTED]> wrote: > I was reading on the Formdef site about using a formatter (converter) for handling a phone number for dynamic form beans in Struts. I have a situation that is very similar to this but I'm not sure how to go about writing it. The existing table has numeric phone fields which will not be changed, and will have two new phone fields added which are varchar2(14). In the case of a converter, I could see writing one for the Numeric since I could say that the converter is going from Number to String. However, what about where the db field is String already? I'm trying to use iBATIS for the db layer. > If this is the incorrect place to ask this question, can you point me to the correct one? > - 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/FormDef formatting question
Your form field will come in as String. If you'll be storing the data as string as well, maybe you don't need any more conversion between the two. Hubert On 4/26/07, Givler, Eric <[EMAIL PROTECTED]> wrote: I was reading on the Formdef site about using a formatter (converter) for handling a phone number for dynamic form beans in Struts. I have a situation that is very similar to this but I'm not sure how to go about writing it. The existing table has numeric phone fields which will not be changed, and will have two new phone fields added which are varchar2(14). In the case of a converter, I could see writing one for the Numeric since I could say that the converter is going from Number to String. However, what about where the db field is String already? I'm trying to use iBATIS for the db layer. If this is the incorrect place to ask this question, can you point me to the correct one? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form submission
There are differences in how a user interacts with html:button and html:submit. For instance, pressing enter on some fields can trigger a submit button, but not a regular button. You can get the best of both worlds letting your javascript method determine whether the submit should happen at all but still letting your submit button actually submit the form: function populateAndSubmit() { if (goAheadCondition) { // don't call document.ChallengeQuestionForm.submit() here // let the submit button do the submit return true; } else { // tell the submit button not to proceed return false; } } On 4/26/07, Krishna, Hari (FTT-CInternet) <[EMAIL PROTECTED]> wrote: THANKS DUDE It works now -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 26, 2007 11:24 AM To: user@struts.apache.org Subject: RE: Form submission You can try replacing the html:submit with html:button and call your populateAndSubmit() method from the button. -Pushkar. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaValidatorForm with java.util.Date
The fields of action forms, including DynaValidatorForms are populated from request parameters, and these values are all in String variables. I suggest using a String variable for the dyna validator form field as well, and just parsing it to get the java.util.Date equivalent when you use it in your Action classes. Hubert On 3/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: And the 3rd mail. Is it possible to use an object that's different from java.lang.* as type for the dynavalidatorform? I think that's what causing the issue here. If it's not possible, then I'm in deep :) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: maandag 12 maart 2007 10:26 To: user@struts.apache.org Subject: RE: DynaValidatorForm with java.util.Date Ok, I did some tests and debugging and this is the result: The errormsg is "Cannot assign value of type 'java.lang.String' to property 'txtFieldName' of type 'java.util.Date'". I fill that field with following code: modifyForm.set("txtFieldName",new Date()); So the object I'm assigning to that field is a Date-object, but for some reason it is converted to a String. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: maandag 12 maart 2007 9:40 To: user@struts.apache.org Subject: DynaValidatorForm with java.util.Date Hi I have a form in which a Date is displayed, using fmt. It's static text, so no user input is required. The problem is the following. When the validation of that form fails, you return to that form. Actually, it should return to that form, but you're redirected to the error page. This is the error: 2448020 12 03 09:29 [http-8080-Processor24] ERROR org.apache.struts.util.RequestUtils - javax.servlet.ServletException: BeanUtils.populate javax.servlet.ServletException: BeanUtils.populate The form bean exists of a field, which is hidden, of the type java.util.Date. This is filled by the action, with the correct date. When I look at the source of the page, the date is actually filled in, so that's not the problem. I assume there's a problem with assigning the java.util.Date-type to a field in a DynaValidatorForm, but I'm not sure that's what causing the problem. There's also no validation on that field. Struts-config: Does anybody know how to have a Date-field in your form, in a way you can assign it to a textfield and make sure you can also pass it to fmt:formatDate. Tia Grtz Bjorn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form population and locale
Don't do it in the form's reset(). Accd. to the javadoc [1]: "In practice, the only properties that need to be reset are those which represent checkboxes on a session-scoped form." Hubert [1] http://struts.apache.org/1.x/apidocs/org/apache/struts/action/ActionForm.html On 1/20/07, Paul Benedict <[EMAIL PROTECTED]> wrote: I believe you could try to do this in the form's constructor or reset() method? Hubert Rabago wrote: > Are you talking about prepopulating the form? Yes, a FormUtils method > helps with that. I don't know if that qualifies as manually > populating the form, though. The FormUtils method does a lot of the > manual work, such as matching form fields with their POJO field > counterparts, considering the locale, converting and parsing data as > needed, possibly handling nested beans/nested forms as well. > > Hubert > > On 1/19/07, Zero <[EMAIL PROTECTED]> wrote: >> Hi, >> >> Thanks ! It is exactly what I need. I'm going to test it... >> Must I always populate manually all the forms (with FormUtils) ? >> >> Regard, >> Zero >> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form population and locale
Are you talking about prepopulating the form? Yes, a FormUtils method helps with that. I don't know if that qualifies as manually populating the form, though. The FormUtils method does a lot of the manual work, such as matching form fields with their POJO field counterparts, considering the locale, converting and parsing data as needed, possibly handling nested beans/nested forms as well. Hubert On 1/19/07, Zero <[EMAIL PROTECTED]> wrote: Hi, Thanks ! It is exactly what I need. I'm going to test it... Must I always populate manually all the forms (with FormUtils) ? Regard, Zero -- Initial Header --- From : "Hubert Rabago" <[EMAIL PROTECTED]> To : "Struts Users Mailing List" Cc : Date : Thu, 18 Jan 2007 09:52:57 -0600 Subject : Re: Form population and locale On 1/17/07, Zero <[EMAIL PROTECTED]> wrote: > Hi everybody, > > I use Struts 1.2.9 and I would like to know if there is any > way to link the user locale (available with > RequestUtils.getUserLocale(HttRequest)) with the form > population process. > > In fact, I have many forms which have date field (with the > java.util.Date type). I would format these fields according > to the user locale (ie. "/MM/dd" for english users and > "dd/MM/" for french users). Also, I would like that the > automatic form population do the same thing. I have a Struts extension [1] that allows you to do this. If you get the binary download, there's a sample app (locale.war) which demonstrates the form accepting dates (02/15/1999 vs. 15/02/1999) and numbers (40,000.50 vs. 40.000,50) formatted depending on the user's locale. > > Thanks a lot ! > Regards, > Zero - Hubert [1] https://formdef.dev.java.net/ - ALICE SECURITE ENFANTS - Protégez vos enfants des dangers d'Internet en installant Sécurité Enfants, le contrôle parental d'Alice. http://www.aliceadsl.fr/securitepc/default_copa.asp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form population and locale
On 1/17/07, Zero <[EMAIL PROTECTED]> wrote: Hi everybody, I use Struts 1.2.9 and I would like to know if there is any way to link the user locale (available with RequestUtils.getUserLocale(HttRequest)) with the form population process. In fact, I have many forms which have date field (with the java.util.Date type). I would format these fields according to the user locale (ie. "/MM/dd" for english users and "dd/MM/" for french users). Also, I would like that the automatic form population do the same thing. I have a Struts extension [1] that allows you to do this. If you get the binary download, there's a sample app (locale.war) which demonstrates the form accepting dates (02/15/1999 vs. 15/02/1999) and numbers (40,000.50 vs. 40.000,50) formatted depending on the user's locale. Thanks a lot ! Regards, Zero - Hubert [1] https://formdef.dev.java.net/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Does Struts 2 solve the action chaining problem?
If not this specific implementation, an otherwise clean way to handle view preprocessing after a validation failure. It can build on the action-forward-specific command chain, but a solution that's more tightly integrated with action objects should be considered as well. Hubert On 11/30/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote: On 11/29/06, Yujun Liang <[EMAIL PROTECTED]> wrote: > To solve the action chaining problem, I wrote a subclass of > RequestProcessor. In the subclass, override some templates method. In the > last method of process(), I set a flag in request, and I check for this flag > in some methods and if the flag is there, it means it is the chained action > and the processor will skip those template methods. This is an approach that I've been using for quite a while, before I switched to redirection. I think this feature can be included into future releases of Struts 1.x. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Fwd: Help with using formaKey attribute for display dollar values]
Did you declared the variable that holds the "1896 / 100" value as int? On 11/28/06, robin bajaj <[EMAIL PROTECTED]> wrote: Sorry I forgot to mention, I am actually dividing the 1896 cents by 100 before the jsp page to make the value 18.96 and then display it using the formatkey as $18.00. I would appreciate a formatKey pattern that could convert 1896 straight into $18.96 (without me having to divide it by 100). Thanks a lot, robin. -- Forwarded message -- From: robin bajaj <[EMAIL PROTECTED]> To: Struts Users Mailing List Date: Tue, 28 Nov 2006 16:04:39 -0500 Subject: Help with using formaKey attribute for display dollar values Hi Folks, If I have an int value ( showing number of cents) in session scope that is going to get displayed on the JSP as dollar value. I am using the following tag where I have the following key defined in my .properties file format.msf=$#,##0.00 But the above converts a value of 1896 cents to $18.00 How can I make it show up as $ 18.96 itself.? Any help would be much appreciated, regards, robin. - 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: initial values and reset method relation
If you consult the documentation for the reset() method [1], you'll see it's mainly for resetting checkbox values: "This method is not the appropriate place to initialize form value for an "update" type page (this should be done in a setup Action). You mainly need to worry about setting checkbox values to false; most of the time you can leave this method unimplemented." Hubert [1] http://struts.apache.org/1.x/struts-core/apidocs/org/apache/struts/action/ActionForm.html On 11/27/06, fea jabi <[EMAIL PROTECTED]> wrote: Have the below in the form bean. public void reset(ActionMapping mapping, javax.servlet.http.HttpServletRequest request) { super.reset(mapping, request); set("empCost", Boolean.FALSE); set("orders", Boolean.FALSE); } Is it required to call the super.reset()? How is it related to the initialize values? What happens if we don't call the super.reset() in the above reset method and have initial values? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Indexed Property and Hand Cranking Lazy List
Struts is getting confused by: public List getSkills() { return skills; } public void setSkills(Product skill) { this.skills.add(skill); } The getter and setter should be consistent. - Hmm... I just looked at the link you sent and it looks like your code was modelled after that. I've never done it that way, and I would not have expected it to work. What I've done in the past is much closer to the examples under the "Using Commons Collections for lazy Lists" section, where the getter and setter return and accept the same type. Hubert On 11/20/06, Adam K <[EMAIL PROTECTED]> wrote: Hello all, I am sorry to subject this list to yet another person who doesn't understand something, but I can't for the life of me figure out hand cranking lazy lists. I am using 1.2.9 with java 1.5.0_06 And I can't get lazy lists to work. I am trying to use what I found at : http://wiki.apache.org/struts/StrutsCatalogLazyList And as such have : In the ProdSelectionFrom: private List skills = new ArrayList(); public List getSkills() { return skills; } // non-bean version so as not to confuse struts. public void populateSkills(List skills) { this.skills.addAll(skills); } public void setSkills(Product skill) { this.skills.add(skill); } public Product getSkills(int index) { // automatically grow List size while (index >= skills.size()) { skills.add(new Product()); } return (Product)skills.get(index); } In the JSP: And can't even get this to display properly. I am getting the error message: No getter method for property: "skills" of bean: "ProdSelectionForm" javax.servlet.ServletException: javax.servlet.jsp.JspException: No getter method for property: "skills" of bean: "ProdSelectionForm" Could someone please point me in the right direction as I am at my wits end on this. The entire point of what I am trying to do is to be able to post a list of information about a product (such as description, number, price etc) and allow the user to edit the number and have them submit the form so that I can update a database with a new order. I am using a product Object which has all of the characteristics mentioned before as well as others, and each of them have publically available getter and setter methods. I would also like to confirm that the comment I read that I should be using strictly strings when dealing with the jsp is correct - can someone confirm that ? Also is there a problem using ArrayList over List ? Thanks so much for any thoughts/ time you can give me. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dont exist ForwardAction ??
I think he's looking for: Daniel, ForwardAction is no longer needed because you can now forward directly without using an Action class. Hubert On 11/21/06, Laurie Harper <[EMAIL PROTECTED]> wrote: daniel blanco cuadrado wrote: > hello again, thank for the previous answer. > > I would like to use a ForwardAction, but in struts core 1.3.5 don't > exist in org.apache.struts.action. Don`t exist ForwardAction yet ? or > now is ForwardingActionForward ??? Perhaps you're thinking of ActionForward? http://struts.apache.org/1.x/struts-core/apidocs/org/apache/struts/action/ActionForward.html L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Indexed Properties
Lots of people have done it. Search the archives [1]. Search for "indexed" and "lazyList". I've done it with both ActionForm and DynaActionForm. Hubert [1] http://struts.apache.org/mail.html On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote: I think I have found the problem - or at least a potential cause. Would it be correct in stating that this will not work using ActionForm (what I was using) and that I must instead use DynaActionForm ? Thanks for the time thus far. On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote: > > Adam, > > Try adding a getResultsPage() that doesn't take params and always > returns a valid collection. (Throw in the setResultsPage() that > accepts a collection as well.) > > Hubert > > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote: > > This has been driving me nuts for the past little bit. > > I have a page that is populated using indexed properties. The > prepopulation > > works fine, and I get the results as I would expect them, but trying to > > submit the form I get an index out of bounds exception. I know that it > is > > being caused because the page doesn't have the arrayList to use in the > > indexed properties. I guess my question boils down to using indexed > > properties properly. I will start by putting in an explanation of what > I > > have and what I am trying to do: > > > > The following is what I am working with : > > JSP: > > > > > > > id="ResultsPage"> > > > > property="description" > > /> > > property="numProducts" > > indexed="true" /> > > > > > > > > > > What I am trying to achieve is that a user clicks on a link, they are > sent > > to page, and all of the values are prepopulated. The page is then > displayed > > and the user has the option to modify any of the variables that they > want to > > before resubmitting the page. (When they resubmit the form has a url > > parameter attached to it). What is happening (or at least what I > believe is > > happening is the following: link is clicked, reset is called action > sets > > the variables, page is displayed, user can modify the page and resubmit, > > reset is called on the form, the action is called (this is where it dies > as > > there is no longer an ArrayList) to modify. My question is am I going > about > > this in a manner that seems sensible or am I way off base ? I have the > > values being prepopulated, but when trying to use the values that the > user > > puts in I can't use them in the action, nor can I pull the values from > the > > form without again setting the values in the form. I am hoping it is > that > > I have over looked something, but it's possible that I don't understand > > something as well. > > > > Here is the Action code (This is the entire execute method) : > > HttpSession session = request.getSession(); > > ProdSelectionForm prodSelection = (ProdSelectionForm) form; > > User user ; > > user = (User)session.getAttribute("User"); > > Order order = new Order(); > > ArrayList products = new ArrayList(); > > ArrayList pageRes = new ArrayList(); > > ArrayList results = new ArrayList(); > > > > String action = (request.getParameter("Dest") == null ? > "populate" : > > request.getParameter("Dest") ); > > > > order = user.getCurrOrder(user); > > > > if(action.equals("populate")) > > { > > prodSelection.setResults(order.getProducts()); > > } > > > > if(action.equals("Delete")) > > { > > ArrayList p = new ArrayList(); > > p = prodSelection.getResults(); > > > > int count = 0; > > while (count < p.size()) > > { > > Product t = (Product) p.get(count); > > t.setDescription("" +t.getNumProducts() +">" > +pageRes.size() > > +"<"); > > p.set(count, t); > > count++; > > } > > > > t.setDescription("" +t.getNumProducts() +">" +p.size() > +"<"); > > p.set(0, t); > > > > user.setOrder(p , user); > >
Re: Indexed Properties
Adam, Try adding a getResultsPage() that doesn't take params and always returns a valid collection. (Throw in the setResultsPage() that accepts a collection as well.) Hubert On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote: This has been driving me nuts for the past little bit. I have a page that is populated using indexed properties. The prepopulation works fine, and I get the results as I would expect them, but trying to submit the form I get an index out of bounds exception. I know that it is being caused because the page doesn't have the arrayList to use in the indexed properties. I guess my question boils down to using indexed properties properly. I will start by putting in an explanation of what I have and what I am trying to do: The following is what I am working with : JSP: What I am trying to achieve is that a user clicks on a link, they are sent to page, and all of the values are prepopulated. The page is then displayed and the user has the option to modify any of the variables that they want to before resubmitting the page. (When they resubmit the form has a url parameter attached to it). What is happening (or at least what I believe is happening is the following: link is clicked, reset is called action sets the variables, page is displayed, user can modify the page and resubmit, reset is called on the form, the action is called (this is where it dies as there is no longer an ArrayList) to modify. My question is am I going about this in a manner that seems sensible or am I way off base ? I have the values being prepopulated, but when trying to use the values that the user puts in I can't use them in the action, nor can I pull the values from the form without again setting the values in the form. I am hoping it is that I have over looked something, but it's possible that I don't understand something as well. Here is the Action code (This is the entire execute method) : HttpSession session = request.getSession(); ProdSelectionForm prodSelection = (ProdSelectionForm) form; User user ; user = (User)session.getAttribute("User"); Order order = new Order(); ArrayList products = new ArrayList(); ArrayList pageRes = new ArrayList(); ArrayList results = new ArrayList(); String action = (request.getParameter("Dest") == null ? "populate" : request.getParameter("Dest") ); order = user.getCurrOrder(user); if(action.equals("populate")) { prodSelection.setResults(order.getProducts()); } if(action.equals("Delete")) { ArrayList p = new ArrayList(); p = prodSelection.getResults(); int count = 0; while (count < p.size()) { Product t = (Product) p.get(count); t.setDescription("" +t.getNumProducts() +">" +pageRes.size() +"<"); p.set(count, t); count++; } t.setDescription("" +t.getNumProducts() +">" +p.size() +"<"); p.set(0, t); user.setOrder(p , user); prodSelection.setResults(p); prodSelection.setTest(prodSelection.getTest()+" + " + p.size()); return mapping.findForward("success"); } return mapping.findForward("success"); Form code: (In the form code is an ArrayList called results. This arraylist contains a bunch of Product ) public Product getResultsPage(int index) { if(this.results == null) { this.results = new ArrayList(); } while(index >= this.results.size()) { this.results.add(new Product()); } return (Product) results.get(index); } public void setResultsPage(int index, Product p) { if(this.results == null) { this.results = new ArrayList(); } while(index >= this.results.size()) { this.results.add(new Product()); } results.set(index, p); //return (Product) results.get(index); } public void setResults(ArrayList results) { this.results=results; } public ArrayList getResults() { return this.results; } Products is an object that stores various things about a product with numProducts, and description being two of those things. Within Products is both getter and setter methods for the numProducts as well as description. Thanks so much for any help you may be able to provide. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Nested form beans
I can't see anything that would cause your problem. I guess if it were me, I'd fire up my debugger and start stepping through some code. Sorry. All I can say at this point is that I know what you're doing is possible cause that's how FormDef does nested beans. Hubert On 9/22/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: Hehe, way ahead of you :) I put logging in every method... constructors, getters setter, all three forms. Here's the output: MasterForm constructor Tab1Form constructor Tab2Form constructor --NOW IN JSP-- MasterForm getTab1Form() = [EMAIL PROTECTED] MasterForm getTab2Form() = [EMAIL PROTECTED] getting field1 = null getting field2 = null Notice the fields don't get set, nor do the subbeans get set on the containing bean. The MasterForm constructor instantiates Tab1Form and Tab2Form, as the output indicates. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of "Practical Ajax Projects With Java Technology" (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Fri, September 22, 2006 2:53 pm, Hubert Rabago wrote: > It still sounds like Struts is getting nulls for the subbeans when it > tries to populate subbean.fieldX. Put some more logging, this time in > the getters for the subbean in MasterForm, and log what it's > returning. > > Hubert > > On 9/22/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: >> As a follow-up, I threw some logging in the field1 and field2 setters in >> the subbeans... they don't appear to ever get called. I don't have to >> do >> anything special to tell Struts I'm using nested beans, do I? I didn't >> think so... >> >> Frank >> >> >> -- >> Frank W. Zammetti >> Founder and Chief Software Architect >> Omnytex Technologies >> http://www.omnytex.com >> AIM/Yahoo: fzammetti >> MSN: [EMAIL PROTECTED] >> Author of "Practical Ajax Projects With Java Technology" >> (2006, Apress, ISBN 1-59059-695-1) >> Java Web Parts - http://javawebparts.sourceforge.net >> Supplying the wheel, so you don't have to reinvent it! >> >> On Fri, September 22, 2006 2:47 pm, Frank W. Zammetti wrote: >> > Hi Chris.. thanks for the suggestion, I gave that a shot at one point >> > actually... what I get is now the fields in the subforms (I guess >> that's >> > as good a term as any!) don't get set... >> > >> > masterForm = [EMAIL PROTECTED] >> > tab1Form = [EMAIL PROTECTED] >> > tab2Form = [EMAIL PROTECTED] >> > field1 = null >> > field2 = null >> > >> > That's what I see in my final JSP output. >> > >> > Frank >> > >> > >> > -- >> > Frank W. Zammetti >> > Founder and Chief Software Architect >> > Omnytex Technologies >> > http://www.omnytex.com >> > AIM/Yahoo: fzammetti >> > MSN: [EMAIL PROTECTED] >> > Author of "Practical Ajax Projects With Java Technology" >> > (2006, Apress, ISBN 1-59059-695-1) >> > Java Web Parts - http://javawebparts.sourceforge.net >> > Supplying the wheel, so you don't have to reinvent it! >> > >> > On Fri, September 22, 2006 2:40 pm, Chris Pratt wrote: >> >> In your no-arg constructor of your outer ActionForm (the container), >> >> make >> >> sure it instantiates each of the nested ActionForms using their >> no-arg >> >> constructors. >> >> (*Chris*) >> >> >> >> On 9/22/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: >> >>> >> >>> Sorry, by af1 and af2 I did mean actionForm1 and actionForm2... my >> >>> mistake >> >>> wasn't quite *THAT* obvious! ;) LOL >> >>> >> >>> Frank >> >>> >> >>> >> >>> -- >> >>> Frank W. Zammetti >> >>> Founder and Chief Software Architect >> >>> Omnytex Technologies >> >>> http://www.omnytex.com >> >>> AIM/Yahoo: fzammetti >> >>> MSN: [EMAIL PROTECTED] >> >>> Author of "Practical Ajax Projects With Java Technology" >> >>> (2006, Apress, ISBN 1-59059-695-1) >> >>> Java Web Parts - http://javawebparts.sourceforge.net >> >>> Supplying the wheel, so you don't have to reinvent it! >> >>> &g
Re: Nested form beans
gt; > return this.action2Form; >>> > } >>> > } >>> > >>> > >>> > The Action everything gets submitted to is just a ForwardAction, >>> which >>> > forwards to: >>> > >>> > >>> > <%@ page language="java" import="app.test.formbeans.*" %> >>> > <% >>> > MasterForm masterForm = >>> (MasterForm)request.getAttribute("masterForm"); >>> > %> >>> > <%="masterForm = " + masterForm + ""%> >>> > <% >>> > Tab1Form tab1Form = null; >>> > Tab2Form tab2Form = null; >>> > if (masterForm != null) { >>> > tab1Form = masterForm.getTab1Form(); >>> > tab2Form = masterForm.getTab2Form(); >>> > } >>> > %> >>> > <%="tab1Form = " + tab1Form + ""%> >>> > <%="tab2Form = " + tab2Form + ""%> >>> > <% if (tab1Form != null) { %> >>> > <%="field1 = " + tab1Form.getField1() + ""%> >>> > <% } %> >>> > <% if (tab2Form != null) { %> >>> > <%="field2 = " + tab2Form.getField2() + ""%> >>> > <% } %> >>> > >>> > >>> > The result I see from this is: >>> > >>> > >>> > masterForm = [EMAIL PROTECTED] >>> > tab1Form = null >>> > tab2Form = null >>> > >>> > >>> > The page that does that submit, in its final rendered form on the >>> client >>> > is: >>> > >>> > >>> > >>> > >>> > >>> > var finalSubmit = null; >>> > function getXHR() { >>> > if (window.XMLHttpRequest) { >>> > return new XMLHttpRequest(); >>> > } else if (window.ActiveXObject) { >>> > return new ActiveXObject("Microsoft.XMLHTTP"); >>> > } >>> > } >>> > function submitAll() { >>> > var tab1Form = dojo.io.encodeForm( >>> > document.getElementById("tab1Form")); >>> > var tab2Form = dojo.io.encodeForm( >>> > document.getElementById("tab2Form")); >>> > finalSubmit = getXHR(); >>> > finalSubmit.onreadystatechange = finalSubmitCallback; >>> > finalSubmit.open("POST", "final.do", true); >>> > finalSubmit.send(tab1Form + tab2Form); >>> > } >>> > function finalSubmitCallback() { >>> > if (finalSubmit.readyState == 4) { >>> > document.getElementById("divResult").innerHTML = >>> > finalSubmit.responseText; >>> > } >>> > } >>> > >>> > >>> > >>> > >> > action="/test/tab1.do"> >>> > Field1: >> type="text"> >>> > >>> > >>> > >> > action="/test/tab2.do"> >>> > Field2: >> type="text"> >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > Note that I removed all the Dojo-related stuff, and some stuff that >>> isn't >>> > related to this submissino, just to try and keep it small, but, the >>> > important thing to note is that when the submission is made, the >>> request >>> > that goes across is a POST to http://localhost:8080/test/final.do, as >>> > expected, and the POST body is: >>> > >>> > tab1Form.field1=val1&tab2Form.field2=val2& >>> > >>> > ...also as expected, verified in Firebug. Lastly, here's >>> struts-config: >>> > >>> > >>> > >>> > >> Struts >>> > Configuration 1.2//EN" >>> > "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd";> >>> > >>> > >>> > >> /> >>> > >>> > >>> > >> > name="masterForm" scope="request" validate="false"> >>> > >>> > >>> > &
Re: Nested form beans
= getXHR(); > > finalSubmit.onreadystatechange = finalSubmitCallback; > > finalSubmit.open("POST", "final.do", true); > > finalSubmit.send(tab1Form + tab2Form); > > } > > function finalSubmitCallback() { > > if (finalSubmit.readyState == 4) { > > document.getElementById("divResult").innerHTML = > > finalSubmit.responseText; > > } > > } > > > > > > > >> action="/test/tab1.do"> > > Field1: > > > > > >> action="/test/tab2.do"> > > Field2: > > > > > > > > > > > > > > > > > > > > Note that I removed all the Dojo-related stuff, and some stuff that > isn't > > related to this submissino, just to try and keep it small, but, the > > important thing to note is that when the submission is made, the request > > that goes across is a POST to http://localhost:8080/test/final.do, as > > expected, and the POST body is: > > > > tab1Form.field1=val1&tab2Form.field2=val2& > > > > ...also as expected, verified in Firebug. Lastly, here's struts-config: > > > > > > > > Struts > > Configuration 1.2//EN" > > "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd";> > > > > > > > > > > > > > name="masterForm" scope="request" validate="false"> > > > > > > > > > > > > > > Note here that I removed the stuff that generated the markup from above > > too, since that seems to be working just fine, I'm pretty sure this is > all > > that would be relevant. > > > > So, seeing any obvious blunders on my part? Thanks Hubert! > > > > Frank > > > > > > -- > > Frank W. Zammetti > > Founder and Chief Software Architect > > Omnytex Technologies > > http://www.omnytex.com > > AIM/Yahoo: fzammetti > > MSN: [EMAIL PROTECTED] > > Author of "Practical Ajax Projects With Java Technology" > > (2006, Apress, ISBN 1-59059-695-1) > > Java Web Parts - http://javawebparts.sourceforge.net > > Supplying the wheel, so you don't have to reinvent it! > > > > On Fri, September 22, 2006 1:10 pm, Hubert Rabago wrote: > >> So what does happen when you submit the form? Are you getting NPEs? > >> > >> By the time Struts attempts to populate the form bean, the nested > >> forms should already be instantiated. You should have getters and > >> setters for af1 and af2, and getAf1() and getAf2() should not return a > >> null. This could be an issue if the form bean is new, either because > >> it's in request scope, or in session scope but was not previously > >> instantiated. > >> > >> Hubert > >> > >> On 9/22/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > >>> I'm facing a situation where ideally I'd like to have a single > >>> ActionForm > >>> like so: > >>> > >>> public class MyActionForm extends ActionForm { > >>> AnotherActionForm1 af1; > >>> AnotherActionForm2 af2; > >>> } > >>> > >>> When in my JSP I do: > >>> > >>> > >>> > >>> ...I do indeed see the value as I expect. The way I did this is to > >>> have > >>> an Action mapping that references MyActionForm, then within the Action > >>> I > >>> instantiate AnotherActionForm1, set the value of field1 on it, and > then > >>> set af1 to that new AnotherActionForm1 instance. That all works > >>> nicely. > >>> > >>> Here's where I run into a problem... > >>> > >>> On the page I basically have 2 separate HTML forms, one for > >>> AnotherActionForm1 and another for AnotherActionForm2. However, I > have > >>> a > >>> SINGLE submit button at the end (just plain button that makes an AJAX > >>> request). onClick of that button, I create a query string from the > >>> values > >>> of both forms, and make a request to the server with the query string > >>> attached. The parameter names of the query string arguments are > >>> af1.field1 and af2.field2, mimicing what's in MyActionForm. The > >>> mapping > >>> that the request goes to again references MyActionForm. > >>> > >>> What I've been told should happen is that Struts should be able to > >>> instantiate those two nested beans and set the properties, since the > >>> parameter names give it the information it needs. This does not > >>> however > >>> seem to be happening. > >>> > >>> So, two questions... first, is that in fact the expected > behavoir? And > >>> two, if so, any ideas what I'm doing wrong? I can post all the > >>> pertinent > >>> config and code, but thought it might be something more generic that > >>> wouldn't require all that. This is the first time I've ever had a > need > >>> to > >>> nest forms like this, so it's a new question for me. > >>> > >>> Thanks all! > >>> > >>> Frank > >>> > >>> > >>> -- > >>> Frank W. Zammetti > >>> Founder and Chief Software Architect > >>> Omnytex Technologies > >>> http://www.omnytex.com > >>> AIM/Yahoo: fzammetti > >>> MSN: [EMAIL PROTECTED] > >>> Author of "Practical Ajax Projects With Java Technology" > >>> (2006, Apress, ISBN 1-59059-695-1) > >>> Java Web Parts - http://javawebparts.sourceforge.net > >>> Supplying the wheel, so you don't have to reinvent 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] > >> > >> > > > > > > - > > 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: Nested form beans
So what does happen when you submit the form? Are you getting NPEs? By the time Struts attempts to populate the form bean, the nested forms should already be instantiated. You should have getters and setters for af1 and af2, and getAf1() and getAf2() should not return a null. This could be an issue if the form bean is new, either because it's in request scope, or in session scope but was not previously instantiated. Hubert On 9/22/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: I'm facing a situation where ideally I'd like to have a single ActionForm like so: public class MyActionForm extends ActionForm { AnotherActionForm1 af1; AnotherActionForm2 af2; } When in my JSP I do: ...I do indeed see the value as I expect. The way I did this is to have an Action mapping that references MyActionForm, then within the Action I instantiate AnotherActionForm1, set the value of field1 on it, and then set af1 to that new AnotherActionForm1 instance. That all works nicely. Here's where I run into a problem... On the page I basically have 2 separate HTML forms, one for AnotherActionForm1 and another for AnotherActionForm2. However, I have a SINGLE submit button at the end (just plain button that makes an AJAX request). onClick of that button, I create a query string from the values of both forms, and make a request to the server with the query string attached. The parameter names of the query string arguments are af1.field1 and af2.field2, mimicing what's in MyActionForm. The mapping that the request goes to again references MyActionForm. What I've been told should happen is that Struts should be able to instantiate those two nested beans and set the properties, since the parameter names give it the information it needs. This does not however seem to be happening. So, two questions... first, is that in fact the expected behavoir? And two, if so, any ideas what I'm doing wrong? I can post all the pertinent config and code, but thought it might be something more generic that wouldn't require all that. This is the first time I've ever had a need to nest forms like this, so it's a new question for me. Thanks all! Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of "Practical Ajax Projects With Java Technology" (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent 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: validate integer with a comma thousands seperator using Validator
Try a mask validator. mask ^\$?\d+(,\d{3})*(\.\d{2})?$ Hubert On 8/4/06, fea jabi <[EMAIL PROTECTED]> wrote: Thanks, Eric. >From: "Givler, Eric" <[EMAIL PROTECTED]> >Reply-To: "Struts Users Mailing List" >To: "Struts Users Mailing List" >Subject: RE: validate integer with a comma thousands seperator using >Validator >Date: Thu, 3 Aug 2006 11:45:28 -0400 > >You could create another validator, and inside that perform a stripping of >non-numeric characters (stripCommas), then >execute code similar to the existing "long range" validator like this: > > > /** > * Determines if a formatted numeric value is between a range as >defined by > * the user-supplied variables: min and max > * > * Note: The only formattting performed is stripping off any commas. >If the > * resulting number does not convert to a Long, then validation will >fail as > * well. > * > * > * Validation succeeds if: > * > *The value in question is null. > *The parsed field value is within the user-supplied >range. > * > * > * @return > * @param application > * @param request > * @param errors > * @param field > * @param va > * @param bean > */ > public static boolean validateFormattedLongRange( > Object bean, > ValidatorAction va, > Field field, > ActionMessages errors, > HttpServletRequest request, > ServletContext application) > { > System.out.println("*** validateFormattedLongRange (" + >field.getProperty() + ") - START"); > boolean isValid = true; > > String value = null; > value = ValidationUtils.evaluateBean(bean, field); > if (!GenericValidator.isBlankOrNull(value)) > { > try > { > long minVal = Long.parseLong(field.getVarValue("min")); > long maxVal = Long.parseLong(field.getVarValue("max")); > // We don't want to do this unless we use map.put to show >tampered value > // value = value.replaceAll("[^-0123456789.]", ""); > value = value.replaceAll("[,]", ""); > long lngValue = Long.parseLong(value); > > if ((lngValue > maxVal) || (lngValue < minVal)) > { > errors.add(field.getKey(), > Resources.getActionMessage(request, va, field)); > isValid = false; > } > } > catch (NumberFormatException nfex) > { > errors.add(field.getKey(), > Resources.getActionMessage(request, va, field)); > isValid = false; > } > } > System.out.println("*** validateFormattedLongRange (" + >field.getProperty() + ") - END, returning " + isValid); > return isValid; > } > >Define this validator in validator-rules.xml: > >classname="view.struts.validator.StrutsValidationExtensions" >method="validateFormattedLongRange" > methodParams="java.lang.Object, >org.apache.commons.validator.ValidatorAction, >org.apache.commons.validator.Field, >org.apache.struts.action.ActionMessages, >javax.servlet.http.HttpServletRequest, >javax.servlet.ServletContext" > msg="errors.fmtLongRange"> > > >Add a rule for a field: > > > > > > > min0 > >max9 > > >Define the message in the resource file (errors.fmtLongRange): > >errors.fmtLongRange={0} must be a valid whole number between {1} and {2}. > > >-Original Message- >From: fea jabi [mailto:[EMAIL PROTECTED] >Sent: Thursday, August 03, 2006 10:01 AM >To: user@struts.apache.org >Subject: RE: validate integer with a comma thousands seperator using >Validator > > >can someone help me with this please? > > > >From: "fea jabi" <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" > >To: user@struts.apache.org > >Subject: validate integer with a comma thousands seperator using >Validator > >Date: Wed, 02 Aug 2006 10:09:19 -0400 > > > >Using struts validator. > > > >have to validate the user entered value. > > > >The value entered should be a positive integer with a comma thousands > >seperator. the number need not be in thousands. > > > >I have as below to check for positive integer without comma seperator. >but > >not sure how to validate if the user entered value with a comma >seperator? > > > >i.e value like 25,349 // how to validate this? > > > > > > > > > > > >test > >(*this* >= 0) > > > >
Re: FormDef
On 8/2/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote: On 7/20/06, Hubert Rabago <[EMAIL PROTECTED]> wrote: > FormDef support nested beans, and nested collections of beans. If you > had a nested Address object, your form would look like: > > > > In your example Address is nested within ActionForm, right? No. What happens is an ActionForm is nested within an ActionForm. ((DynaBean) form).get("address") will return another DynaBean. What if I have an object like Person having Address as its member. All properties are strongly-typed so I do not want to expose them for I/O, instead I want to have autogenerated ActionForm fields so that I could redisplay them on error. Say I do not nest Persion inside ActionForm. Can I still somehow have a string property inside my ActionForm that corresponds to Person.Address? Can this property be autogenerated? This is how FormDef works. Of course, you'll have to tell FormDef about the address form, but that's very easy: FormUtils.getFormValues() and setFormValues() takes care of handling the nested objects, instantiating them as needed. As you can imagine, they can go multiple levels, all nesting Stringified versions of your business objects. In one of my sample apps, I have a "companyForm" with an "addressForm" and a collection of "employeeForm" objects, with each employee having its own "addressForm" nested form. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormDef
(inline) -Original Message- From: Michael Jouravlev [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 6:16 PM To: Struts Users Mailing List Subject: Re: FormDef Um, by nested beans I mean a bean which is a property of ActionForm like Employee, not a bean which is a property of a bean which is a property of an ActionForm, like Address. I guess there is a discrepancy in terminology here ;-) What I mean is this (taken from http://www.rabago.net/struts/formdef/manual.htm): "To declare a form bean using FormDef, simple add a entry in the configuration file, provide the name for your form bean, and the name of the class from which the form bean will be patterned after. ... When the plugin gets executed, it will create a DynaActionForm containing String fields for each property of MyBean. To me MyBean is nested within a DynaActionForm. If this is not a proper term, what do you call it? Calling it just a property will do a disservice (I think so) because it is not a primitive type. Actually, with FormDef, it will be a primitive type (err, String, actually). What FormDef generates is a String field for each field of MyBean. Okay, let's make sure we're talking about the same thing. If I were to just use struts-config.xml to define my forms, here's two ways I can do it. Here's a non-nested approach (Approach 1): BeanUtils.copyProperties(myForm, myBean); Here's my interpretation of a nested approach (Approach 2): myBean = ((DynaActionForm) myForm).get("myBean"); FormDef use Approach 1. So when converters and validators are executed? Is it correct that when I call FormUtils.setFormValues() then output converter is executed (uh, do you have output converters?), and when I call FormUtils.getFormValues() then input converters and validators are executed? Validation or conversion is not executed automatically or at least can be turned off? Yes, there are output converters. Validation would typically be through Commons Validator (like most dyna forms). Conversion happens based on convention but can be configured by the user. Hubert On 7/20/06, Hubert Rabago <[EMAIL PROTECTED]> wrote: > (was: Is there any direct link between model and view in struts..) > > On 7/20/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > Another library, > > FormDef, can build a dynaform based on properties of nested business > > object > > Hey Michael, > > Just thought I'd set the record straight. > FormDef does not require nor enforce nested beans. > > public class Employee { > public String getName() { return name; } > public void setName(String name) { this.name = name; } > > public Date getHireDate() { return hireDate; } > public void setHireDate(Date hireDate) { this.hireDate = hireDate; } > > public int getZipCode() { return zipCode; } > public void setZipCode(int zipCode) { this.zipCode = zipCode; } > } > > ... plus ... > > > > > ... equals ... > > > > > > > > > You're still using traditional ActionForms, and you still need to copy > to and from the form bean and business object (using BeanUtils or > FormDef's own methods). > > So, your form still looks the same way: > > > > > > FormDef support nested beans, and nested collections of beans. If you > had a nested Address object, your form would look like: > > > > > > > Hubert > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormDef
(was: Is there any direct link between model and view in struts..) On 7/20/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote: Another library, FormDef, can build a dynaform based on properties of nested business object Hey Michael, Just thought I'd set the record straight. FormDef does not require nor enforce nested beans. public class Employee { public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getHireDate() { return hireDate; } public void setHireDate(Date hireDate) { this.hireDate = hireDate; } public int getZipCode() { return zipCode; } public void setZipCode(int zipCode) { this.zipCode = zipCode; } } ... plus ... ... equals ... You're still using traditional ActionForms, and you still need to copy to and from the form bean and business object (using BeanUtils or FormDef's own methods). So, your form still looks the same way: FormDef support nested beans, and nested collections of beans. If you had a nested Address object, your form would look like: Hubert [The first part of http://www.rabago.net/struts/formdef/nested.htm explains the same thing, and goes on to explain how nested beans are supported.] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm Use It to Populate JSP fields?
That's how I do it most of the time. If your POJO is in session scope, your Action won't even have to do anything. I usually only use ActionForm when there's a corresponding HTML . If I'm just displaying data on the page, I just pass the POJO. Hubert On 7/18/06, Mississippi John Hurt <[EMAIL PROTECTED]> wrote: But what if my jsp page that I want to display the DAO info is a read only page ie. doesn't have an element on it? Would I still populate the ActionForm and use it to display or would I just pass a regular POJO to jsp and use or jsp or scriptlet to display? On 7/18/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > > On 7/18/06, Mississippi John Hurt <[EMAIL PROTECTED]> wrote: > > Hi, > > I know ActionForm can be used to transfer html-form-input-fields to the > > Action class. But what about the other way around? Can it be used to say > get > > a DAO object and transfer its properties to the ActionForm, which when > the > > request is forwarded to a jsp, is readily available or populates the > labels > > on the screen. > > Of course. See this for some insights: > http://wiki.apache.org/struts/StrutsManualActionClasses You can use > one action or two actions and just one actionform. The actionform acts > as I/O buffer. > > - > 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 1.3.x
On 7/17/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote: On 7/17/06, Adam Hardy <[EMAIL PROTECTED]> wrote: > "In fact, in Struts 1.3, some of the same "convention of configuration" practices are applied in the configuration files: you can define mapping conventions in struts-config.xml without having to define every single action." (from Patrick Lightbody) Um, I don't know anything about that. I presume Patrick was talking about Struts 2.0 based on Webwork. Michael. If I had to guess, I'd say Patrick was talking about the mapping wildcard support we have in Struts 1.x [1]. Hubert [1] http://struts.apache.org/1.x/userGuide/building_controller.html#action_mapping_wildcards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionMapping forward.findForward(str) with dynamic parameters
Do you mean something like ActionRedirect? String key = "task"; String value = "displayAccountDetails"; // this value changes return new ActionRedirect(mapping.findForward("fwdDetail")) .addParameter(key, value); It still won't allow you to redirect to a tile, though. Hubert On 7/14/06, prasad pondugula <[EMAIL PROTECTED]> wrote: Hello all, In an action class, how do we pass some dynamic parameter/values to an action forward. So that we do not need to hard code any values in struts-config.xml's (). Example: TestAction.java: String key = "task"; String value = "displayAccountDetails"; // this value changes dynamically based on some logic. return mapping.findForward("fwdDetail"); Please advice as soon as possible. Regards, Prasad Pondugula - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: hosting
This topic has come up several times already on this list. Try searching one of the mailing list archives listed on http://struts.apache.org/mail.html#Archives. On 7/8/06, Abhimanyu Koul <[EMAIL PROTECTED]> wrote: hi all! can anyone tell me about a good and cheap struts(java) web hosting company preferrably in india or in other locations Regards, Abhimanyu Koul FinEng Solutions (P) Ltd. # +91 22 66950676 Extn. 212 DISCLAIMER This e-mail and any attachments are confidential and intended solelyfor the addressee and may also be privileged or exempt from disclosure under applicable law. If you are not the addressee, or have received this e-mail in error, please notify the sender immediately, delete it from your system and do not copy, disclose or otherwise act upon any part of this e-mail or its attachments E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: failed validation, drop down list and request attribute
You have a few options, and most of them are described by Rick R's "Validate Manually" article [1]. I would avoid the first three and only consider the last four. There's a couple of other ways to do this but you should be able to pick an appropriate solution from Rick's list. Hubert [1] http://www.learntechnology.net/validate-manually.do On 7/10/06, Sandra Reichert <[EMAIL PROTECTED]> wrote: Hi, I have a form which contains textfields and some drop down lists. I use the validator framework to verify the values. The values for the drop down lists are set as attributes in the request. My Problem is, that this variables are empty after a failed validation. What`s the common solution? Or do you know other sites which describes a solution? Please, send me the link. Thanks Sandra - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where dose JSP works in JSF request lifecycle?
On 4/28/06, Craig McClanahan <[EMAIL PROTECTED]> wrote: Sorry for not being clearer. You can indeed register a listener with a declaration -- you get an application wide singleton that has the same lifetime as your application. However, it's also possible to add a phase listener programmatically, by getinng access to the Lifecycle instance (from the LifecycleFactory), and calling addPhaseListener() on it -- the standard JavaBeans event listener registration pattern. You might, for example, want to create a request scope backing bean that registers itself for phase listener events just for the duration of this request (you still have to disambiguate whether the event is for "your" request or not -- easiest way to do that is to compare the FacesContext instance included in the event to the one that was active when your backing bean was created). If you do this, but don't remember to deregister at the end of the request -- and you need to be robust in case exceptions were thrown -- then the list of phase listeners will get longer and longer. And, because there are live references to them in the Lifecycle instance, they would never be garbage collected either. In the very first version of Creator, we were experimenting with request scoped phase listeners like this, and found it easier to use the single instance approach instead. Shale's design benefits from that experience as well. Craig Ok, thanks for the clarification! Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where dose JSP works in JSF request lifecycle?
On 4/28/06, Craig McClanahan <[EMAIL PROTECTED]> wrote: Yes. The way to do this would be to define a phase listener for Render Response phase, and do your data collection in the beforePhase event handler. You also have to remember that your listener is going to receive beforePhase() calls for *all* simultaneously active requests, not just the one page you might be interested in. And, don't forget to deregister yourself as a listener when the request completes, so you don't create a memory leak. Craig, What do you mean deregister the listener? Where is the leak from? My understanding was I register the the PhaseListener in faces-config, and the listener is active for the entire life of my application. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles headaches - should be simple - driving me nuts here...
Rick, My tiles:insert uses name instead of attribute. Then again, I'm no Tiles expert and I don't know what attribute is for. Hubert On 4/14/06, Rick Reumann <[EMAIL PROTECTED]> wrote: > I've used Tiles in the past. Started to implement it in this new app, > and I keep getting error messages like... > > javax.servlet.jsp.JspException: Error - Tag Insert : No value found > for attribute 'header'. > at > org.apache.struts.taglib.tiles.InsertTag.processAttribute(InsertTag.java:690) > at > org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:478) > > > Basically it seems as if none of the attributes I define in my tiles > definition file are being able to be picked up by the main layout. I'm > hoping someone can pick up something that I'm doing really dumb here. > > Here's some info.. > > Tiles Definition > - > >"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN" > "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd";> > > > > > > > > > > > > > (files header.jsp and main.jsp exist. mainLayout.jsp displays fine > also when I remove the tiles:insert sections.) I've also tried the > above 1_3.dtd defintion, but I think that gave me other problems. I > know the above 1_1 version was working in another app that I believe > had my 1.2.7 struts jar. > > mainLayout.jsp > - > > <%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles"; %> > < snipped out extra html junk -> > > > > > > > > > > Again, if I comment out the above tiles:insert lines this page will > display (minus the tiles content I'm trying to add of course). > > struts-config > - > The docs are a bit confusing on this, since in the docs it says you should add > > processorClass="org.apache.struts.tiles.TilesRequestProcessor"> > > I've tried including and remove the above. > > I also include the plugin definition: > > > value="/WEB-INF/tiles-definitions.xml"/> > > > > > > Other thoughts > - > I removed all filters that I have running, thinking maybe they were > mangling some request or session parameters. > > The test i'm doing from the index page just has > > clickme > > And the action-mapping for it: > > path="/authenticate" > type="com.nielsenmedia.npn.action.AuthenticateAction" > > > > > > The AuthenticatAction has been stripped down to simply return > "success" (It doesn't do anything). > > I'm using Struts 1.2.9 but also tried some older jars like 1.2.7. > > > > At 4:00 on a Friday I'm not happy that I can't get this basic Tiles > stuff working. Any ideas what I might be doing wrong? > > Thanks, > Rick > > - > 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: [shale] Anyway to stop auto-load of META-INF/faces-config.xml?
On 4/13/06, Craig McClanahan <[EMAIL PROTECTED]> wrote: > > Not without taking the JAR apart and removing the faces-config.xml that is > there. Auto-loading such files is a feature required by the JSF spec. > > Craig Thanks Craig. I knew it was in the spec, I was just curious if there was a way around it without taking the jar apart. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[shale] Anyway to stop auto-load of META-INF/faces-config.xml?
I'm including shale-tiles.jar in my app, but overriding the TilesViewHandler with my own implementation. However, just including shale-tiles.jar in the app autoloads the META-INF/faces-config.xml, which loads Shale's TilesViewHandler. Is there a way I can include shale-tiles.jar but not autoload its faces-config.xml? thanks, Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [shale] Tiles integration with RI
On 4/11/06, Gary VanMatre <[EMAIL PROTECTED]> wrote: > >From: "Hubert Rabago" <[EMAIL PROTECTED]> > > > > I request /myapp/testing.jsf which renders ok. > > I type in a value in a text field and submit the form. > > In the RI's ViewHandlerImpl.restoreView(), it's looking for > > viewid="/testing.jsp", but the viewid recorded in the sessionMap is > > "/testing.jsf", so the submit request gets treated as a new one > > instead of a postback. > > What am I doing wrong? > > > I've not made time to check out the shale tiles plugin but I know that the RI > and Myfaces do handle the viewid differently. This is a bug in the RI. > Myfaces will always try to replace to the default suffix of anything that > makes it thru the faces servlet. The RI is pretty loose about this. So, if > you are using the RI this might be the reason. > In the clay view handler, I ended up overriding the view id in the restore > view to force the behavior. > Gary I found that RI really does save the view as "/view.jsp" instead of "/view.jsf" even in regular (non-Tiles) requests. The viewId is changed in ViewHandlerImpl.renderView(). The problem is that TilesViewHandler doesn't call this method if it identifies the view as a Tile. The view gets saved as "/view.jsf" because ViewHandlerImpl never got a chance to update the view id. On postback, it's like I described above. The view isn't restored because it's looking for the wrong view id. Unless someone tells me otherwise, I'll file this as a bug. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [shale] Tiles integration with RI
Dick, Sorry, I didn't see this earlier. For those looking through the archives, the answer is to include 'flush="false"' in your tag. Hubert On 4/12/06, Dick Starr <[EMAIL PROTECTED]> wrote: > Hubert, > > I see you got your answer, but I am curious about your > comment. Could you please tell me where it is required in > standalone-tiles. > > I am trying to get standalone-tiles working, but am getting a > JspException error (Can't insert page 'Test' : Illegal to flush within a > custom tag) on my "layout.jsp" when it reaches my " attribute="title"/>", which in turn references my tiles def containing > "". Perhaps the is the > answer to my problem. > > Perhaps you could include your "/baseTemplate.jsp" in your response. > > Thanks for your help. > > Dick > > -Original Message- > From: Hubert Rabago [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 11, 2006 5:28 PM > To: Struts Users Mailing List > Subject: [shale] Tiles integration with RI > > I'm trying to use Shale-Tiles with RI and I'm having trouble submitting > forms. > The page renders okay (once I start using all over the > place), but the submit doesn't work. > I stepped through the code and it looks like there's a viewid mismatch. > > Here's my tile definition: > > > > > > > > > > > > I request /myapp/testing.jsf which renders ok. > I type in a value in a text field and submit the form. > In the RI's ViewHandlerImpl.restoreView(), it's looking for > viewid="/testing.jsp", but the viewid recorded in the sessionMap is > "/testing.jsf", so the submit request gets treated as a new one > instead of a postback. > What am I doing wrong? > > thanks, > Hubert > > - > 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: [shale] Tiles integration with RI
I thought it would have to be something like that. Thanks, Gary. Hubert On 4/11/06, Gary VanMatre <[EMAIL PROTECTED]> wrote: > I've not made time to check out the shale tiles plugin but I know that the RI > and Myfaces do handle the viewid differently. This is a bug in the RI. > Myfaces will always try to replace to the default suffix of anything that > makes it thru the faces servlet. The RI is pretty loose about this. So, if > you are using the RI this might be the reason. > In the clay view handler, I ended up overriding the view id in the restore > view to force the behavior. > Gary > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[shale] Tiles integration with RI
I'm trying to use Shale-Tiles with RI and I'm having trouble submitting forms. The page renders okay (once I start using all over the place), but the submit doesn't work. I stepped through the code and it looks like there's a viewid mismatch. Here's my tile definition: I request /myapp/testing.jsf which renders ok. I type in a value in a text field and submit the form. In the RI's ViewHandlerImpl.restoreView(), it's looking for viewid="/testing.jsp", but the viewid recorded in the sessionMap is "/testing.jsf", so the submit request gets treated as a new one instead of a postback. What am I doing wrong? thanks, Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Open Source Motivations (Re: I Apologize)
Al, Not everyone who posts on the lists are insiders. If you want some insider info, go to the actual people doing the work, like Don Brown. http://marc.theaimsgroup.com/?l=struts-dev&m=114369603519450&w=2 Hubert On 3/30/06, Al Eridani <[EMAIL PROTECTED]> wrote: > On 3/29/06, Craig McClanahan <[EMAIL PROTECTED]> wrote: > > > You need to pay attention to the credibility of who is doing the > > "describing" that you are referring to. > > I just go by what the insiders have published here. If the insiders have > no credibility, let's turn off the lights and go home. > > When the WebWork deal was announced it was made clear that WebWork > was so much better that there was no point in trying to shoehorn it in > the current codebase, but a new Struts Action 2 was going to be created > that was going to be, essentially, WebWork. > > The current Struts, so bad that it could not be fixed, was going to be > re-christened as Struts Action 1 and, for all intents and purposes, > mothballed. > > Of course, it was not put this bluntly, but that was the gist of it. > > Now, to me this qualifies more as a takeover than a merger; a revolution > not evolution. Which, by the way, is fine with me. > > What is not so fine is trying to cling to the Struts name because of its > value as a brand, even though the software is completely different. > > If you are now interested in JSF, more power to you, just let go of the > Struts name. If the other committers think that WebWork is much > better, they should join the WebWork project and leave the reins of > the Struts project with someone else. > > Names that confuse are not very useful. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [1.2.x] Struts 1.2.x on latest Commons releases?
The primary motivation for the recent 1.2.x releases were security issues [1] [2]. Because of this, the goal was to minimize possible upgrade issues, so the changes were limited to security fixes. The upgrade notes on the wiki for 1.2.8 and 1.2.9 [3] mentions that the user may wish to upgrade JCV as well. However, that upgrade is not required to get the security fixes. Hubert [1] http://marc.theaimsgroup.com/?l=struts-dev&m=113297746417689&w=2 [2] http://marc.theaimsgroup.com/?l=struts-dev&m=114316455208813&w=2 [3] http://wiki.apache.org/struts/StrutsUpgrade On 3/28/06, Henri Yandell <[EMAIL PROTECTED]> wrote: > Before I sit and churn through compiling and testing, does anyone know > of any blatant reasons why the Struts 1.2.x release couldn't be using > the latest FileUpload and Validator with all the bugfixes? > > (is there a convention for the [xx] part of the subject when talking > about 1.2.x?) > > Hen > > - > 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: Dynamic DynaActionForms
Maybe you can leverage the LazyActionForm: http://struts.apache.org/struts-action/userGuide/building_controller.html#lazy_action_form_classes Hubert On 3/24/06, Will Hartung <[EMAIL PROTECTED]> wrote: > Simply put I have a need for a configurable form that can have any mixture > of fields on it including, specifically, file uploads. > > Seems to me that the DynaActionForm would be the way to go about this, > however, they're defined in struts-config. > > Clearly, struts already has all of the code to convert an HTML request in to > a DynaActionForm, so I'd rather not reinvent that wheel if possible. > > Now it seems to me that I should be able to simply instantiate my own > DynaActionForm that has all of the properties that coincedently looks like > the form that's being submitted. > > Has anyone done something like this? > > I've been playing with trying to instatiate an DynaActionForm using some > "hand made" FormPropertyConfig's, and then calling > DynaFormAction.initialize(FormConfigBean), but I'm getting some null pointer > exceptions, so I'm obviously missing something. > > I'd also like to intercept the form creation process to make the > DynaActionForm on the fly during the request pipeline and, ideally, stuff > the form in the Request scope where it belongs. Right now I have to stuff it > in to the Session using an Action before the page is displayed, but > obviously this won't work if there is the potential for more than one form > to exist. > > So, anyway, has anyone tried to leverage the Struts pipeline to create "on > the fly" DynaActionForms so you could leverage all of the built in Struts > facilities? Has anyone ever successfully created a DynaActionForm directly > rather than using the struts-config file? > > Thanx! > > Regards, > > Will Hartung > ([EMAIL PROTECTED]) > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Get a list of defined Struts actions at runtime
OOPS! Copy-paste busted. I meant to say, in your struts-config.xml: :D Hubert (ps. what? you think I have all this in memory?) On 3/24/06, Hubert Rabago <[EMAIL PROTECTED]> wrote: > I wouldn't subclass ActionServlet just for this. Try doing this in a > Struts plugin instead: > > package edu.uga.itos; > public class HobbsPlugIn > implements PlugIn { > > public void init(ActionServlet servlet, ModuleConfig config) > throws ServletException { > > String actionList = ""; > ActionConfig[] actionConfigurations = config.findActionConfigs(); > > for(int i = 0; i < actionConfigurations.length; i++) { > actionList += actionConfigurations[i].getPath(); > } > servlet.getServletContext().setAttribute("actionList", actionList); > > } > > public void destroy() { > // does nothing > } > > } > > > and in your struts-config.xml: > > > > > > > Hubert > > On 3/24/06, Brantley Hobbs <[EMAIL PROTECTED]> wrote: > > > > This hint pointed me in the right direction. In case anyone is > > interested, this is how I did it: > > > > - Subclass ActionServlet > > - Override process() > > - Inside process, add the following code: > > > > if(this.getServletContext().getAttribute("actionList") == null) { > > String actionList = new String(); > > ModuleConfig theConfig = this.getModuleConfig(request); > > > > ActionConfig[] actionConfigurations = > > theConfig.findActionConfigs(); > > > > for(int i = 0; i < actionConfigurations.length; i++) { > > ActionConfig thisAction = actionConfigurations[i]; > > actionList += thisAction.getPath(); > > } > > this.getServletContext().setAttribute("actionList", actionList); > > } > > super.process(request, response); > > > > What this does is create a new context parameter called "actionList". > > It's a "/" separated string of the action paths. It's only called if > > the parameter doesn't exist, so if you're already using a parameter by > > that name it won't clobber it, and so that it is only called once (the > > first time any action is called). Of course, you now have to update > > your application descriptor to use your new actionservlet instead of the > > struts one. > > > > This is a quick and dirty proof-of-concept, but it is functional. If > > anyone has a better idea, please share. > > > > Cheers, and thanks Antonio! > > Brantley > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Get a list of defined Struts actions at runtime
I wouldn't subclass ActionServlet just for this. Try doing this in a Struts plugin instead: package edu.uga.itos; public class HobbsPlugIn implements PlugIn { public void init(ActionServlet servlet, ModuleConfig config) throws ServletException { String actionList = ""; ActionConfig[] actionConfigurations = config.findActionConfigs(); for(int i = 0; i < actionConfigurations.length; i++) { actionList += actionConfigurations[i].getPath(); } servlet.getServletContext().setAttribute("actionList", actionList); } public void destroy() { // does nothing } } and in your struts-config.xml: Hubert On 3/24/06, Brantley Hobbs <[EMAIL PROTECTED]> wrote: > > This hint pointed me in the right direction. In case anyone is > interested, this is how I did it: > > - Subclass ActionServlet > - Override process() > - Inside process, add the following code: > > if(this.getServletContext().getAttribute("actionList") == null) { > String actionList = new String(); > ModuleConfig theConfig = this.getModuleConfig(request); > > ActionConfig[] actionConfigurations = > theConfig.findActionConfigs(); > > for(int i = 0; i < actionConfigurations.length; i++) { > ActionConfig thisAction = actionConfigurations[i]; > actionList += thisAction.getPath(); > } > this.getServletContext().setAttribute("actionList", actionList); > } > super.process(request, response); > > What this does is create a new context parameter called "actionList". > It's a "/" separated string of the action paths. It's only called if > the parameter doesn't exist, so if you're already using a parameter by > that name it won't clobber it, and so that it is only called once (the > first time any action is called). Of course, you now have to update > your application descriptor to use your new actionservlet instead of the > struts one. > > This is a quick and dirty proof-of-concept, but it is functional. If > anyone has a better idea, please share. > > Cheers, and thanks Antonio! > Brantley > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: formbean of double type value chages when submitting the form
I'm not sure what you mean by "I am validating the DynaValidatorForm properties to check is the user is entering the right value, ..., which is wrong" but I'm gonna try responding anyway and see if I interpreted you correctly. The validation happens after Struts has populated the form bean but before the Action is called. The idea is that the action will never be called unless you agree that the form's contents are valid and that your action object can handle it. What this means in the context of BeanUtils.copyProperties() is that the String value held by the form property is a value that can be properly converted into a Double (in this case). So Validator well say "0.0" is valid, "120.00" is valid, "1a3" is invalid (cannot be converted to a double). hth, Hubert On 3/24/06, fea jabi <[EMAIL PROTECTED]> wrote: > BeanUtils.copyProperties(myBusinessBean,form)) is copying DynaValidatorForm > String values to the myBusinessBean which is having the right data types. > > But in validator.xml, I am validating the DynaValidatorForm properties to > check if user is entering the right value i.e Double. which is wrong. > > I think I am missing something here. > > Please, explain. thanks. > > > > >From: "Hubert Rabago" <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" > >To: "Struts Users Mailing List" > >Subject: Re: formbean of double type value chages when submitting the form > >Date: Fri, 24 Mar 2006 08:49:50 -0600 > > > >On 3/24/06, fea jabi <[EMAIL PROTECTED]> wrote: > > > thankyou for your response and clear expaination. > > > > > > If I use String for the formbean do I have to convert it to Double > >before i > > > validate? > > > > > > Is there an easier way to convert all form-properties in the form at the > > > same time? > > > >Yes. BeanUtils.copyProperties(). > > > >Hubert > > > >- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > _ > Is your PC infected? Get a FREE online computer virus scan from McAfee(r) > Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 > > > - > 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 Tutorial
I'm not sure how the books didn't fit your needs, but maybe you can give this a try: http://www.learntechnology.net/ It's one of the most common tutorials we pass around in here. Hubert On 3/24/06, Andreas <[EMAIL PROTECTED]> wrote: > Hi, I'm a newbie in Struts so I'm looking for a struts tutorial on the net. > I've revised some books but all of them doesn't fit my needs. Any help would > be appreciated. Thanks a lot. Andreas > > > Broadband interface (RIA) + mail box saftey = > http://Struts_User_List.roomity.com > *Your* clubs, no sign up to read, ad supported; try broadband internet. > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: formbean of double type value chages when submitting the form
On 3/24/06, fea jabi <[EMAIL PROTECTED]> wrote: > thankyou for your response and clear expaination. > > If I use String for the formbean do I have to convert it to Double before i > validate? > > Is there an easier way to convert all form-properties in the form at the > same time? Yes. BeanUtils.copyProperties(). Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: formbean of double type value chages when submitting the form
On 3/24/06, Rahul Akolkar <[EMAIL PROTECTED]> wrote: > On 3/24/06, Hubert Rabago <[EMAIL PROTECTED]> wrote: > > You know, you're right. I don't know why we list those there since > > DynaActionForm can support any type. (pause, think.) > > > The intent probably was to mention that those converters are > *guaranteed* to be available (since they exist in BeanUtils). Not > disputing the patch idea ;-) > > -Rahul Ah, that makes sense! Thank you! A little bit of Struts trivia for me. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: formbean of double type value chages when submitting the form
You know, you're right. I don't know why we list those there since DynaActionForm can support any type. (pause, think.) Hmm, maybe next week I'll find time to fix that. (Patches to docs are welcome!) Anyway, I think you missed a statement a few paragraphs down the same section: "And, of course, while the DynaActionForm may support various binary types, properties used with the html:text tag should still be String properties." Going back on topic, you can use whatever type you need in DynaActionForm as long as you know what you're doing and you can handle the consequences. Laurie's option 1 is an example of handling it yourself, although now that I think about it, I think FormPropertyConfig is the one that replaces the null with "new Double()" which is where you get your "0.0". Ahh, I'll have to look again to see how you can intercept this. So, bottom line, yes, you can put whatever type in Dyna*Form fields you want. I sometimes put other Dyna*Form objects in them. If you do, though, you'll have to know how to handle them yourself. The default form handle only handles Strings and booleans. Hubert On 3/24/06, fea jabi <[EMAIL PROTECTED]> wrote: > so, I should have all form-properties to be of String type and convert to > Double and then validate is it? > > if that is the case then, why do we have the below data types? what is it's > purpose? > > http://struts.apache.org/struts-action/userGuide/building_controller.html > > The types supported by DynaActionForm include: > > java.math.BigDecimal > java.math.BigInteger > boolean and java.lang.Boolean > byte and java.lang.Byte > char and java.lang.Character > java.lang.Class > double and java.lang.Double > float and java.lang.Float > int and java.lang.Integer > long and java.lang.Long > short and java.lang.Short > java.lang.String > java.sql.Date > java.sql.Time > java.sql.Timestamp > > > Thanks. > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts homepage, access to docs
If you're looking for the User Guide for 1.3, you can get to it from the Struts Action Framework page. On the nav menu on the home page, the "Frameworks" section has a link to the Action and Shale frameworks. >From the Action page, a link to the User Guide is available under the "Quick Links" section. (If you were looking for a way to get specifically to the 1.2.x pages, then Niall already had that covered. Sorry for misunderstanding you.) Thanks for the info about the broken links. Can you paste this into a Bugzilla ticket, just to make sure it doesn't get lost? Hubert On 3/9/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > *** Navigation *** > > How do I get to Struts Users Guide located pointing at: > http://struts.apache.org/struts-doc-1.2.x/userGuide/preface.html > from the main Struts page pointing at: > http://struts.apache.org/ > For that matter, how do I get to any docs? "Project Documentation -> > Project Info" on the main page does not seem to have links to the > manual. > > *** Page http://struts.apache.org/struts-doc-1.2.x/userGuide/preface.html *** > > Link to The Java Web Services Tutorial pointing at: > http://java.sun.com/webservices/docs/1.0/tutorial/index.html > is broken, supposedly should be changed to: > http://java.sun.com/webservices/docs/1.6/tutorial/doc/index.html > > Link to PDF version Web Services Tutorial: > http://java.sun.com/webservices/docs/1.0/tutorial/doc/JavaWSTutorial.pdf > automatically resolves by Sun to: > http://java.sun.com/webservices/docs/1.6/tutorial/doc/JavaWSTutorial.pdf > Should it be updated on Struts User's Guide page as well? > > On the other hand, I don't see how JWSDP manual is relevant to plain > HTTP. Maybe it was before, but it is not now. The "HTTP Overview" link > to JWSDP 1.0 pointing at: > http://java.sun.com/webservices/docs/1.0/tutorial/doc/HTTP.html#63796 > cannot be resolved automatically. JWSDP 1.6 does not contain HTTP overview. > > Should these links be revised? "Using Struts" by Chuck Cavaness has a > very nice overview of HTTP workings. The book was once available for > preview, not so now, but maybe Chuck or his publisher can make this > portion available for public as a sample chapter? > > All other links to parts of old Java Webservices manual are broken too. > > Michael. > > - > 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: ActionForm Patterns? Nested Javabeans as ActionForm properties
The FormDef version that has built-in support for nested beans actually requires Struts 1.2.7 or higher. I'm not aware of a "concise document" that covers what you're asking. However, there are upgrade notes you can check for upgrading from 1.1 to 1.2.4, then from 1.2.4 to 1.2.7 [1]. There's not a whole lot involved in the 1.2.4 to 1.2.7 step, mostly just using the new jars, TLD, and validation XML files. You can also look at the release notes for 1.2.4 [2] and 1.2.7 [3] to get an idea of what's changed between versions. Hubert [1] http://wiki.apache.org/struts/StrutsUpgrade [2] http://struts.apache.org//struts-doc-1.2.4/userGuide/release-notes.html [3] http://struts.apache.org//struts-doc-1.2.7/userGuide/release-notes.html On 3/8/06, news.gmane.org <[EMAIL PROTECTED]> wrote: > Joe Germuska wrote: > > Check out FormDef: https://formdef.dev.java.net/ > > I haven't actually had need to apply it, but I believe its intention > > matches your use case. > > I did take an initial look at it, but I missed the details about nested > beans. It does seem to map to what I want to accomplish. > > However, it also seems to require Struts 1.2.4 or higher. Our current > application is using 1.1. So I would need to analyze the requirements and > impact of upgrading struts to a more recent version before being about to > use FormDef. > > On that note, is there a concise document anywhere which describes potential > problems when upgrading to newer versions of Struts? I would need to know > JDK, JSP, Servlet, etc version requirements to make sure our old websphere > instance would support the new version. > > -- > Matt Kruse > http://www.JavascriptToolbox.com > http://www.AjaxToolbox.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can anyone tell me how 2 use this mailing forum
Since no one has mentioned it... Vaneet, before posting your questions, please read the guidelines we have for the list on http://struts.apache.org/mail.html Hubert On 3/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I advise taking out the disclaimer. The addressee is a bot, and if you > want people to read your message, it may be helpful if you don't tell > them it's forbidden. Messages sent to the list are automatically > archived in a number of places, and it's not likely that someone will go > through deleting your emails from those archives. > > > -Original Message- > > From: Vaneet Sharma [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, March 08, 2006 11:19 AM > > To: user@struts.apache.org > > Subject: can anyone tell me how 2 use this mailing forum > > > > > > Regards > > Vaneet. Sharma > > CRISIL. > > Office- (91)-22-56913095 > > M- (91)-93223 39127 > > Disclaimer : > > This message and any attachments (hereinafter referred to as > > the Said Information) are intended solely for the addressee. > > The Said Information is confidential and may be privileged > > and is also prohibited from disclosure. Access, use, copying, > > distribution or e-use of the Said Information by anyone > > except the addressee is unauthorized. If you are not the > > intended addressee, please destroy all copies of the Said > > Information in your possession and also delete the same from > > your computer. Any views expressed in the Said Information > > are those of the individual sender except where the sender, > > with due authority of CRISIL Ltd./CRISIL MarketWire > > Ltd./Global Data Services of India Ltd. specifically states > > them to be the views of CRISIL Ltd./CRISIL MarketWire > > Ltd./Global Data Services of India Ltd. Nothing contained in > > the Said Information is capable or intended to create any > > legally binding obligations on the sender CRISIL Ltd./CRISIL > > MarketWire Ltd./Global Data Services of India L td. who > > accept no responsibility, whatsoever, for loss or damage from > > the use of the Said Information including damage from viruses. > > > > - > 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 getting Validator plugin to work
On 3/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > type="com.globallink.glr.dataentryweb.form.AddSalesProspectForm"> > public class AddSalesProspectForm extends ValidatorForm > Since you're extending ValidatorForm, Validator will try to find validation rules based on the declared form name. Try using in your validator.xml file. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm with ArrayList and logic:iterate .... confusing problem ...
Hans, You're using request scope for your form. When Struts processes the submitted form, it will create a new instance of your ActionForm. The question now is, is the new instance ready to deal with setting values on your ArrayList field? Struts will not instantiate that list for you, it wouldn't know how to. So make sure that when Struts accesses your ActionForm, the ArrayList already exists. Hubert On 3/6/06, Hans-Peter Petek <[EMAIL PROTECTED]> wrote: > > Hello all, > > i have really a stupid problem with my actionform, i try to map a list of > radio-buttons with my ArrayList in the ActionForm ... displaying it, is > working, but after pressing the save-button (submitting the form) i get an > Exception: > [Servlet-Fehler]-[BeanUtils.populate]: java.lang.NullPointerException > > I´ve tried really a lot of thinks, i think that there is some getter/setter > missing with an index ...? All properties has getter and setter methods ... > but i think there should be some getter/setter more when using ArrayList ... > or Lists in general. > > I have added the files ... i really hope that someone could help me ... > because i think this can only be a small stupid mistake :-(( > > > struts-config ... > type="at.mazda.masters.forms.struts.TestForm"> > > > > path="/test" > > type="at.mazda.masters.actions.struts.TestAction" > > scope="request" > > name="testForm" > > input="/test.jsp"> > > > > > > The other stuff is attached ... thanks a lot again for helping me!!! > > I think there is some getter/setter with index missing, but where the hell i > get the information on how to set this ...?!?! > > thanks > > Hans-Peter > > PS: Only for your understanding - right in this case means ... privilege ... > (not right, left) so, i have a role with a lot of rights (list of > privileges) which i want to display. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator Skipping Action
On 2/7/06, Tom Ansley <[EMAIL PROTECTED]> wrote: > > > > > type="com.camp.actions.camper.addCamperAction" > > > name="CamperForm" > > > scope="session" > > > validate="true" > > > parameter="submit" > > > input="/addCamper.jsp"> > > So, it's looking for getFirstName, which DOES exist in the form, except the > "camper" object has not been populated yet because the action which > populates it has not been called. Hence, the null pointer exception. This is your problem right here. You request /addCamper which validate='true'. Because of this, Struts will always call validate(), and so calls to your getters will be made. Since your getters rely on camper, and camper is null, you'll get NPE's each time. The quickest way to fix this would be make sure camper is always available before your getters are called. The better way to fix this would be to use a different action that doesn't require validation if you don't have data to validate. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting handle on application property file in Action class.
getResources(request) is a method of the Action class. > > Is there a way to get handle on Application property file handle in action > > class. Hubert On 1/31/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Is getResources part of org.apache.struts.util.MessageResources > if it does I don't find getResource in it I find getMessageResources which > is expecting config as parameter. > What should I supply as config from Action class ? > > > > > > > > Hubert Rabago <[EMAIL PROTECTED]> > 01/31/2006 11:29 AM > Please respond to "Struts Users Mailing List" > > > To: Struts Users Mailing List > cc: > Subject:Re: Getting handle on application property file in > Action class. > > > Try something like: > > String propertyValue = getResources(request).getMessage("propertyName"); > > Hubert > > On 1/30/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > > Is there a way to get handle on Application property file handle in > action > > class. > > What I mean is if I specify in struts-config.xml > > > > > > and drop my DICE.properties file in WEB-INF/classes directory > > Shouldn't I be able to read this property file from my DAO class which > is > > called from within DispatchAction class. > > Pls. help! > > I am getting FileNotFoundException when I am trying to read it ! > > Digant > > This communication is for informational purposes only. It is not > intended > > as an offer or solicitation for the purchase or sale of any financial > > instrument or as an official confirmation of any transaction. All market > prices, > > data and other information are not warranted as to completeness or > accuracy and > > are subject to change without notice. Any comments or statements made > herein > > do not necessarily reflect those of JPMorgan Chase & Co., its > subsidiaries > > and affiliates > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > This communication is for informational purposes only. It is not intended > as an offer or solicitation for the purchase or sale of any financial > instrument or as an official confirmation of any transaction. All market > prices, > data and other information are not warranted as to completeness or accuracy > and > are subject to change without notice. Any comments or statements made herein > do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries > and affiliates. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting handle on application property file in Action class.
Try something like: String propertyValue = getResources(request).getMessage("propertyName"); Hubert On 1/30/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Is there a way to get handle on Application property file handle in action > class. > What I mean is if I specify in struts-config.xml > > > and drop my DICE.properties file in WEB-INF/classes directory > Shouldn't I be able to read this property file from my DAO class which is > called from within DispatchAction class. > Pls. help! > I am getting FileNotFoundException when I am trying to read it ! > Digant > This communication is for informational purposes only. It is not intended > as an offer or solicitation for the purchase or sale of any financial > instrument or as an official confirmation of any transaction. All market > prices, > data and other information are not warranted as to completeness or accuracy > and > are subject to change without notice. Any comments or statements made herein > do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries > and affiliates > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Nested Tags
On 1/31/06, rama chandrula <[EMAIL PROTECTED]> wrote: > I have a list of objects, and each object inturn has a list of another > object. I want to represent all these objects and the properties of the > inner object in the UI like > > outer[i].inner[j].propertyValue > > How can I use nested tags to do this. Or is there any other solution ?? http://www.keyboardmonkey.com/next/index.jsp has tutorials that cover this. I personally wouldn't do it any other way. As for the beans themselves... if you don't have form beans for these objects yet, take a look at FormDef. It can handle the form bean generation, form population, and bean population for you [1]. There's a sample app that shows using a bean that nests a collection of beans that nests another bean [2]. Otherwise, take a look at using commons-collection's lazyList [3]. I think you can also use the LazyValidatorForm [4] for this. Search the user list archives on more about using lazy list and the lazy validator form [5]. Hubert [1] https://formdef.dev.java.net/ [2] http://www.rabago.net/struts/formdef/downloads.htm [3] http://jakarta.apache.org/commons/collections/api-release/org/apache/commons/collections/list/LazyList.html [4] http://struts.apache.org/struts-action/apidocs/org/apache/struts/validator/LazyValidatorForm.html [5] http://struts.apache.org/mail.html#Archives - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need some advice
You should name the fields in a way that allows Struts (BeanUtils, actually) to get to the correct property, such as "address.street". Also, make sure your accessor for the nested bean always returns a non-null bean, or else you'll get an NPE when the form is submitted. Hubert On 1/31/06, Sony Thomas <[EMAIL PROTECTED]> wrote: > Hi Friends, > > I have an ActionForm and this ActionForm contains another ActionForm > nested in it. Is there is any way to set values to my nested ActionForm > when I submit from the JSP. Please give me some suggestions. > > Thanks in advance > > Sony Thomas > > - > 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]
[ANN] FormDef 1.0 Release
I've always told people I'll start [ANN]ouncing once I hit 1.0, so... FormDef 1.0 has been released and is ready for download. http://www.rabago.net/struts/formdef/ FormDef allows you to easily declare Struts form beans based on existing business classes. This allows an application to reuse property information and keep business classes and form beans in sync. FormDef works with all types of dynamic ActionForms, and FormDef-defined forms can be used like normally-defined form beans. But that is just the beginning. FormDef also has the following features: * Data formatting support to allow html form controls to use formatted text * Conversion methods to format and parse data between your form and business object * Support for beans that nest other beans, or a collection of other beans * Locale support to allow the same form to be used in different locales using different formats * Extensions to allow both form definitions and form validations to reside in one XML More information is available on http://www.rabago.net/struts/formdef/ including downloads, manual, sample applications. Source CVS is hosted by java.net on https://formdef.dev.java.net/. For what's new in this release, and a link to the release notes, please see https://formdef.dev.java.net/servlets/ReadMsg?list=users&msgNo=229 Thanks to all those who've contributed code, patches, ideas, bug reports! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with forwardPattern and modules
I don't have time _right now_ to investigate, but the way you describe your experience with it, sounds like it's a bug. Creating a bugzilla issue for it, or even just to get the "known limitation" notice on Struts documentation, makes sure the issue doesn't get lost in mailing list archives. Hubert On 1/30/06, Günther Wieser <[EMAIL PROTECTED]> wrote: > hi, > > i'm really not sure if i should issue a bug, as it's just not implemented > yet. had some thoughts about how that could be implemented using > forwardPattern etc. but the problem is that this forwardPattern doesn't make > much sense at all if it is used for ALL forwards (and not only for those who > refer to a file/jsp; in the later case, how can the code distinguish between > a forward to a file or any other type of URI before calculating the correct > URI?). > > kr, > guenther > > -- > Günther Wieser > > creative-it > Guglgasse 6/1/11/1 > A-1110 Wien > Austria > http://www.creative-it.com > > "2 Dinge sind unendlich: Das Universum und die > Dummheit der Menschheit, aber beim Universum > bin ich mir nicht so ganz sicher." > Albert Einstein > > > > > > -Original Message- > > From: Hubert Rabago [mailto:[EMAIL PROTECTED] > > Sent: Monday, January 30, 2006 4:25 PM > > To: Struts Users Mailing List > > Subject: Re: problem with forwardPattern and modules > > > > Günther, > > > > Can you file a Bugzilla issue for this? > > > > thanks, > > Hubert > > > > On 1/30/06, Günther Wieser <[EMAIL PROTECTED]> wrote: > > > hi, > > > > > > just for future reference (in case somebody searches for the same > > > problem), i found the "solution" in the README.txt for verson 1.2.8. > > > > > > = > > > KNOWN LIMITATIONS: > > > = > > > > > > The following items identify functionality areas that have not yet > > > been fully implemented or tested: > > > > > > * Use of the "forwardPattern" or "pagePattern" attributes on the > > >element. > > > > > > seems to me this feature has not been implemented yet > > > > > > i was able to solve this by using tiles for page layouting, cause > > > tiles doesn't use any module prefixes etc. but loads a jsp directly > > > from the file system (while a "forward" action in struts-config.xml > > > sends the servlet container the URI that is prefixed with > > the module > > > path, and the container loads the page/URI from filesystem). > > > > > > kr, > > > guenther > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Two questions.
On 1/27/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Very simple two questions . > > 1. How do I get struts log4j messages on my console/my log ? > 2. How do I read application specific properties file in struts > application? Instructions on how to use and configure Log4j are available on http://logging.apache.org/log4j/docs/documentation.html Once you've familiarized yourself with it, you can configure Struts logs using "org.apache.struts" keys: # Print only messages of level WARN or above from Struts. log4j.logger.org.apache.struts=WARN And you're already discussing Item #2 in another thread so I'll skip that. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestProcessor and multiples configuration files
If all the config files are for the same module, make sure you put the request processor definition in just one of those config files. In cases where multiple files (for the same module) carry request processor definitions, the last definition processed upon startup would be the definition that will be in effect. Hubert On 1/27/06, Jérémie GARROT <[EMAIL PROTECTED]> wrote: > Hello, > I have a problem with my struts configuration file. > I use a specific RequestProcessor class that extends RequestProcessor. >but since I cut my struts configuration file in multiples files, > it doesn't work anymore : the standard processor class is invoked > instead of mine. > does anyone have an idea about what happens? > >Thanks > > -- > Jérémie GARROT > I-NOVA / www.i-nova.fr > 11, avenue Albert Einstein > 69100 VILLEURBANNE > tél: +33 (0) 478 279 502 > mob: +33 (0) 625 090 444 > -- > - Idea management: NovaGO. > - Project Portfolio Management: NovaBOARD > - Troubleshooting on industrial equipment: RESPONSE. > > > - > 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 with forwardPattern and modules
Günther, Can you file a Bugzilla issue for this? thanks, Hubert On 1/30/06, Günther Wieser <[EMAIL PROTECTED]> wrote: > hi, > > just for future reference (in case somebody searches for the same problem), > i found the "solution" in the README.txt for verson 1.2.8. > > = > KNOWN LIMITATIONS: > = > > The following items identify functionality areas that have not yet been > fully implemented or tested: > > * Use of the "forwardPattern" or "pagePattern" attributes on the >element. > > seems to me this feature has not been implemented yet > > i was able to solve this by using tiles for page layouting, cause tiles > doesn't use any module prefixes etc. but loads a jsp directly from the file > system (while a "forward" action in struts-config.xml sends the servlet > container the URI that is prefixed with the module path, and the container > loads the page/URI from filesystem). > > kr, > guenther > > > > > -Original Message- > > From: Günther Wieser [mailto:[EMAIL PROTECTED] > > Sent: Friday, January 27, 2006 2:23 PM > > To: 'Struts Users Mailing List' > > Subject: problem with forwardPattern and modules > > > > hi, > > > > i'm trying to configure the controller using > forwardPattern="/$P" pagePattern="/$P"/> > > > > so that it looks for jsp pages in the webroot folder, no > > matter if we are inside a module or not. > > but whatever i enter in the forwardPattern or pagePattern > > properties, no changes in the behaviour. > > > > went through the source code of 1.2.8, and in > > RequestProcessort.internalModuleRelativeForward() i can see > > that this methd doesn't take care of any patterns, just > > combines the module prefix with the URI to get the new URI. > > > > any ideas? > > > > kr, > > guenther > > > > -- > > Günther Wieser > > > > creative-it > > Guglgasse 6/1/11/1 > > A-1110 Wien > > Austria > > http://www.creative-it.com > > > > "2 Dinge sind unendlich: Das Universum und die Dummheit der > > Menschheit, aber beim Universum bin ich mir nicht so ganz sicher." > > Albert Einstein > > > > > > > > > > > > > - > 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: Set values in form bean
If there's a form associated with a request, Struts automatically populates the form bean for you. Just submit the form to a URL with a proper form bean mapping, and struts will populate the form bean with values from request parameters for parameters whose names match those on the form. It doesn't matter if the form you're submitting is hidden or not, or if there isn't even an actual HTML form. Even a GET /myPage.do?id=001 request, if mapped to an action mapping with an associated form, will have its form populated for you by Struts. Hubert On 1/29/06, Deepa Khetan <[EMAIL PROTECTED]> wrote: > No, actually, its my requirement. When user enters a particualr field and > leaves that textbox, i need to get some data from the database and display > him that! So, i am sending the value in the textbox as a hidden parameter of > another form and submitting it! > > Hope u got the real picture > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Issue
This is what's happening: 1) User submit form with invalid data to /Control.do 2) Struts finds action mapping for /Control.do and sees validate="true" 3) Struts call's the form's validate() 4) validate returns false 5) Since validation fails, Struts forwards to the "input" url 6) Go to step 2 There are several possible solutions: 1) Use a different action class to handle the invalid form, set its mapping to validate="false" 2) Set validate="false" on /Control and validate manually 3) Use the same action class but different URL mappings ("/ControlInvalid",validate="false") If you want to investigate (2) but you don't know how, check out Rick's tutorial on http://www.learntechnology.net/validate-manually.do Hubert On 1/29/06, Karthik Manimaran <[EMAIL PROTECTED]> wrote: > Yes. Tried the same and it works now. > > I got a different problem now though. > > The following action results in validation being called recursively > resulting in server crash. >name="privacyPrefForm" scope="request" validate="true" input="Control.do > ?body=privacysecur_set_privacy_pref"> > > > > > If I remove the input attribute a server exception is thrown. How can I make > a page submit to itself on validation errors? > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is struts handling informations differently between post and get?
Struts won't change the value of request parameters. I'm certainly no encoding expert, but if you want to narrow down the cause, try playing with a basic servlet and see what it gets from request parameters. Hubert On 1/30/06, David Delbecq <[EMAIL PROTECTED]> wrote: > Hello dear members, > > We created a seach form using struts. The form uses ISO-8859-1 encoding. > When posting a query with accentuaed characters, no problems. > The browser posts this: > scope=%2Ffiles&requestedNodeResults=15&uri=&xsl=&query=pr%E9cipitations&x=0&y=0 > > notice the %E9 in parameters, which corresponds to 'é' character in iso-8859-1 > Struts handles it without problem, showing the query parameter on screen also > works perfectly. > > However, if i take this query and issues > search.do?scope=%2Ffiles&requestedNodeResults=15&uri=&xsl=&query=pr%E9cipitations&x=0&y=0 > > It all goes wrong, struts decode the %E9 as an interrogation point! > In both cases (POST and GET) the browser does not send a content-encoding to > server (so server has to guess what content encoding is used) > Also, post is not a multipart > > So questions are > 1) is it expected behaviour that struts behave differently on POST and GET > methods regarding the encoding? > 2) how to fix it? (i tried switching to utf-8 for query, it got even worse as > post also don't work anymore then) > > > -- > David Delbecq > Royal Meteorological Institute of Belgium > > - > 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: using an action form if no input from page
If the request being submitted doesn't include form values, I'd say skip the ActionForm. Hubert On 1/27/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > My question concerns jsp pages that provide a read only view of data. In > other words, there won't be a form submitted from the page. Is there a > compelling reason to use an action form in these cases. I've just been using > tags such as c:out with my own beans put in scope. I've noticed that some > people use the ActionForm and jsp form tags to do this same data transfer. > That's strikes me as using the forms not necessarily in the way they were > meant to be. But I'll admit to not being entirely clear on what seems to be > a simple topic, actionForms that is. Any recommendations, with pros and cons. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Locale problem...
On 1/24/06, Niall Pemberton <[EMAIL PROTECTED]> wrote: > However I have just created some new date validation functions that > can do this for you. They are only currently in subversion, the > package javadoc has some examples here: > > http://tinyurl.com/cc7a2 > > Niall >From above URL: "1. Overview Commons Validator serves two purposes: To provide standard, independant validation routines/functions. To provide a mini framework for Validation. "This package has been created, since version 1.2.1, in an attempt to clearly separate these two concerns and is the location for the standard, independant validation routines/functions in Commons Validator. " Cool! Probably long overdue. Thanks for this, Niall! Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying Images from database using Struts tags
You'd have to write an Action which reads the image from the DB and writes it onto the servlet's output stream. There was a thread just yesterday which discussed how to do this. You can set your image URL to that action and provide it with enough parameters to find your image in the DB. Hubert On 1/24/06, Gary Feidt <[EMAIL PROTECTED]> wrote: > Hi Everybody, > > I'm using Struts 1.2.4, with no frills (JSTL, Struts EL) - just using > Struts framework and tags. > > I am exploring the ability to display images from database - never done > this before. I'm guessing I can get the data out by using the > java.sql.getBinaryStream > > Will the tag display a java.io.InputStream, or is there a > better way? > > Thanks, > > Gary > __ > > Confidentiality Statement: > This email/fax, including attachments, may include confidential and/or > proprietary information and may be used only by the person or entity to which > it is addressed. If the reader of this email/fax is not the intended > recipient or his or her agent, the reader is hereby notified that any > dissemination, distribution or copying of this email/fax is prohibited. If > you have received this email/fax in error, please notify the sender by > replying to this message and deleting this email or destroying this facsimile > 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: A util class for EJB tier similar to BeanUtils?
What about, uhm, BeanUtils? What's your hestitation in using BeanUtils in your EJB tier? AFAIK there's nothing that limits BeanUtils to the presentation tier. Hubert On 1/24/06, Sharon Jolly <[EMAIL PROTECTED]> wrote: > Hi, > > > > Am working in a project where I need to get information from a legacy > system and delegate is back and forth in my application using various > objects, dto's and form. The application is Struts1.1 based and I have 3 > layers in this. > > > > My question is if our forms and vo's have the same set of attributes we > use the struts provided BeanUtils.copyProperties method to directly > assign values from VO's to the Form and from the Form back to the VO's > in the web tier. > > > > I have a situation where I need to use a util class similar to the > beanutils to copy all the values from one object to a dto and vice versa > in my EJB tier. The object and the DTO has the same variable name and > the number is also the same. Can someone please help me as this is > really important to the project that am doing? > > > > Thanks in advance. > > > > Regards, > > Sharon > > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > > Information transmitted by this EMAIL is proprietary to iGATE Group of > Companies and is intended for use only by the individual > or entity to whom it is addressed and may contain information that is > privileged, confidential, or exempt from disclosure under > applicable law. If you are not the intended recipient of this EMAIL > immediately notify the sender at iGATE or [EMAIL PROTECTED] > and delete this EMAIL including any attachments > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to use a POJO inside Struts FormBean?
You'll need to rename your "iDef" property if that is what you're calling it, via getIDef/setIDef. That pair will result in a property name of "IDef". If you'd rather not change your accessor methods, then use "IDef.partNumber" instead of "iDef.partNumber". [Wendy can quote the JavaBean spec related to this :)] Also, if you still get some error when the form is submitted, that may mean you're putting the bean in request scope and the IDef property is null and is not available during form bean population. Make sure getIDef() always returns a non-null result. Hubert On 1/12/06, Gupta, Karan <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to use a POJO inside a Struts (1.2.7) FormBean, > but I am unable to access the fields inside the POJO. > > package com.fmm.web.inventory.forms; > public class IDefForm extends ActionForm > { > private IDef iDef; > private List inventoryDefinitions; > > ...getters ..and...setters.. > } > > package com.fmm.web.inventory.beans; > public class IDef > { > private long iDefID; > private String partNumber; > private String description; > private int equipType; > > .getters ...and...setters... > } > > inventoryDefinitions is a simple ArrayList() which I populate in the Action > class and can easily be > used to display several objects using the logic:iterate tag. > To add an object to the underlying DB, I want to use the iDef object bean in > my form, instead of > creating copies of all the individual fields in the form bean. > > This is what I want the form to look like: > > > Part Number: > maxlength="50"/> > Description: > rows="4" cols="40"/> > > ..and so on... > > > > I get this exception: > javax.servlet.ServletException: No getter method for property iDef.partNumber > of bean org.apache.struts.taglib.html.BEAN > > So what is the way to achieve what I am trying to do? > What am I doing wrong? > > Thanks, > Karan > > - > 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: The framework I think I want...
On 1/6/06, Craig McClanahan <[EMAIL PROTECTED]> wrote: > > IIRC, Craig implements Commands the way he did Actions, so there's one > > instance of it for the whole app (per jvm, etc, you know what i mean). > > > That's what the default Commons Chain imlementation does, so that's what the > current 1.3 code does ... if you don't want that, use a different > implementation of org.apache.commons.chain.Chain :-). > > On the other hand, if you're using the CoR design pattern, all your state > information should be in the Context object that gets passed around, not in > instance variables in a Command instance. Therefore, you shouldn't *want* > to have multiple instances of the command classes. Put the per-request > state information in the context (or approprately organized in a session > scope attribute) where it belongs. > > Craig So, Frank, maybe what you want is a per-request POJO action object that gets populated by the framework with request parameters, stuffs the relevant data onto a context object, and triggers a chain to fulfill the request. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: The framework I think I want...
On 1/6/06, Niall Pemberton <[EMAIL PROTECTED]> wrote: > This will be easier to do in Struts 1.3 because rather than having to have a > custom RequestProcessor you simply need to replace the Command that gets the > Action instance with your own version that instantiates a new Action every > time. So rather than using o.a.s.c.c.s.CreateAction create your own > implementation by extending AbstractCreateAction and implement getAction() > method that does this. > Again for the same reasons as above this should be straightforward to do in > Struts 1.3 - you could use a property on the ActionMapping to flag this and > replace the PopulateActionForm command with one that populates the Action. > Niall ... and this is how I did it when I said earlier I played with these approaches, so if anyone out there wants an example, just let me know and I'll send you a url. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: The framework I think I want...
On 1/6/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > The interesting thing is, there are some relatively minor tweaks that > could be done to Struts that would solve a lot of problems. How about > creating Actions per-request? Not at all a significant enhancement, but > think of all the things you could then do. How about a simple flag to > tell the RP to populate the Action rather than an ActionForm, thereby > giving Michael his dream of a combined Action and ActionForm? Again, > we're not talking about a big change. These are also not new ideas by any > stretch, I, and you, and Michael and others have been tossing these things > around for at least a year or more. You're right in that these are not new ideas. I think crazybob implemented something like this a few years ago. I tried it out myself, and was having a lot of fun with it (yes, i'm a geek), but I don't have the time to pursue it right now. Anyway, with Ti, this should no longer be a problem. > ...all of which raises a question that I don't know the answer to... does > Struts 1.3 pool Commands? I.e., if I implement my Actions as Commands, do > I get that per-request functionality I want? If so, that is at least a > step in a good direction. IIRC, Craig implements Commands the way he did Actions, so there's one instance of it for the whole app (per jvm, etc, you know what i mean). > No one thinks Struts is perfect, but based on how many people > use it and use it successfully, it's probably not fair to say it's poor, > or that any one part of it is poor. *Poor* is relative. Struts might've been the bleeding edge of tech years ago, but it's got a lot of catching up to do now. Not that it can't, but instead of slowly catching up, we'll quickly catch up instead by merging with WW. > Frank Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [.do -> JSF/Shale]
On 12/21/05, Craig McClanahan <[EMAIL PROTECTED]> wrote: > > Interestingly, this example confirms the counter argument that Hubert is > raising :-). Double clicking an Open Office document causes that document > to be opened, but *not* where it was when you closed it, or what you might > have captured in the clipboard. That is the difference between an > identifier (a URL for the web, a document path for the word processor) > versus the associated state information that needs to be kept about the > dynamic "position" you are with respect to that document. I don't expect Office to open the document where it was when I was last in it. And I don't expect, say, the Mail Archive to go to the paragraph I was reading when I was last looking at some message. But if I provide it the path to the document I want to open, I want to be able to open it without having to go through a wizard, or a file open dialog, etc. If I know the ID of my yahoo groups, I don't want to have to go through its front page, run a search, select from a list of similarly named groups, just to get to my group. > Put another way, please show me how a Swing app is supposed to handle > bookmarks (or the back button, for that matter). > > "What?" you say? "There IS no such thing!" > > My point exactly :-). My point too. There's no such thing on a swing app, because it's not a web app. If I work on a swing app, I won't impose web app limitations on it. Why would I impose client app limitations on a web app? Why prevent web apps from doing something normal in its environment? > In a Swing world, it's totally up to the application to maintain and restore > any state information it wants to deal with. But, for applications that do > *not* care about such state, dealing with URLs is a distraction to > accomplishing the goals of building the app -- for those folks, let's PLEASE > not make it harder. I don't have anything against making that easier. But making one easier shouldn't have to mean the other one is disallowed. I appreciate that JSF is applying a different approach to web development, making it more like client side development, but it was disappointing when I learned that the cost is difficulty in providing basic web app features as well. > Craig > > Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [.do -> JSF/Shale]
On 12/21/05, Alexandre Poitras <[EMAIL PROTECTED]> wrote: > I think bookmarks are a bad idea in web applications even when not built > with Ajax. After all, an application is stateful and need a *state* to run. > Bookmarks in my mind are made for informational sites wich are staless and > not applications. Do you expect to be able to return in a precise windows in > a desktop application like Open Office for exemple? In my opinion, this type of reasoning is flawed. You should not limit applications in one platform only to what another platform provides. This is like saying colored TV programs should not worry about how the colors look because radio programs don't even provide images. They are different mediums, different platforms, with different characteristics. Each will have different capabilities, and being able to go to a specific page is a basic an ability of web applications. Besides, I may not expect to launch Open Office in a precise dialog box, but if I know I want to open a specific document in open office, I want the ability to double click on that document and have it open right away. I don't want to go through several windows and dialog boxes to search for something I already have in my sight. Just because you're using a framework that makes it harder to support what should be basic functionality provided by the environment you're in, doesn't make supporting it a bad idea. Earlier Struts versions made it hard to do redirects with parameters. The solution is not to spread a gospel that said "redirects with parameters are bad", the solution is to provide support for it in the framework. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator 1.2 with Struts 1.2.7
On 12/20/05, Laurie Harper <[EMAIL PROTECTED]> wrote: > starki78 wrote: > > Hi* > > > > Is this combination (Struts 1.2.7 and Validator 1.2) possible and is it > > recommended to upgrade to this > > Validator version, when you don't Validator up to now? > > > > Thanks Starki > > AFAIK, validator 1.2 should work fine with Struts 1.2.7. That's AFAIK, too. > I thought > Struts 1.2.8 was already using Validator 1.2, though the release notes > don't reflect that so I may be mistaken... We didn't include Validator 1.2 in Struts 1.2.8 to minimize differences between 1.2.8 and 1.2.7. > > L. > Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: The Age-Old problem of validation when you have Nested Items- opinions and Dyna question
Ok, my fault. I focused on the validation part. For this part: > Why if you already have existing code > working great wtih iBATIS, hibernate, or EJBs should you have to try and > re-write all you POJOs to have String properties included in the objects. > That would be a maintenance nightmare and not even really practical. ...I'll give you one guess what my response is. And if you guessed "formdef" you'd be correct. Here's how the "address", "employee", and "company" forms were defined in the sample app I have: To summarize, it says "create addressForm and give it the same fields as my Address object", "create employeeForm and give it the same fields as my Employee object, plus a 'selectedButton' field. Oh, and use the 'addressForm' definition for the 'address' field", and the same essentially for the "companyForm", except I defined "employees" to be a list, and told the converter which form to map its elements to, and which Collection implementation class to use. Hubert On 12/15/05, Rick R <[EMAIL PROTECTED]> wrote: > On 12/15/05, Hubert Rabago <[EMAIL PROTECTED]> wrote: > > > > I've always used String values. > > > But that above is the problem - you can't always have String values returned > to you in nested objects from the domain-layer, backend, mid-tier, etc. When > you query the backend for value objects that have nested objects inside of > them, you can be sure those will have all String fields in them. (I guess > you could if you decided to rewrite the whole backend/midtier but that's > just not feasible or a good idea. Why if you already have existing code > working great wtih iBATIS, hibernate, or EJBs should you have to try and > re-write all you POJOs to have String properties included in the objects. > That would be a maintenance nightmare and not even really practical). > > So the question is how do you deal with the objects that come to you from > the backend that do not have all String properties and you need to update > them from the front end. I'm yet to see a clean solution for this, but I'm > still on my search:) > > -- > Rick > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: The Age-Old problem of validation when you have Nested Items- opinions and Dyna question
I've always used String values. Given that difference, I've seen this work: datePatternStrict MM/dd/ In this case, the form bean has a collection of "employees", and each employee has a "birth" field. Then something like beside the field will show which of the many employees has the invalid date. I have a sample app (minus the tag, though I've just tried that and it works) somewhere you can download it if you want to see it. That sample app actually goes one level deeper: Each "employee" has an address field which is also a nested form, with zip as an int field. Hubert On 12/15/05, Rick R <[EMAIL PROTECTED]> wrote: > Cutting right to the chase... > > I'm curious on how others handle the age-old struts problem of: "How do you > handle nested objects in an ActionForm that have non String properties that > might be editable by a user on a JSP?" > > To provide a watered down example... > > Imagine you go to the DB to get a List of Company objects. Each company > object in the List has nested in it a List of Division objects. Each > Division has a "date" field in it (say a startDate). You then need to > display a form that displays the companies and divisions and could allow the > user to edit the date (in a free-form text field) and submit the form. > > Things work fine if you didn't have to worry about form validation - in > which case, you could just have one property in your ActionForm: List > companies; //set/get and you are done (using the List of Company value > objects). You'd display the data on the form and submit and things are nice. > > However, nested sort of deep is that "date" field. If the user enters in the > date wrong we want to return to the page and display what they entered so > they can fix it. This can't be done if you just want to use the nested value > object(POJO) approach. > > This above scenario is Strut's biggest weakness. (It's compounded with > BeanUtils crazy notion of also not keeping wrapper clases like Integer truly > "null" when a String is null - instead it decides to make the Integer 0). > > Besides wondering how others deal with this annoying problem (other than > moving to another framework like JSF), I was wondering if maybe DyanForms > could be a solution? Can you nest them ? If so then that might be the > answer. Typically I haven't been too fond of DyanForms in the past (for a > couple of reasons), but if it could solve this issue it would definitely be > worth their use. > > -- > Rick Reumann > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: One Action different beans
Take a look at Action mapping wildcards. This could even help maintain sanity since you'll know what bean a certain action call will be expecting. http://struts.apache.org/struts-action/userGuide/building_controller.html#action_mapping_wildcards Btw, questions like these should go to the user list. Hubert On 12/14/05, Stas Ostapenko <[EMAIL PROTECTED]> wrote: > Hi dev@struts.apache.org ! > > I'm interested in such feture. Is it possible to have one action to > handle different beans which can be changed at runtime ? For example I > have such action in struts-config.xml > path="/AddDomainActionArea" > type="AddDomainAction" > name="domainForm" > input="/vm/DomainActionAdd.vm" > validate="true" > scope="request"> > > > > It's ok when I have one object - Domain. But when we have 50 different > objects it's become a problem. Can parameters of action be changed at > runtime ? How it could be implemented. > Any suggestions are welcome. > > 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]
Re: Struts web app suddenly stops working when deployed...Help Please!
Somebody posted in Bugzilla lately that a possibly cause of this problem is an incomplete set of commons-* jars, such as Common BeanUtils, Commons Digester, or Commons Validator [1]. Make sure your jar files are complete. And if anyone has an idea on how we can solve this issue, patches and/or dev discussions are welcome. Hubert [1] http://issues.apache.org/bugzilla/show_bug.cgi?id=37826 On 12/9/05, Marcelo Morales <[EMAIL PROTECTED]> wrote: > Hi > > I tried to figure it out but it is kindda hard when you don't provide > version information. Both lines (that could lead you to an answer) > are empty lines in my struts 1.2.7 source tree (RewriteTag.java:55 > for instance). > > Try to give more information and post the jsp snippet that causing > the exception (seems that it is in a index.jsp file). > > Regards > > Marcelo Morales > > On Dec 9, 2005, at 3:15 PM, O. Oke wrote: > > > Help Please! > > > > BACKGROUND > > == > > Our struts web app works fine on our local (not on the > > internet) Tomcat server, but when we deploy it on the > > web based Tomcat server of our hosting company, we get > > the error below, when we attempt to connect to the > > application. > > > > > > Can anyone please tell me what may be causing this - > > java.lang.NullPointerException. More importantly, > > what can we do to get round this error? > > > > Running in debug mode is not an option since the app > > is deployed on our hosting company's server. > > > > Thank you. > > > > Dele Oke > > > > > > > > > > ERROR MSG > > = > > org.apache.jasper.JasperException > > > > org.apache.jasper.servlet.JspServletWrapper.service > > (JspServletWrapper.java:370) > > > > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java: > > 291) > > > > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) > > > > javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > > > > root cause > > > > java.lang.NullPointerException > > > > org.apache.struts.taglib.TagUtils.pageURL(TagUtils.java:1056) > > > > org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding > > (TagUtils.java:448) > > > > org.apache.struts.taglib.html.RewriteTag.doStartTag(RewriteTag.java: > > 55) > > > > org.apache.jsp.index_jsp._jspx_meth_html_rewrite_0 > > (org.apache.jsp.index_jsp:122) > > > > org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:73) > > > > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) > > > > javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > > > > org.apache.jasper.servlet.JspServletWrapper.service > > (JspServletWrapper.java:322) > > > > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java: > > 291) > > > > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) > > > > javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > > > > > > > > > > ___ > > NEW Yahoo! Cars - sell your car and browse thousands of new and > > used cars online! http://uk.cars.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] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How would you solve this problem?
Sorry for coming in late to the discussion but I only read this thread now. I may have misunderstood the problem. I'm thinking the popup will display a list of providers matching the search parameters, and the user can select any of them by checking one, and the fields on the form on the parent window displays the values for the checked provider. And when the user selects another provider from the results, the form updates itself on the parent window. Did I get it? Well, if I'm close anyway, maybe what I'm thinking will work. I would solve this problem by having the popup concentrate on searching for a provider, and leave the problem of populating form fields to the calling (parent) window. The popup would have a reference to the parent, so I can call a JS function on the parent. With JS, even the function to call can be dynamic, so it could be a parameter that the parent window sends to the popup ("call my 'showProvider' method when the user selects a provider"). The parameter to the "showProvider" method would be the provider ID. When showProvider is called, it would send an XMLHttpRequest to retrieve the details of said provider. I'd have a method which I can call with the XML result of the call, as well as the form name or form variable, and will begin to populate the fields that it finds. With a decent naming convention, I can write this method so that I can reuse it whereever I have this form. The reusable portions would be the popup (completely parameterized), the XMLHttpRequest handling, the form population function, even the method that gets called when a provider is selected. The form names would have to match across all the pages using it. Hope this helps. Let me know if you want me to clarify any point. Sorry if I misunderstood your problem and offered a bogus solution. Hubert On 11/17/05, Preston CRAWFORD <[EMAIL PROTECTED]> wrote: > Okay, this is a little complex, so hopefully I can describe it well so > as not to confuse anyone. > > We have a need for the following. We need a reusable set of actions, > JSPs, etc. that operate in a popup to allow the user to search for a > medical provider. That's easy enough. The catch is this. The reason for > a popup is because the UI requirement is that the user perform the > search and then (as transparent as possible to them) have the page > refresh the portions of the display that say what medical provider is > currently selected. So you might have a page. In other words when the > search is performed a hidden form field will get updated (via Javascript > currently) with selected Provider ID. And then N number of fields are > going to be populated with some data to let the user know which provider > has been selected. > > The trick is that since we're using Javascript currently the Javascript > is basically statically calling form names and form fields and changing > data based on what it's getting from the search action. So something > like this. > > > > > > Obviously problem #1 is that this JSP page can't be used on other views > because it references by name the name of the form. I'm not sure how to > dynamically get this to the JSP page without passing around a token of > some kind or passing around values in the request stream. That seems > like it could get ugly. Plus if I have to update, visually, more than > just the name of the hospital, for example, how would I handle that? > Imagining ANOTHER JSP page with separate Javascript. > >function updateParentAndCloseSelf() { >changeParentFormValue('anotherForm', 'hospital', ' value="${chosenProvider}" />'); >changeParentDOMElement('hospitalLabel', ' value="${chosenProvider}" />'); >changeParentDOMElement('hospitalAddressLabel', ' value="${chosenProvider}" />'); >changeParentDOMElement('hospitalStateLabel', ' value="${chosenProvider}" />'); >window.close(); >} > > In short, it could get REALLY ugly. > > Now another option is that we actually give in (I say give in because > it would mean a page refresh, something that might not go over well), > submit the form, but don't save the data to the database yet, and then > somehow via request or session retain any other field data they may have > changed for when we hit the page again, without saving it to the > database. > > Okay, hopefully that makes some sense. > > Basically we want a popup that performs a search, updates some data on > the page and in the form on the page, without actually doing the final > submit and save. And we'd like it to be reusable, if possible. So far we > can't think of the best way to approach this
Re: Is there an easy way to print error messages
Yes it's Friday indeed (TG). For the benefit of you out there searching the archives, you can accomplish this by using . You can get more information here: http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html Hubert On 11/18/05, Aladin Alaily <[EMAIL PROTECTED]> wrote: > Problem solved... must be Friday. > > Aladin > > > > Hello, > > > > I am using struts 1.2.7 and am having trouble outputing error messages for > > specific fields. > > > > If I have the following (in a form): > > > > > > > > and in my action I do something like: > > > > messages.add("name", new ActionMessage("error.name.required")); > > super.saveErrors(request.getSession(), messages); > > > > > > Now, I would expect that the error message be outputted to the right of > > the textfield ( Error message here), but it doesn't. > > > > Does anyone know if things have changed in 1.2.7... or am I missing > > something here? > > > > Thanks! > > Aladin > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form Beans
Well, I'm not Michael, but... On 11/16/05, Asad Habib <[EMAIL PROTECTED]> wrote: > Hello Michael. Thanks for your input. Doesn't this approach defeat the > purpose of using Struts though? I don't believe so. We're trying to make Struts more flexible and more extensible, and as a result we hope that people continue to extend it and add features Struts doesn't already have, or improve on features it does have. I think using Struts add ons like these give you even more reason to use Struts. > Simplicity is achieved but then the web > app can no longer be considered a standard Struts app, can it? Think of it as Eclipse, with plug ins. Sure you can use just the downloaded package, but wouldn't a JSP plugin make your life easier? The very concept of Struts is changing. Before, you'd get one big download complete with the taglib and tiles extensions. Now they're being broken down into separate packages you can download and add on separately. Even classes like DispatchAction will no longer be part of what's considered the "core" download. You shouldn't limit yourself to the "core" either. Especially if it makes your app simpler, better. Hubert > - Asad > > On Wed, 16 Nov 2005, Michael Jouravlev wrote: > > > On 11/16/05, Asad Habib <[EMAIL PROTECTED]> wrote: > >> Hello. I am new to Struts and would like some advice. Is it better to use > >> one form bean to capture data from several forms that are being submitted > >> in succession or to use one form bean per form (i.e. multiple form beans)? > >> What are the advantages or disadvantages of either approach? Also, I would > >> appreciate if you would forward me to documents on the web, book chapters, > >> etc., that discuss this in detail. Thank you. > > > > I prefer using one formbean. And one action too. Is this looks similar > > to what you want to achieve: > > http://www.superinterface.com/wizard/signupWizard.do > > > > You can read about my approach here: > > http://struts.sourceforge.net/strutsdialogs/wizardaction.html > > > > Michael. > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: The dreaded "Servlet action is not available"
The times I came across this, it was related to an error in my struts-config.xml. Hubert On 11/16/05, Graham Leggett <[EMAIL PROTECTED]> wrote: > Hi all, > > I have been trying to set up a new Struts project from scratch, and > having set up a basic action class, etc I fire off a browser at my URL, > and I get the dreaded "Servlet action is not available" error. > > > Regards, > Graham - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] JSF Interface Design - Is it Truly Limited?
> -Original Message- > From: Mike Duffy [mailto:[EMAIL PROTECTED] > Sent: Friday, November 11, 2005 4:47 PM > To: Struts Users Mailing List > Subject: [OT] JSF Interface Design - Is it Truly Limited? > > > I know there are some leading edge JSF and Shale gurus who > monitor this list. I would hope so too, but wouldn't you get more responses with a JSF-specific list? Anyway, you did send this to the Struts list, so I'm gonna respond even though I'm not a JSF guru. > I have a basic > question: Can rich web application interfaces be created in JSF? I've seen demos, so my guess the answer is "yes". > I've looked at MyFaces and Tomahawk > (http://myfaces.apache.org/). The source code that can be > found in the examples at http://www.irian.at/myfaces/home.jsf > is perplexing. I see data tables, panel groups, and panel > grids for the page layout. I do not see standards based CSS > design. I don't see how you could create rich web > application interfaces with externalized styles using JSF components. Well, you changed the qualifiers now. Earlier the question was just "Can I?" Now it's "Can I, with externalized styles?" Anyway, JSF is a component-oriented framework, and a higher level of abstraction than Struts. Because of that, it's not surprising that you lose some lower-level control. I guess you'd just have to be careful with which set of components you use. Choose those that'll give you access to the lower-level functions that matter to you. > I know the concept is that JSF components can be "rendered" > for different viewing devices; however, I'm not sure the > creators of JSF really thought through the process of how > most web applications are created. I think the usual case is > that a mock up of the web interface is created by marketing > execs and web designers, then that mock up is "wired" by > software engineers (in our case we use Struts for the > wiring). CSS design is very advanced (see: > http://www.csszengarden.com/). It is unrealistic to think > companies are going to retrain their web designers on a new > technology that is less capable then the one they are currently using. I think the target was "corporate developers", but I'm not sure if this was the target for JSF or for Creator (the IDE). Again, I think it's a matter of what your components allow you to do. > As a specific example, the use of such tags in JSF as, > "" is horrible. Well, it's a higher level of abstraction. It's like, when in your Action, you need to call getServlet().someMethod(), whereas before you just called someMethod() directly from your servlet method. Is this a poor metaphor? I think it's pretty close. The higher the level you go to, the farther could get from low-level things you used to take for granted. > Please share some guiding thoughts. Especially, if you have > a link to some cool example pages created with JSF, I'd like > to see them. I remember liking the ICEfaces demos (http://www.icesoft.com/products/demos_icefaces.html), but it turns out they "look" close to other JSF widgets I've seen. Well, I tend to think that components will allow me to control style values. I guess I'll have to see. Right now though, I'm thinking innocent till proven guilty. > Thx. > > Mike Like I said, I'm not a guru. I'm just sharing an opinion. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: java.util.Date in Action Form Bean
This is exactly what FormDef does. It reads your existing bean and configures a form bean for it. Reuse. You can continue to use BeanUtils with the FormDef-configured beans as you would any other form bean, or you can also use FormDef's setFormValues()/getFormValues() and take advantage of its formatting/parsing functionality. Hubert On 11/8/05, Yujun Liang <[EMAIL PROTECTED]> wrote: > Hubert, > > You made a very good point. Thanks for your patient explanation, that's > exactly the problem I am facing, all int fields are initialized to 0. > Probably even I want to use this feature, I need design a DTO for the form, > and put all String or boolean values as properties. > > At beginning I just wanted to re-use some assets, but it turns out some idea > is not feasible, even it is doable. > > Thanks. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: java.util.Date in Action Form Bean
On 11/8/05, Yujun Liang <[EMAIL PROTECTED]> wrote: > in Struts, you can define > >type="com.clear2pay.bph.bean.Instruction"/> > > > and you can just call, > > bean = ((DynaActionForm) form).get(pageName); > in this case pageName = "instruction"; > > and Struts automatically populate a > com.clear2pay.bph.bean.Instructionobject in the form, I feel I have to explain something about Struts form beans. It is not recommended that you use fields other than String and boolean in your form beans. The form bean is where the request parameters are stored before your fields are even validated. If validation fails, you'd ideally want to preserve what the user typed in so s/he can correct his/her input. For instance, if the user typed in "1q3" in field that's meant to hold a numeric value, the field will be marked invalid and the form will be shown to the user again. If the form bean used a String for this property, the user will see the "1q3" value on the input control. If the form bean used an int for the property, the attempt to populate that field with "1q3" would fail and the user would see "0" instead. The same thing applies to date fields. I don't even know what will happen if the user typed in "35 Se[ 2005" on a field that's declared as java.util.Date. The best approach is to use String fields, so the user's input is preserved, and in the case of user errors, they will be able to edit the values they typed in instead of starting over again. Of course, each application has its own set of circumstances, so this may not be an issue for you. If you're still interested in checking out FormDef, though, take a look at http://www.rabago.net/struts/formdef/dev/nested.htm . This page describes FormDef's support for nested beans with the latest dev builds.. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to clear DynaActionForm?
You can set the form's scope to "request". This way, the values don't survive from one request to the next. Hubert On 11/8/05, pc leung <[EMAIL PROTECTED]> wrote: > even the following cannot clear fields in > type="org.apache.struts.validator.DynaValidatorForm" > > > > > > DynaActionForm userProfileForm = (DynaActionForm)form; > ... > userProfileForm.set("chiName", ""); > userProfileForm.set("engName", ""); > return mapping.findForward("success"); > > How can the form's fields be cleared after input successfully? > > Thanks > > > On 11/7/05, pc leung <[EMAIL PROTECTED]> wrote: > > struts-config.xml: > > > type="org.apache.struts.validator.DynaValidatorForm" > > > > > > > DispatchAction class: > > DynaActionForm userProfileForm = (DynaActionForm)form; > > ... > > userProfileForm.reset(mapping, request); > > return mapping.findForward("success"); > > > > The reset function does not clear form. > > How it be cleared? > > > > 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]
Re: "Configuration is frozen" exception thrown for actionMapping.setScope
On 11/7/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi Hubert, > > Thanks for the suggestion. I tried the second option > > 2) Override the default ActionMapping class and set its default "scope" > value to request. > > Extended the ActionMapping class and in the CustomActionMapping > constructor called super.scope="request". It works , however is there > any known issues in using this method OR Anything else also needs to > done I'm not aware of any. If you discover anything, it would be nice if you can share it with this list. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get ACCESS to Locale in TAG class
Is your JSP being accessed directly? If so, you may need to let the Struts RequestProcessor do its work first. then access it the way you would other Struts actions: http://domain/myApp/myPage.do Hubert On 11/4/05, Łukasz Piątkowski <[EMAIL PROTECTED]> wrote: > Hello ! > > I have a problem with accessing LOCALE in my TAG class. When I want > to get LOCALE in my ACTION class I use : > > request.getSession().getAttribute(Globals.LOCALE_KEY) - and it works fine > > in my TAG class I use : > > pageContext.getSession().getAttribute(Globals.LOCALE_KEY) - it is null > > This is the fragment of my code : > "if(pageContext.getSession().getAttribute(Globals.LOCALE_KEY)!=null) > { > > loc=(Locale)pageContext.getSession().getAttribute(Globals.LOCALE_KEY); > lwriter.print("SESSION LOCALE"); > } > else > { > loc=Locale.getDefault(); > lwriter.print("SERVER LOCALE"); > } > " > It always returning SERVER LOCALE :( > > Please HELP ! > > Kind Regards, Lukasz > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: java.util.Date in Action Form Bean
On 11/3/05, Yujun Liang <[EMAIL PROTECTED]> wrote: > Hubert, > > Good morning! ( Since I am sending it from Australia.) Good morning! > How can I convert an input from user to the Date field base on the Locale? > I mean the locale is a varible during the session and conversion can > handle multiple locales. > Sorry for asking this, but in a locale aware web application, the > input is based on Locale > > For example, in US, enter 10/12/2005 it will be converted to October > 12, 2005 and this is December 10, 2005 > if the locale is Australia. How the global converter handles this? Instead of the format itself, you can specify a key into your application resource files: In your resource files, define the format you want to use for that locale: in example.properties (default for Aus?): format.date=dd/MM/ in example_en_US.properties: format.date=MM/dd/ The binary download for FormDef includes locale.war which demonstrates this capability. hth, Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FORMDEF] Combining FormDef and Struts form definitions - 2
On 11/3/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > Started a new thread, so it were visible in GMail. > > That was the idea. If FormDef could somehow pull my definitions from > struts-config.xml or, which is much better, from configured Java > objects, I would not have to redefine the properties in FormDef again. Okay, I see your point. It's to support transitioning existing form beans. > I guess what I can do now is create a small actionform just with > reset() method in it, like Craig advised me. Should work, right? For now, yes, that's about what you can do. And yes, it should work. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: java.util.Date in Action Form Bean
FormDef works fine with Validator. For the most part they won't even be aware of each other. There's no overlap in functionality and they won't get in the way of one another. Hubert On 11/2/05, Yujun Liang <[EMAIL PROTECTED]> wrote: > Hubert, your input is quite valuable. But I just wonder this suppose to be > handled by Struts itsself, > > You may also place a bean instance on your form, and use nested property > references. For example, you might have a "customer" bean on your > ActionForm, and then refer to the property > "customer.name<http://customer.name>" > in your presentation page. This would correspond to the methods > customer.getName() and customer.setName(String Name) on your customer bean. > See the Apache Struts Taglib Developer Guides for more about using the > nested syntax. > http://struts.apache.org/struts-core/userGuide/building_controller.html#action_form_classes > > Do you know whether this BeanDef works with Validator? > > Thanks. > > On 11/3/05, Hubert Rabago <[EMAIL PROTECTED]> wrote: > > > > [ Oh, I missed my cue! :) ] > > > > If your form bean maps to a business object (and it sounds like it > > does since you're using BeanUtils), you can try FormDef: > > http://formdef.dev.java.net/ > > > > You won't need to create a separate ActionForm class or manually > > define your DynaActionForm, FormDef will configure it for you. You > > can also specify how you want your fields formatted, including dates > > and numbers, and use FormDef's conversion methods in place of > > BeanUtils. > > > > Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FORMDEF] Combining FormDef and Struts form definitions
On 11/2/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > > If it were possible to use form definitions made in struts-config.xml, > then you would not have to reimplement this property in FormDef, and I > would not have to wait for you to reimplement it ;-) I would just > apply your patch to my copy of DynaActionForm, and FormDef would pick > up transparently whatever properties are defined in struts-config.xml. > Is it possible at all? Or is it too much work? I've wondered about this feature, but there are some problems. (Not to mention, this is the first time someone asked for it). For instance, what if the form defined isn't a DynaBean? And how would I let the user specify formatting requirements (for dates, numbers, etc)? Still, it's feasible. It's just sort of a reversal of what I tried to do. I wanted to reduce config info. If you defined your form one field at a time in struts-config, then defined them again in formdef-config, then you end up with two places you have to keep in sync. Not to mention validation.xml (if you were using it for that form). With the form defined in FormDef, you're sure the fields on the bean are represented on the form, and they're always in sync. Form field types already default to java.lang.String. You can even put validation rules right there! > In a way, this is similar to explicitly supporting all HTML tag > attributes in Struts tags instead of supporting whatever a developer > put into a tag as attribute, and to let user agent care about that. Not really. The reason the support is there is to allow you to add fields to a form that would otherwise limit you. If UserInfoBean had "username" and "password", the following: ... would give you a dyna form with "username" and "password" string fields. That said, you can customize each field the way you would a property configured in struts-config. Okay, that part's like the tag attribute support you mentioned. However, FormDef allows you to add fields to your form and not be limited by UserInfoBean: ... would give you a dyna form named "LogonForm" with "username", "password", and "selectedButton" fields. And with that add'l field, you can specify type, size, initial as you would in struts-config. > Michael. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FORMDEF] Combining FormDef and Struts form definitions
On 11/2/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > > Um, that is not exactly what I asked about. I want to define > resettable properties in struts-config.xml file (or somewhere else, I > don't care where), for example: > > type="org.apache.struts.validator.DynaValidatorForm"> > >reset="true"/> > Well, once Struts supports resettable fields then it'll be supported by FormDef. FormDef supports the same attributes that supports. (Of course, there's no reset yet in struts-config, so there ain't any yet in formdef. I'll put it there once we get it into struts.) > And then to use defined LogonForm bean in FormDef to bind it to > business class or DTO, kind of like in your example: > > > > > > > > Here "name" attribute refers to the form bean that already defined in > struts-config.xml. Or you create another attribute, whatever. Then you'll define it in FormDef: > If this is not feasible, would be great if you added support for > resettable properties directly to FormDef. I was just thinking that > combining and reusing is better than redefining. > > Michael. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FORMDEF] Combining FormDef and Struts form definitions
On 11/2/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > Hubert, > > I cannot find if you explained it already, how to combine FormDef and > a regular Struts dynaform definitions. In your manual you write only > about DynaValidatorForm. FormDef can only work with forms defined by FormDef. > Considering your recent patch to DynaActionForm, I would like to > define a form with resettable properties, and to use FormDef to link > it to business object. How do I do that? You can specify the form type: http://www.rabago.net/struts/formdef/manual.htm#formtype > > Also, would be nice if you included complete modified classes into > FormDef distro, so they can be JARred directly into existing Struts > setup. Just put a warning about possible incompatibilities with > versions other than 1.3 ;-) (Is it for 1.3? Should work in 1.2.x I > guess). Did you mean the resettable DynaForms? > Michael. > Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: java.util.Date in Action Form Bean
[ Oh, I missed my cue! :) ] If your form bean maps to a business object (and it sounds like it does since you're using BeanUtils), you can try FormDef: http://formdef.dev.java.net/ You won't need to create a separate ActionForm class or manually define your DynaActionForm, FormDef will configure it for you. You can also specify how you want your fields formatted, including dates and numbers, and use FormDef's conversion methods in place of BeanUtils. Hubert On 10/31/05, Yujun Liang <[EMAIL PROTECTED]> wrote: > Laurie, > > Thanks for all the replies. > > Can you point me to a document describe how to change the default converter > used by Struts? I was not aware of that. By the way, what's the disadvantage > to have common beanutil to support java.util.Date as well? > > Thanks > > On 10/30/05, Laurie Harper <[EMAIL PROTECTED]> wrote: > > > > Right, I create a fresh instance of BeanUtilsBean and register the > > converter at the point of use, to avoid that being a problem. > > > > L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: "Configuration is frozen" exception thrown for actionMapping.setScope
On 11/2/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi All, > > In our application, we have decided to force all the actions to use the > request scope. So instead of adding scope ="request" in the > element in struts-config.xml for each action, we extended the > RequestProcessor class as below > > > 1.Is there any workaround to avoid the "Configuration is frozen" > exception This happens when you try to change objects configured through struts-config after the application has started up. > 2.Is there any better way to enforce that all the actions to use some > specific scope (Ex: request) You can: 1) Implement a plugin that'll loop through the action mappings configured and change their "scope" value. 2) Override the default ActionMapping class and set its default "scope" value to request. I'd probably try option (2). You can take a look at the struts-examples.war sample application [included in the struts download] for an example of how this is done. > > Awaiting your replies and Thanks in Advance > > Sajid Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Record locking
For web applications, I tend to think that the more appropriate approach is (what I know to be called) optimistic locking. When a user edits a record, I keep track of the update timestamp (or even better, an update sequence number) of the record selected. This value gets sent back when the user attempts to save the changes. Before persisting the changes to the DB, I check if the timestamp (or seqnbr) still matches the one on the DB. If so, then no one else has modified the data and the update can proceed. If not, then it's up to you - you can show the user the new record values and the changes that s/he made, or ask that the user re-enter changes, etc. In your example, User B will be shown an error message saying the record has changed since he began and can start over or go ahead and proceed with his changes anyway. Hubert On 11/1/05, Murray Collingwood <[EMAIL PROTECTED]> wrote: > Hi all > > As long as I have been on this list I have never heard anybody discuss record > locking. > The scenario is very simple: > > 1. User A clicks an "edit" option to edit a record. > 2. While user A is editing the record user B clicks the same "edit" option > 3. Both users are now editing the same record (or so they think) > 4. User A clicks "save" and the record is updated and displays the changes > made by > user A - user A is happy > 5. User B clicks "save" and these changes overwirte the changes made by user > A, > however user B doesn't know this and the changes made by user B appear. > > Sometime later user A realises that the changes made have disappeared and gets > angry and begins throwing large objects around the room and making lots of > loudish > gutteral noises in an attempt to disperse inner emotional anxiety. > > Well, you get the picture. > > Q. Does Struts assume that the developer will code in the appropriate record > locks in > the database? > > Q. Does anybody actually do this? > > Q. How? What type of record locking do you use? > > TIA > mc > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]