RE: struts books
thx to everyone for their input once again, sorry to have to duplicate the efforts, but it was fun anyways... -Original Message- From: Tin Pham [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 2:28 AM To: [EMAIL PROTECTED] Subject: Re: struts books I recommend getting 2 books, Manning Struts In Action and O'Reilly Programming Jakarta Struts. Butt, Dudley [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, Can anyone recommend which of the struts books as listed I should get. I cannot purchase all. Which of these books are still current with the version of struts currently out there? Pls recommend! thx NOTICE: This message contains privileged and confidential information intended only for the person or entity to which it is addressed. Any review, retransmission, dissemination, copy or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient, is prohibited. If you received this message in error, please notify the sender immediately by e-mail, facsimile or telephone and thereafter delete the material from any computer. The New Africa Capital Group, its subsidiaries or associates do not accept liability for any personal views expressed in this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] NOTICE: This message contains privileged and confidential information intended only for the person or entity to which it is addressed. Any review, retransmission, dissemination, copy or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient, is prohibited. If you received this message in error, please notify the sender immediately by e-mail, facsimile or telephone and thereafter delete the material from any computer. The New Africa Capital Group, its subsidiaries or associates do not accept liability for any personal views expressed in this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: accessing more than 1 formbean in an action class
Thanks shane , I didnt know you could do this. My problem is solved. -Original Message- From: Shane Mingins [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 2:02 AM To: 'Struts Users Mailing List' Subject: RE: accessing more than 1 formbean in an action class Hi Can you not just retrieve the object from the request/session? I had a form in session scope that I access from other action classes like so: MyForm form = (MyForm)request.getSession().getAttribute(MyForm); Shane -Original Message- From: Madhu Nair [mailto:[EMAIL PROTECTED] Sent: Tuesday, 15 July 2003 2:55 a.m. To: [EMAIL PROTECTED] Subject: accessing more than 1 formbean in an action class Hi, I am trying to access more than 1 formbean in an action class. Using the Struts API I am able to retrieve the FormBeanConfig object for a form bean. But I am unable to get the ActionForm object. How to get the same? Regards, Madhu - Madhu Nair Member of Technical Staff, Persistent Systems Private Limited, Pune 411016 INDIA. Tel: +91-20-5678900 Ext: 335 - 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]
trigger an action from a filter?
Hello, How can I call my actionservlet without using a FORM/SUBMIT? Can I trigger it from a Filter-servlet and in that case how? - Terje
Where to build dropdown lists?
Sorry if this is a stupid question, but any help is much appreciated! I have some drop down lists that I populate in my action class, which means I call myPage.do each time. This was working nicely, until I tried adding some validation. If this fails the action class is not called and then when the page tries to find the bean containing the list for the drop down it does not exist! Previously we built the lists in the reset function in the form class, but I was wanting to move all the code out of here with the idea of using the dyna forms. So I was wanting to know, is my only option to build my dropdowns as part of my reset functions? Thanks for any help IV - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Where to build dropdown lists?
Need help here too. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 4:52 PM To: [EMAIL PROTECTED] Subject: Where to build dropdown lists? Sorry if this is a stupid question, but any help is much appreciated! I have some drop down lists that I populate in my action class, which means I call myPage.do each time. This was working nicely, until I tried adding some validation. If this fails the action class is not called and then when the page tries to find the bean containing the list for the drop down it does not exist! Previously we built the lists in the reset function in the form class, but I was wanting to move all the code out of here with the idea of using the dyna forms. So I was wanting to know, is my only option to build my dropdowns as part of my reset functions? Thanks for any help IV - 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]
How to use bean:write format/formatKet
Hi , Can anybody let me know how to use bean:write for formatting the text. What is the difference between format / formaKey in Bean:write attributes ? What are all the valid message format texts that I can use in ApplicationResourse. Kishore Kumar K Covansys India Pvt Ltd *:- [EMAIL PROTECTED] *:- 91-44-22628080-6877 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to use bean:write format/formatKet
hi, u can use bean:write to format dates and numbers. for ex. u have action form private Date date1; if u want to format that using bean:write bean:write name="form" property="date1" format="MM/dd/"/ this renders the date using that format(simpledate format) if u want this format from application resouces , use formatkey which will get the value from the resources. --nagi ---Original Message--- From: Struts Users Mailing List Date: Tuesday, July 15, 2003 02:57:30 PM To: [EMAIL PROTECTED] Subject: How to use Hi ,Can anybody let me know how to use "bean:write" for formatting the text.What is the difference between format / formaKey in Bean:write attributes ?What are all the valid message format texts that I can use in ApplicationResourse. Kishore Kumar KCovansys India Pvt Ltd*:- [EMAIL PROTECTED]*:- 91-44-22628080-6877-To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]. IncrediMail - Email has finally evolved - Click Here
Re: Where to build dropdown lists?
hi, u can set the collection objectas the request attribute for the first time in the action class. so as long u use the same request , u will not need to repopulate the list again. reset is not the right place to populate ur dropdowns -- nagi ---Original Message--- From: Struts Users Mailing List Date: Tuesday, July 15, 2003 02:22:41 PM To: [EMAIL PROTECTED] Subject: Where to build dropdown lists? Sorry if this is a stupid question, but any help is much appreciated!I have some drop down lists that I populate in my action class, which means I call myPage.do each time. This was working nicely, until I tried adding some validation. If this fails the action class is not called and then when the page tries to find the bean containing the list for the drop down it does not exist! Previously we built the lists in the reset function in the form class, but I was wanting to move all the code out of here with the idea of using the dyna forms.So I was wanting to know, is my only option to build my dropdowns as part of my reset functions?Thanks for any helpIV-To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]. IncrediMail - Email has finally evolved - Click Here
Re: Where to build dropdown lists?
OK, another stupid question then! How do I ensure I use the same request? (Sorry my servlet programming isn't as good as it should be! Infact all my programming isn't!) Thanks IV from:Nagendra Kumar O V S [EMAIL PROTECTED] date:Tue, 15 Jul 2003 11:19:10 to: [EMAIL PROTECTED] subject: Re: Where to build dropdown lists? hi, u can set the collection object as the request attribute for the first time in the action class. so as long u use the same request , u will not need to repopulate the list again. reset is not the right place to populate ur dropdowns -- nagi ---Original Message--- From: Struts Users Mailing List Date: Tuesday, July 15, 2003 02:22:41 PM To: [EMAIL PROTECTED] Subject: Where to build dropdown lists? Sorry if this is a stupid question, but any help is much appreciated! I have some drop down lists that I populate in my action class, which means I call myPage.do each time. This was working nicely, until I tried adding some validation. If this fails the action class is not called and then when the page tries to find the bean containing the list for the drop down it does not exist! Previously we built the lists in the reset function in the form class, but I was wanting to move all the code out of here with the idea of using the dyna forms. So I was wanting to know, is my only option to build my dropdowns as part of my reset functions? Thanks for any help IV - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] . http://www.amazon.co.uk/exec/obidos/redirect-home?tag=velloscouk-21placement=home_multi.gifsite=amazon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: trigger an action from a filter?
You could send a redirect or forward the current request to the Struts action (mapping) from a Filter or Servlet. What has lead you to want to do this? Perhaps a simpler solution to your functional needs is possible. -Max - Original Message - From: Terje Hopsø [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 1:47 AM Subject: trigger an action from a filter? Hello, How can I call my actionservlet without using a FORM/SUBMIT? Can I trigger it from a Filter-servlet and in that case how? - Terje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Iterating the resultset contents in the view (jsp)
Well, okay, that makes the discussion a bit more abstract ;-). I understand your point, but the bottom line is that it's just a namespace (package) and an external library (JAR file). To my mind, the real question with either Result or RowSetDynaClass is how far from the data layer do you want the column names to propagate? In some cases that may be all the way to the view layer. Quoting David Graham [EMAIL PROTECTED]: --- Kris Schneider [EMAIL PROTECTED] wrote: I'll admit that using a package called javax.servlet.jsp.jstl.sql in a non-Web app is a bit odd, but I'm not seeing any dependencies on other javax.servlet classes or interfaces or a Web container. I haven't tried it, but I'd bet the examples below would work outside a Web app. Maybe, but it just feels wrong. I know I've made a mistake when something in the app doesn't feel right. David Worth a try sometime... David Graham wrote: That's certainly another option but keep in mind that it ties your app to the web. That may be ok if you don't plan on reusing any of the code from the app but DynaBeans are more appropriate for building layers that are reusable in any environment. David --- Kris Schneider [EMAIL PROTECTED] wrote: Another datapoint: JSTL provides an interface called javax.servlet.jsp.jstl.sql.Result: public interface Result { public SortedMap[] getRows(); public Object[][] getRowsByIndex(); public String[]getColumnNames(); public int getRowCount(); public boolean isLimitedByMaxRows(); } and a utility class javax.servlet.jsp.jstl.sql.ResultSupport: public class ResultSupport { public static Result toResult(ResultSet rs); public static Result toResult(ResultSet rs, int maxRows); } to accomplish something similar. The SortedMap instances returned from Result.getRows are keyed by the ResultSet's column names and use the Comparator String.CASE_INSENSITIVE_ORDER so that you don't have to worry about matching the case of the column name exactly. So, depending on what your preference is, you can just do: ResultSet rs = ...; Result result = ResultSupport.toResult(rs); request.setAttribute(MyConstants.RESULT, result); or: ResultSet rs = ...; Result result = ResultSupport.toResult(rs); Map[] rows = result.getRows(); request.setAttribute(MyConstants.ROWS, rows); David Graham wrote: --- Richard Hill [EMAIL PROTECTED] wrote: Hi, I'm working on an action that gets a resultset from a database table containing 4 columns. I need to pass that information back to the view (jsp) which will iterate over results. My question is what is the best way to do this. Do I create an array for each row in the resultset and insert each array in a collection, passing that back to the view? A fairly standard approach is to create a class that represents a row of your ResultSet and store a List of those objects in the request for the page to iterate over. If you don't want to create a class for each result, you should check out the BeanUtils DynaBeans. This little gem: http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/RowSetDynaClass.html allows you to transer ResultSet data to DynaBeans in a trivial amount of code. David If so, how would you iterate over each array in the collection with the logic:iterate taglib? All of the examples only show iterations over single column lists. Any help would be appreciated. Thanks, Richard -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: two little questions
I would think that Q2 basically depends on which database you're using. You should be able to find out what character encoding your database supports by reading the documentation for the field type you're using (eg varchar). To complete the answer to your first question with a why, yes, you should filter out html, unless you know that all the users can be trusted 100% (and you know that you're not storing any sensitive information in cookies). In the olden days, Easyboards allowed html and, incidentally, javascript, AND stored the username and password in a cookie. It was a simple matter to write a script that called an image on my server with, as arguments, the cookie values (don't worry, I only did it as a proof of concept and filtered out the middle characters of all the passwords before posting it up! :-P). If all you store in the cookie is the session ID, you're probably safe from that type of attack. However, there's other annoying things people can do such as break the layout of your forum. A good solution for an untrusted forum (eg not the internal company forum) would be to turn all the and into lt; and gt; as suggested, and then to provide the alternative of using UBB-like tags, eg [b]..[/b] for bold, etc. You can pick these out with regular expressions yourself, or if you find them there are probably already libraries out there somewhere that will do this for you. -- If education is too expensive, try ignorance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to build dropdown lists?
My solution, which is perhaps not the most efficient memory-wise, is to simply put it in (and retrieve it from) the session rather than the request. Then when I do go through the populating action, if this is a list that is liable to change often I reload it from the database. If it is a fairly static list I just check if it's already there and do nothing if it is. I guess an even better solution (for a general-usage list) would be to put it in the application-wide context, so you load it once for all users (if it's really very static). That solves the memory usage issue, and even if it's non-static you can work around the problem by making sure that you reload the list application-wide whenever it is changed. -- If education is too expensive, try ignorance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaActionForm
The same way as any other action-form? In short, you build an html:select with an html:options tag inside, giving the collection containing the options as a parameter to html:options... -- If education is too expensive, try ignorance. On Mon, 14 Jul 2003 11:58:11 +0100 Qasim Khawaja [EMAIL PROTECTED] wrote: How do you populate Drop down lists in a DynaActionForm? Q - 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: trigger an action from a filter?
Not sure if this is what Terje is after, but you can use a link instead of a form: html:link action=/action/path.../html:link http://jakarta.apache.org/struts/userGuide/struts-html.html#link As Max asked though, it would help to have some more detail on what the requirements are. Quoting Max Cooper [EMAIL PROTECTED]: You could send a redirect or forward the current request to the Struts action (mapping) from a Filter or Servlet. What has lead you to want to do this? Perhaps a simpler solution to your functional needs is possible. -Max - Original Message - From: Terje Hopsø [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 1:47 AM Subject: trigger an action from a filter? Hello, How can I call my actionservlet without using a FORM/SUBMIT? Can I trigger it from a Filter-servlet and in that case how? - Terje -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
MessageRessources
Hello, I have the following scenario. I want to configure the count of items and the values of these in a drop down list. These entries should be shown in the language dependency of the browser. So I created some values like: val.1=house val.2=dog and so on. Unfortunately there is no possibility to read properties with a pattern like val.x. To do that, I have created a startup-servlet which reads the val.x items into the servlet context and shows them via the struts tags on the jsp. The problem is how to show them in the language depedency. Struts already provides a solution for this issue and I would be interessted how the different language dependent property files are configured on the start-up time. Are all config files read and saved in different hashmaps for each language? I would be happy to hear some proposals about this. Juraj - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FW: need help
It all depends on how much maintenance you expect this project will require once you're finished. If it's a fire-and-forget, any shortcuts will do so long as you finish the project on time. If you're going to have to maintain this, you want to do it properly. With this in mind, actions should be 'dumb' things that just call your Manager classes to actually do the work. With this, you end up with tons and tons of actions, but the good aspect is that they're all trivially simple and should be extremely bug-free. This way you can concentrate on the manager and DAO classes for bug-writing-and-finding... So the idea is to have as many forms as required (each with its own form-bean and potentially two associated actions - one to populate the form options/selects/radio buttons/etc, one to retrieve the results and update the database), without trying to consolidate things that look the same into, say, a single action with a couple of if/thens. Don't go into a mode of thinking where you're trying to save on how many actions there are - why do you want to do the work of 2 actions with one?? If you are repeating any non-trivial code in your actions it's a fair bet that you have code in there that shouldn't be there. Doing it this 'right' way will force you to produce large quantities of trivial code but that's the good thing - it's all trivial, it's all easily maintainable, it's all easy to change, it's all very clear to any struts programmer. I suggest getting a good book such as Ted Husted's Struts in Action to get the basics right before you get onto this project by the way, otherwise you'll have no end of trouble. To your question about tiles, yes, tiles is excellent and personally I see no reason *not* to use it in every web-based project. -- If education is too expensive, try ignorance. On Mon, 14 Jul 2003 16:40:07 -0700 Mohan Kalyanasundaram [EMAIL PROTECTED] wrote: Hi, I am new to Struts and I have to complete a project with an aggressive deadline. I want to know the following: My application will have about 80-100 screens each having different action items. Most screens will have a common header, footer, and a navbar. My questions are: I thought of using Tiles for my application. Is that a good idea. - Should I have to have one action form for each screen or can I group the screens and have one action form for a group of screens. Which would be a preferred method? - Should I have to have one action class for each screen or can I group the action classes the same way as forms? Which would be a preferred method? - Every screen of mine is going to be a jsp page. I want to populate the form data at the time when someone enters the page from another page and I want to write the data into the database at the time when the user leaves a page with an action. Is this possible in the same action class? How does the flow work? Does the control go to the action class first before the form data is picked up for display. If that is the case, will there be an easy way for me to set the form data from the same action class for the form before the data is displayed? Where can I see a sample code if I use one single action class for loading the data and for processing the actions within the form? What should be the setting within the struts-config file for the above scenario. Sorry, if my questions are dumb. I need help. Thanks in advance, Mohan - 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: MessageRessources
For your MessageResources, you might want to put those values in a comma, delimited list, and then use the String.split(,) to get your items. JSTL can also take that string and iterate over it via it's own tags. Jacob Hookom Senior Analyst/Programmer McKesson Medical-Surgical Golden Valley, Minnesota http://www.mckesson.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 7:08 AM To: [EMAIL PROTECTED] Subject: MessageRessources Hello, I have the following scenario. I want to configure the count of items and the values of these in a drop down list. These entries should be shown in the language dependency of the browser. So I created some values like: val.1=house val.2=dog and so on. Unfortunately there is no possibility to read properties with a pattern like val.x. To do that, I have created a startup-servlet which reads the val.x items into the servlet context and shows them via the struts tags on the jsp. The problem is how to show them in the language depedency. Struts already provides a solution for this issue and I would be interessted how the different language dependent property files are configured on the start-up time. Are all config files read and saved in different hashmaps for each language? I would be happy to hear some proposals about this. Juraj - 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: FW: need help
The question is whether you have the time to familiarise yourself with struts in order to take advantage of its time-saving features. Tiles would be good, having an action class for each object would be sensible, with different action mappings for display, create, update, delete and other operations. However you may find that rushing everything will cause real delays if you are using struts and you are not sure how to solve problems in areas that you have not learnt. Good luck, Adam Mohan Kalyanasundaram wrote: Hi, I am new to Struts and I have to complete a project with an aggressive deadline. I want to know the following: My application will have about 80-100 screens each having different action items. Most screens will have a common header, footer, and a navbar. My questions are: I thought of using Tiles for my application. Is that a good idea. - Should I have to have one action form for each screen or can I group the screens and have one action form for a group of screens. Which would be a preferred method? - Should I have to have one action class for each screen or can I group the action classes the same way as forms? Which would be a preferred method? - Every screen of mine is going to be a jsp page. I want to populate the form data at the time when someone enters the page from another page and I want to write the data into the database at the time when the user leaves a page with an action. Is this possible in the same action class? How does the flow work? Does the control go to the action class first before the form data is picked up for display. If that is the case, will there be an easy way for me to set the form data from the same action class for the form before the data is displayed? Where can I see a sample code if I use one single action class for loading the data and for processing the actions within the form? What should be the setting within the struts-config file for the above scenario. Sorry, if my questions are dumb. I need help. Thanks in advance, Mohan - 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: [ARTICLE] Succeeding with Struts Pt 2: Indexed Properties ofBeans
On Mon, Jul 14,'03 (06:32 AM GMT-0400), James wrote: http://www.developer.com/java/ejb/article.php/2233591 This month, I covered using indexed arrays of beans to do master/detail records in forms. Thanks James, excellent example! One thing I would now still like to see.. could you alter the code so that rather than providing an array of POLine beans you used a Map of POLine beans? So that you'd iterate over the Map and when you submitted the form each value in the Map (a POLine bean) would be reflected accordingly (maybe each key happened to be partNumbr)? I haven't found a good way to do this using JSTL and Struts-el tags so if you have an example or ideas I'm all ears (or eyes?:) Thanks. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to build dropdown lists?
I designed a system where I can specify in my action which dropdown lists I require with a method call. I route my failed validate requests thro' the action (using the action mapping input tag) every time so the call is always made, and if I specified it should be in the request, the system looks in the request for the collection and if it doesn't find it, it makes it. Same applies to with session and application requirements. Having stuff in the session is not necessarily good, if the user decides to open more than one window. Adam Dichotomy wrote: My solution, which is perhaps not the most efficient memory-wise, is to simply put it in (and retrieve it from) the session rather than the request. Then when I do go through the populating action, if this is a list that is liable to change often I reload it from the database. If it is a fairly static list I just check if it's already there and do nothing if it is. I guess an even better solution (for a general-usage list) would be to put it in the application-wide context, so you load it once for all users (if it's really very static). That solves the memory usage issue, and even if it's non-static you can work around the problem by making sure that you reload the list application-wide whenever it is changed. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to build dropdown lists?
On Tue, Jul 15,'03 (01:56 PM GMT-0100), Dichotomy wrote: My solution, which is perhaps not the most efficient memory-wise, is to simply put it in (and retrieve it from) the session rather than the request. I agree this is the best solution (using Session or Application scope). I brought this topic up a long time ago and ultimately you really have to use Session or Application scope if you plan to use Validation (or else settle for headaches getting it to work correctly with Request scope). If you use just Request scope you end up having to do some'crazier'(aka annoying) things to get the lists of beans for the drop downs to reset when validation fails. Search of the archives if you insist on using Request scope for the form lists and you'll find ways to do it, but none of them seemed worth the hassle(imo). If someone out there still has a nice clean way to get these request scope Lists back in scope after validation fails, I'd be interested in your solution. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to build dropdown lists?
On Tue, Jul 15,'03 (02:32 PM GMT+0200), Adam wrote: I designed a system where I can specify in my action which dropdown lists I require with a method call. I route my failed validate requests thro' the action (using the action mapping input tag) every time so the call is always made, and if I specified it should be in the request, the system looks in the request for the collection and if it doesn't find it, it makes it. Same applies to with session and application requirements. This did seem like the best solution if you insist on using request scope for your Lists on a form. It's still sort of a pain though because now don't you have to code for checking validation success in your Action class method(s) (execute or dispatch methods)? Seems like a lot of the power of the validation framework is you can control it all from config files and your Actions don't even have to worry about it. If insistence on request scope is mandatory, I think this above solution is the best one I've come across. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to build dropdown lists?
Rick Reumann [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, Jul 15,'03 (01:56 PM GMT-0100), Dichotomy wrote: My solution, which is perhaps not the most efficient memory-wise, is to simply put it in (and retrieve it from) the session rather than the request. I agree this is the best solution (using Session or Application scope). I brought this topic up a long time ago and ultimately you really have to use Session or Application scope if you plan to use Validation (or else settle for headaches getting it to work correctly with Request scope). If you use just Request scope you end up having to do some'crazier'(aka annoying) things to get the lists of beans for the drop downs to reset when validation fails. Search of the archives if you insist on using Request scope for the form lists and you'll find ways to do it, but none of them seemed worth the hassle(imo). If someone out there still has a nice clean way to get these request scope Lists back in scope after validation fails, I'd be interested in your solution. -- Rick What about the client side validation feature in the validator framework. This way the you won't have to populate the list at all if validation happens to fail because the form will not post unless it's valid. Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Help: ActionForm Re-Population
On 07/14/2003 01:25:58 PM Aaron Longwell wrote: Oops, spoke too soon. You discussed 2 options: 1) All drop-down list data goes into session 2) input attribute for the update event goes back to edit Action instead of edit JSP I went with #2 and that brings up a new issue. Doing that causes all of the current values for the fields to be lost (i.e. the user inputs a bad number format in a field they click submit and receive the JSP with a list of errors at the top) Because the process went through the edit action again, the Action re-queried the database and updated the ActionForm with database values, overwriting all the user's values (including ones that were correctly edited and contained no errors). To avoid this I have to insert code in the edit Action to check for a populated ActionForm before querying the database. This feels a little messy. Of course I could use the session solution (#1), but I like to avoid using sessions unless absolutely necessary. In addition, these drop downs could have 100's of items in them, I'd like to keep big chunks of data like that in the request. So the alternative, I guess, is to have another action that NEVER queries the database, but just prepares a blank form. I actually already have one of these... it's my create action. Aaron, this sounds like a good idea if it works for you. You can also manually validate in your save action (the action your form submits to) by doing something like: // Validate form parameters ... ActionErrors errors = yourForm.validate(mapping, request); if (errors != null !errors.isEmpty()) { saveErrors(request, errors); //do whatever you need to do to put your //drop-down list values back into the request. return new ActionForward(mapping.getInput()); }// end validate And set validate=false in your edit action mapping. Susan Bradeen This appears to be the best practice in this situation anyone else have any feedback? Thanks again, Aaron Dirk Markert wrote: Hello Aaron, *** AL I am on the last leg of a web application, and I've run into problems AL adding validation to the mix. AL I have an edit Action that retrieves a database record, a list of AL drop-down options, and then populates the editor ActionForm. Works AL great, and I LOVE STRUTS! AL Now I've implemented validation (through the Validator Framework, but I AL think my problem is with validate() in general). AL After the user clicks submit, their post is sent to my update action. AL If they do not break any validation rules, all goes well. The problem AL occurs when a validation rule is broken They are returned to the AL form... but the drop-downs (which are populated in the edit Action) AL are empty. I have set breakpoints in the code... and I see that the page AL neither my edit Action code (the part where the drop-down data is AL retrieved), nor my update Action code is actually running. AL Question between pressing submit and returning the edit JSP with a AL populated ActionErrors object. Where is validate() actually called? After the RequestProcessor has populated your action form, validate is called. This happens before your action is called. AL Where can I insert code to populate a drop-down with a set of values so AL that it will appear both when the form is presented the first time, and AL after a validation error? You have at least 2 choices. 1) You can put your drop-down values into session scope. 2) You can set the input attribute of your action mapping to your edit action. AL Thank you for your help, AL Aaron Longwell AL - AL To unsubscribe, e-mail: [EMAIL PROTECTED] AL For additional commands, e-mail: [EMAIL PROTECTED] Regards, Dirk +--- Quality leads ---+ | Dirk Markert [EMAIL PROTECTED] | | Dr. Markert Softwaretechnik AG | | Joseph-von-Fraunhofer-Str. 20 | | 44227 Dortmund | +-- to success! -+ - 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: Where to build dropdown lists?
When using the client side validation, there is always a javascript pop up box that says something along the lines of 'Your a thick b*stard, fill in xxx!' Our client requirement is that we produce a list of errors at the top of the page, (the red UL kinda thing), which rules out the use of these java script pop ups. Another thing that I noticed when playing with the JavaScript pop ups was that all the validator JavaScript, whether used or not is included in the JSP code. I ende up with hundreds of lines of JavaScript, including date, email and phone number validation, for a login for that had two elements? Is this the way it should work? Thanks again IV from:Dennis [EMAIL PROTECTED] date:Tue, 15 Jul 2003 13:42:34 to: [EMAIL PROTECTED] subject: Re: Where to build dropdown lists? Rick Reumann [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, Jul 15,'03 (01:56 PM GMT-0100), Dichotomy wrote: My solution, which is perhaps not the most efficient memory-wise, is to simply put it in (and retrieve it from) the session rather than the request. I agree this is the best solution (using Session or Application scope). I brought this topic up a long time ago and ultimately you really have to use Session or Application scope if you plan to use Validation (or else settle for headaches getting it to work correctly with Request scope). If you use just Request scope you end up having to do some'crazier'(aka annoying) things to get the lists of beans for the drop downs to reset when validation fails. Search of the archives if you insist on using Request scope for the form lists and you'll find ways to do it, but none of them seemed worth the hassle(imo). If someone out there still has a nice clean way to get these request scope Lists back in scope after validation fails, I'd be interested in your solution. -- Rick What about the client side validation feature in the validator framework. This way the you won't have to populate the list at all if validation happens to fail because the form will not post unless it's valid. Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://www.amazon.co.uk/exec/obidos/redirect-home?tag=velloscouk-21placement=home_multi.gifsite=amazon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [ARTICLE] Succeeding with Struts Pt 2: Indexed Properties of Beans
Rick, I haven't found a good way to do this without a lot of gross %= hacking, specifically because the Struts and JSTL interators give you a handle to the index of the interated object, not the key. But frankly, I don't see a huge need to do this. Since the ActionForm is a separate object (or should be) from the backend business object, you can map in and out between an array and a Map during form setup and Action processing. James -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 8:34 AM To: Struts Users Mailing List Subject: Re: [ARTICLE] Succeeding with Struts Pt 2: Indexed Properties of Beans On Mon, Jul 14,'03 (06:32 AM GMT-0400), James wrote: http://www.developer.com/java/ejb/article.php/2233591 This month, I covered using indexed arrays of beans to do master/detail records in forms. Thanks James, excellent example! One thing I would now still like to see.. could you alter the code so that rather than providing an array of POLine beans you used a Map of POLine beans? So that you'd iterate over the Map and when you submitted the form each value in the Map (a POLine bean) would be reflected accordingly (maybe each key happened to be partNumbr)? I haven't found a good way to do this using JSTL and Struts-el tags so if you have an example or ideas I'm all ears (or eyes?:) Thanks. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to build dropdown lists?
On 07/15/2003 08:47:14 AM Rick Reumann wrote: On Tue, Jul 15,'03 (02:32 PM GMT+0200), Adam wrote: I designed a system where I can specify in my action which dropdown lists I require with a method call. I route my failed validate requests thro' the action (using the action mapping input tag) every time so the call is always made, and if I specified it should be in the request, the system looks in the request for the collection and if it doesn't find it, it makes it. Same applies to with session and application requirements. This did seem like the best solution if you insist on using request scope for your Lists on a form. It's still sort of a pain though because now don't you have to code for checking validation success in your Action class method(s) (execute or dispatch methods)? Seems like a lot of the power of the validation framework is you can control it all from config files and your Actions don't even have to worry about it. If insistence on request scope is mandatory, I think this above solution is the best one I've come across. -- Rick I also use a method call to retrieve my dropdown lists, but I gave up using an action as the input mapping parameter. I didn't see how I could implement it without putting a returning from validation check in there somewhere, and those particular setup actions have become complex enough already. I resorted to calling validate() manually in the save actions. Good or bad, it works well for my application. Susan - 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: radio button issue
that is working.. But you know business requirements are always awkward. they want to use Tab itself man... thank you matt -Original Message- From: Jing Zhou [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 11:19 PM To: Struts Users Mailing List Subject: Re: radio button issue I think what you are describing is the *default* behavior of browsers. I am using IE 6.0 and once I tab to focus on the first radio button, I use the left or right arrow keys to navigate to the next or previous radio buttons with the same name attribute. Try this to see if it works on your browsers. Jing Netspread Carrier http://www.netspread.com - Original Message - From: Mathew, Manoj [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, July 14, 2003 3:59 PM Subject: radio button issue Hi all I have a situation when i have 4 radio buttons ad all have same property name. So here the problem is i have to set the tabindex also. The control is going only ot the first radio button and then to the next element after all 4 radio buttons.Any idea how can i resolve this? i want to let the user the tab through all the 4 radio buttons.. thank you mathew - 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: Where to build dropdown lists?
On Tuesday 15 July 2003 12:52, [EMAIL PROTECTED] wrote: Hi, Another thing that I noticed when playing with the JavaScript pop ups was that all the validator JavaScript, whether used or not is included in the JSP code. I ende up with hundreds of lines of JavaScript, including date, email and phone number validation, for a login for that had two elements? Is this the way it should work? Look at the... html:javascript staticJavascript=false ..tag. Phil -- 1:11pm up 90 days, 2:03, 1 user, load average: 0.41, 0.14, 0.04 ICQ: 760757 AIM: pjshrimpton Y!: pjshrimpton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Populating Drop downs
How do you distinguish the when the execute method is being called to populate the form and when it is being called to post the data from the form? An example for the struts-config would be most useful. Q Aaron Longwell wrote: The Action is called prior to presenting the JSP only if you've set up: an action mapping to map the user's URL to a an action a forward to the JSP and you set the Action's execute method to return a forward to that JSP The entry point into the action is the execute() method which returns an ActionForward object. To create an ActionForward object use code like the following in your execute() method: return mapping.findForward(name_of_forward); Qasim Khawaja wrote: I need to populate three drop downs in a jsp before presentation. Currently I have writted routines in the ActionForm which access the DAO class and populate the lists. The problem is that the DAO class throws an exception which means that I have to make my ActionForm aware of a hibernateException. I want to do this in the action class and make use of declarative exception handling. Is the Action called prior to presenting the jsp? If so what is the entry point? Q - 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] -- == Qasim Khawaja Computing Officer Oxford Colleges Admissions Office University Offices | Wellington Square |T: (01865) 280128 Oxford OX1 2JD |F: (01865) 280121 Email: [EMAIL PROTECTED] == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
URL validation with struts???
Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month!
RE: Use of Validator in a Wizard Validator
Hmmm, no response. Let me rephrase the question. How do you perform field validation in your wizards? Thanks, Michael -Original Message- From: Kearney, Michael [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 12:28 PM To: '[EMAIL PROTECTED]' Subject: FW: Use of Validator in a Wizard Validator The Struts in Action book describes how to do multipage validations in chapter 12.10.1 by using the following code: if (page == 1) { //Check page 1 properties } if (page == 2) ( // And so on. Unfortunately, it doesn't go into detail about what goes inside the braces. What I'd like to know is what is the method call I use to validate just a single field so I don't have to reinvent the wheel. Best Regards, Michael Michael P. Kearney [EMAIL PROTECTED] 303-444-1101 x105 Qualstar Corporation Advanced Development 5480 Valmont Rd., Suite 250 Boulder, CO 80301-2367 - 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: Iterating the resultset contents in the view (jsp)
--- Kris Schneider [EMAIL PROTECTED] wrote: Well, okay, that makes the discussion a bit more abstract ;-). I understand your point, but the bottom line is that it's just a namespace (package) and an external library (JAR file). To my mind, the real question with either Result or RowSetDynaClass is how far from the data layer do you want the column names to propagate? In some cases that may be all the way to the view layer. This really has nothing to do with database column names because you can use the SQL AS keyword to alias the names to anything you like. David Quoting David Graham [EMAIL PROTECTED]: --- Kris Schneider [EMAIL PROTECTED] wrote: I'll admit that using a package called javax.servlet.jsp.jstl.sql in a non-Web app is a bit odd, but I'm not seeing any dependencies on other javax.servlet classes or interfaces or a Web container. I haven't tried it, but I'd bet the examples below would work outside a Web app. Maybe, but it just feels wrong. I know I've made a mistake when something in the app doesn't feel right. David Worth a try sometime... David Graham wrote: That's certainly another option but keep in mind that it ties your app to the web. That may be ok if you don't plan on reusing any of the code from the app but DynaBeans are more appropriate for building layers that are reusable in any environment. David --- Kris Schneider [EMAIL PROTECTED] wrote: Another datapoint: JSTL provides an interface called javax.servlet.jsp.jstl.sql.Result: public interface Result { public SortedMap[] getRows(); public Object[][] getRowsByIndex(); public String[]getColumnNames(); public int getRowCount(); public boolean isLimitedByMaxRows(); } and a utility class javax.servlet.jsp.jstl.sql.ResultSupport: public class ResultSupport { public static Result toResult(ResultSet rs); public static Result toResult(ResultSet rs, int maxRows); } to accomplish something similar. The SortedMap instances returned from Result.getRows are keyed by the ResultSet's column names and use the Comparator String.CASE_INSENSITIVE_ORDER so that you don't have to worry about matching the case of the column name exactly. So, depending on what your preference is, you can just do: ResultSet rs = ...; Result result = ResultSupport.toResult(rs); request.setAttribute(MyConstants.RESULT, result); or: ResultSet rs = ...; Result result = ResultSupport.toResult(rs); Map[] rows = result.getRows(); request.setAttribute(MyConstants.ROWS, rows); David Graham wrote: --- Richard Hill [EMAIL PROTECTED] wrote: Hi, I'm working on an action that gets a resultset from a database table containing 4 columns. I need to pass that information back to the view (jsp) which will iterate over results. My question is what is the best way to do this. Do I create an array for each row in the resultset and insert each array in a collection, passing that back to the view? A fairly standard approach is to create a class that represents a row of your ResultSet and store a List of those objects in the request for the page to iterate over. If you don't want to create a class for each result, you should check out the BeanUtils DynaBeans. This little gem: http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/RowSetDynaClass.html allows you to transer ResultSet data to DynaBeans in a trivial amount of code. David If so, how would you iterate over each array in the collection with the logic:iterate taglib? All of the examples only show iterations over single column lists. Any help would be appreciated. Thanks, Richard -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to build dropdown lists?
Client-side validation is a useful gimmick at best. I certainly would not trust it in any web application which will have more than one user (me). It is far too easy to get around (eg disable javascript?). -- If education is too expensive, try ignorance. On Tue, 15 Jul 2003 14:42:34 +0200 Dennis [EMAIL PROTECTED] wrote: What about the client side validation feature in the validator framework. This way the you won't have to populate the list at all if validation happens to fail because the form will not post unless it's valid. Dennis - 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: Iterating the resultset contents in the view (jsp)
That is true, but when columns are added to the table - you need not edit any file other than the jsp(doing it Kris' way). From: David Graham [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Iterating the resultset contents in the view (jsp) Date: Tue, 15 Jul 2003 06:39:35 -0700 (PDT) --- Kris Schneider [EMAIL PROTECTED] wrote: Well, okay, that makes the discussion a bit more abstract ;-). I understand your point, but the bottom line is that it's just a namespace (package) and an external library (JAR file). To my mind, the real question with either Result or RowSetDynaClass is how far from the data layer do you want the column names to propagate? In some cases that may be all the way to the view layer. This really has nothing to do with database column names because you can use the SQL AS keyword to alias the names to anything you like. David Quoting David Graham [EMAIL PROTECTED]: --- Kris Schneider [EMAIL PROTECTED] wrote: I'll admit that using a package called javax.servlet.jsp.jstl.sql in a non-Web app is a bit odd, but I'm not seeing any dependencies on other javax.servlet classes or interfaces or a Web container. I haven't tried it, but I'd bet the examples below would work outside a Web app. Maybe, but it just feels wrong. I know I've made a mistake when something in the app doesn't feel right. David Worth a try sometime... David Graham wrote: That's certainly another option but keep in mind that it ties your app to the web. That may be ok if you don't plan on reusing any of the code from the app but DynaBeans are more appropriate for building layers that are reusable in any environment. David --- Kris Schneider [EMAIL PROTECTED] wrote: Another datapoint: JSTL provides an interface called javax.servlet.jsp.jstl.sql.Result: public interface Result { public SortedMap[] getRows(); public Object[][] getRowsByIndex(); public String[]getColumnNames(); public int getRowCount(); public boolean isLimitedByMaxRows(); } and a utility class javax.servlet.jsp.jstl.sql.ResultSupport: public class ResultSupport { public static Result toResult(ResultSet rs); public static Result toResult(ResultSet rs, int maxRows); } to accomplish something similar. The SortedMap instances returned from Result.getRows are keyed by the ResultSet's column names and use the Comparator String.CASE_INSENSITIVE_ORDER so that you don't have to worry about matching the case of the column name exactly. So, depending on what your preference is, you can just do: ResultSet rs = ...; Result result = ResultSupport.toResult(rs); request.setAttribute(MyConstants.RESULT, result); or: ResultSet rs = ...; Result result = ResultSupport.toResult(rs); Map[] rows = result.getRows(); request.setAttribute(MyConstants.ROWS, rows); David Graham wrote: --- Richard Hill [EMAIL PROTECTED] wrote: Hi, I'm working on an action that gets a resultset from a database table containing 4 columns. I need to pass that information back to the view (jsp) which will iterate over results. My question is what is the best way to do this. Do I create an array for each row in the resultset and insert each array in a collection, passing that back to the view? A fairly standard approach is to create a class that represents a row of your ResultSet and store a List of those objects in the request for the page to iterate over. If you don't want to create a class for each result, you should check out the BeanUtils DynaBeans. This little gem: http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/RowSetDynaClass.html allows you to transer ResultSet data to DynaBeans in a trivial amount of code. David If so, how would you iterate over each array in the collection with the logic:iterate taglib? All of the examples only show iterations over single column lists. Any help would be appreciated. Thanks, Richard -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: URL validation with struts???
Steps: 1) Use a regular expression to check that the url fits the pattern you are looking for (here's a good tutorial on regexes: http://www.zvon.org/other/PerlTutorial/Output/index.html). You can do this directly with the validator framework if you're using it, or later from the action. 2) Open a java.io or java.nio connection to that url to check that it is valid. Look into File and/or InputStream for more info on how to do this. You should never put any logic in the form bean itself (it should remain a plain dumb form bean). Put this code in a library and make a call to it from your action. -- If education is too expensive, try ignorance. On Tue, 15 Jul 2003 06:36:14 -0700 (PDT) Prashanth.S [EMAIL PROTECTED] wrote: Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Text tag sizes
Hello everybody, I'm having a problem which I think nobody ever had. I need to create a form with multiple (equal) lines. Each line will have a few text boxes. It's made to work on a 800x600 resolution. While I was trying to reduce the size of every text box, I've noticed that if I create an HTML file with: input type=text ... size=1 and if I create a JSP, using Struts, with: html:text ... size=1 the sizes shown on the screen are different. The first one is smaller than the second. As I have many text boxes and a 800x600 resolution, I need every single pixel that I can get. Have you ever seen this? Thank you Rúben Carvalho __ Registe-se nas e-newsletters profissionais da Dashöfer, sem qualquer custo, e habilite-se a ganhar fabulosos prémios! Subscreva já! http://xekmail.aeiou.pt/dashofer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: URL validation with struts???
I think the URL validation should be done in the form's validate() method. -Original Message- From: Dichotomy [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 11:48 AM To: Struts Users Mailing List Subject: Re: URL validation with struts??? Steps: 1) Use a regular expression to check that the url fits the pattern you are looking for (here's a good tutorial on regexes: http://www.zvon.org/other/PerlTutorial/Output/index.html). You can do this directly with the validator framework if you're using it, or later from the action. 2) Open a java.io or java.nio connection to that url to check that it is valid. Look into File and/or InputStream for more info on how to do this. You should never put any logic in the form bean itself (it should remain a plain dumb form bean). Put this code in a library and make a call to it from your action. -- If education is too expensive, try ignorance. On Tue, 15 Jul 2003 06:36:14 -0700 (PDT) Prashanth.S [EMAIL PROTECTED] wrote: Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, 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 e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Text tag sizes
yes -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 9:55 AM To: Struts Users Mailing List Subject: Text tag sizes Hello everybody, I'm having a problem which I think nobody ever had. I need to create a form with multiple (equal) lines. Each line will have a few text boxes. It's made to work on a 800x600 resolution. While I was trying to reduce the size of every text box, I've noticed that if I create an HTML file with: input type=text ... size=1 and if I create a JSP, using Struts, with: html:text ... size=1 the sizes shown on the screen are different. The first one is smaller than the second. As I have many text boxes and a 800x600 resolution, I need every single pixel that I can get. Have you ever seen this? Thank you Rúben Carvalho __ Registe-se nas e-newsletters profissionais da Dashöfer, sem qualquer custo, e habilite-se a ganhar fabulosos prémios! Subscreva já! http://xekmail.aeiou.pt/dashofer - 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: URL validation with struts???
Hi Prashanth, I have done this using the Struts validator. I use the mask rule as follows: form name=serviceProviderForm field property=URL depends=required,mask msg name=mask key=error.invalid.ServiceProviderURL/ arg0 key=serviceProvider.url/ var var-namemask/var-name var-value^http:\/\/[^ ]*$/var-value /var /field /form There are great examples of using the validator in the Struts distribution. With this my code need not be concerned with the validity of the url string and is check by the validation framework on both client side(JavaScript) and server side and I only worry about errors obtaining a connection to the supplied url. Cheers, Greg -Original Message- From: Prashanth.S [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 9:36 AM To: [EMAIL PROTECTED] Subject: URL validation with struts??? Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Text tag size
Hello everybody, I'm having a problem which I think nobody ever had. I need to create a form with multiple (equal) lines. Each line will have a few text boxes. It's made to work on a 800x600 resolution. While I was trying to reduce the size of every text box, I've noticed that if I create an HTML file with: input type=text ... size=1 and if I create a JSP, using Struts, with: html:text ... size=1 the sizes shown on the screen are different. The first one is smaller than the second. As I have many text boxes and a 800x600 resolution, I need every single pixel that I can get. Can you help me with this? I need to shrink Struts text tag. Thank you Rúben Carvalho __ Registe-se nas e-newsletters profissionais da Dashöfer, sem qualquer custo, e habilite-se a ganhar fabulosos prémios! Subscreva já! http://xekmail.aeiou.pt/dashofer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: URL validation with struts???
Hi all, How abt throwing MalformedURLException in the service method inside action class?? Than no need to do validation in action form?? Is it correct?? Help?? Thanks Prashanth Dichotomy [EMAIL PROTECTED] wrote: Steps: 1) Use a regular expression to check that the url fits the pattern you are looking for (here's a good tutorial on regexes: http://www.zvon.org/other/PerlTutorial/Output/index.html). You can do this directly with the validator framework if you're using it, or later from the action. 2) Open a java.io or java.nio connection to that url to check that it is valid. Look into File and/or InputStream for more info on how to do this. You should never put any logic in the form bean itself (it should remain a plain dumb form bean). Put this code in a library and make a call to it from your action. -- If education is too expensive, try ignorance. On Tue, 15 Jul 2003 06:36:14 -0700 (PDT) Prashanth.S wrote: Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month!
Re: Where to build dropdown lists?
Susan Bradeen wrote: I also use a method call to retrieve my dropdown lists, but I gave up using an action as the input mapping parameter. I didn't see how I could implement it without putting a returning from validation check in there somewhere, and those particular setup actions have become complex enough already. I resorted to calling validate() manually in the save actions. Good or bad, it works well for my application. I set up an action mapping called failedValidate and gave it a parameter finished - this would set an action token variable in the app's action base class. I programmed it so the action token is always one of display / insert / update / delete / other / finished. In the case of finished, nothing happens. In all cases though, the base class makes sure the dropdown collection is there. Since it's in my action base class, I never have to worry about programming it manually. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: radio button issue
I went to the similar situations before. Tabbing to focus needs some understanding of UI design technology. The IE browser treats a group of radio buttons (with an identical name) as one logical unit on a page. So the tabbing can only give you the focus to one of the radio buttons. If you would like to give another try, you will find the IE browser treats a select menu (with one visible row) as one logical unit on the page too. Once you tab to focus it, you use the up and down arrow buttons to make selections. If your business requirements need browsers, I would say it is better to follow the *default* behaviors of the browsers. Jing Netspread Carrier http://www.netspread.com - Original Message - From: Mathew, Manoj [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Jing Zhou [EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 8:14 AM Subject: RE: radio button issue that is working.. But you know business requirements are always awkward. they want to use Tab itself man... thank you matt -Original Message- From: Jing Zhou [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 11:19 PM To: Struts Users Mailing List Subject: Re: radio button issue I think what you are describing is the *default* behavior of browsers. I am using IE 6.0 and once I tab to focus on the first radio button, I use the left or right arrow keys to navigate to the next or previous radio buttons with the same name attribute. Try this to see if it works on your browsers. Jing Netspread Carrier http://www.netspread.com - Original Message - From: Mathew, Manoj [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, July 14, 2003 3:59 PM Subject: radio button issue Hi all I have a situation when i have 4 radio buttons ad all have same property name. So here the problem is i have to set the tabindex also. The control is going only ot the first radio button and then to the next element after all 4 radio buttons.Any idea how can i resolve this? i want to let the user the tab through all the 4 radio buttons.. thank you mathew - 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: URL validation with struts???
That shoud do it right Open a new URL with a specified URL, if it throws MalformedURLException its bad URL Panchasheel -Original Message- From: Prashanth.S [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 10:04 AM To: Struts Users Mailing List Subject: Re: URL validation with struts??? Hi all, How abt throwing MalformedURLException in the service method inside action class?? Than no need to do validation in action form?? Is it correct?? Help?? Thanks Prashanth Dichotomy [EMAIL PROTECTED] wrote: Steps: 1) Use a regular expression to check that the url fits the pattern you are looking for (here's a good tutorial on regexes: http://www.zvon.org/other/PerlTutorial/Output/index.html). You can do this directly with the validator framework if you're using it, or later from the action. 2) Open a java.io or java.nio connection to that url to check that it is valid. Look into File and/or InputStream for more info on how to do this. You should never put any logic in the form bean itself (it should remain a plain dumb form bean). Put this code in a library and make a call to it from your action. -- If education is too expensive, try ignorance. On Tue, 15 Jul 2003 06:36:14 -0700 (PDT) Prashanth.S wrote: Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FW: need help
Hi Mohan You can have one action form and one action class for different JSP pages.But it would be a good design if all the JSP pages represent one type of function in your application. A typical example would be a Registration Module. Registration requires say around 2-3 JSP pages one after the other. In this case you can have action form say RegistrationForm.java and one Action class called RegistrationAction.java. You can do the following in the struts-config.xml for such form-bean name=registrationForm type=somepackage.webapp.RegistrationForm for the form-bean declaration and action path=/action/register type=somepackage.webapp.RegistrationAction name=registrationForm scope=session validate=false forward name=input1 path=/forms/some1.jsp/ forward name=input2 path=/forms/some2.jsp/ forward name=success path=/forms/some3.jsp/ /action for the action mappings part. You can have conditions in the Action class to take you to the respective jsp page upon validation of each page. -Good luck Mohan Hi, I am new to Struts and I have to complete a project with an aggressive deadline. I want to know the following: My application will have about 80-100 screens each having different action items. Most screens will have a common header, footer, and a navbar. My questions are: I thought of using Tiles for my application. Is that a good idea. -Should I have to have one action form for each screen or can I group the screens and have one action form for a group of screens. Which would be a preferred method? -Should I have to have one action class for each screen or can I group the action classes the same way as forms? Which would be a preferred method? -Every screen of mine is going to be a jsp page. I want to populate the form data at the time when someone enters the page from another page and I want to write the data into the database at the time when the user leaves a page with an action. Is this possible in the same action class? How does the flow work? Does the control go to the action class first before the form data is picked up for display. If that is the case, will there be an easy way for me to set the form data from the same action class for the form before the data is displayed? Where can I see a sample code if I use one single action class for loading the data and for processing the actions within the form? What should be the setting within the struts-config file for the above scenario. Sorry, if my questions are dumb. I need help. Thanks in advance, Mohan - 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: URL validation with struts???
You could definitely do that, too. If you just create a new Url(yourstringhere) it will raise that exception if it's malformed, so it won't waste time creating a connection to a malformed url. I guess that's probably a better solution than the regex one, too, because it's simpler. -- If education is too expensive, try ignorance. On Tue, 15 Jul 2003 07:03:59 -0700 (PDT) Prashanth.S [EMAIL PROTECTED] wrote: Hi all, How abt throwing MalformedURLException in the service method inside action class?? Than no need to do validation in action form?? Is it correct?? Help?? Thanks Prashanth Dichotomy [EMAIL PROTECTED] wrote: Steps: 1) Use a regular expression to check that the url fits the pattern you are looking for (here's a good tutorial on regexes: http://www.zvon.org/other/PerlTutorial/Output/index.html). You can do this directly with the validator framework if you're using it, or later from the action. 2) Open a java.io or java.nio connection to that url to check that it is valid. Look into File and/or InputStream for more info on how to do this. You should never put any logic in the form bean itself (it should remain a plain dumb form bean). Put this code in a library and make a call to it from your action. -- If education is too expensive, try ignorance. On Tue, 15 Jul 2003 06:36:14 -0700 (PDT) Prashanth.S wrote: Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
URL changed by user - how to restrict?
Hi, I am developing a web application in which some parameters are passed through query string. I do not want to allow users to manipulate the query string. If they manipulate, they should be logged off and taken to login page. For ex.., I have a page http://mymachine:8080/appln/test.jsp?user=1004 In this page, user details are displayed. If a user changes the query string - from user=1004 to user=1005 - and clicks ENTER, then the details of 1005 are being displayed. I want to avoid this. In such cases, user should be logged off and taken to login screen. How can this be done using Struts? Any clue? I believe this can be done by checking HTTP_REFERER, but I'm unable to get it right. Sriram -Original Message- From: Greg Hess [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 7:31 PM To: 'Struts Users Mailing List' Subject: RE: URL validation with struts??? Hi Prashanth, I have done this using the Struts validator. I use the mask rule as follows: form name=serviceProviderForm field property=URL depends=required,mask msg name=mask key=error.invalid.ServiceProviderURL/ arg0 key=serviceProvider.url/ var var-namemask/var-name var-value^http:\/\/[^ ]*$/var-value /var /field /form There are great examples of using the validator in the Struts distribution. With this my code need not be concerned with the validity of the url string and is check by the validation framework on both client side(JavaScript) and server side and I only worry about errors obtaining a connection to the supplied url. Cheers, Greg -Original Message- From: Prashanth.S [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 9:36 AM To: [EMAIL PROTECTED] Subject: URL validation with struts??? Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: URL changed by user - how to restrict?
Sriram, I would suggest you put sensitive information like that in a user's session and not in the query string. thanks, Amit -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 9:10 AM To: 'Struts Users Mailing List' Subject: URL changed by user - how to restrict? Hi, I am developing a web application in which some parameters are passed through query string. I do not want to allow users to manipulate the query string. If they manipulate, they should be logged off and taken to login page. For ex.., I have a page http://mymachine:8080/appln/test.jsp?user=1004 In this page, user details are displayed. If a user changes the query string - from user=1004 to user=1005 - and clicks ENTER, then the details of 1005 are being displayed. I want to avoid this. In such cases, user should be logged off and taken to login screen. How can this be done using Struts? Any clue? I believe this can be done by checking HTTP_REFERER, but I'm unable to get it right. Sriram -Original Message- From: Greg Hess [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 7:31 PM To: 'Struts Users Mailing List' Subject: RE: URL validation with struts??? Hi Prashanth, I have done this using the Struts validator. I use the mask rule as follows: form name=serviceProviderForm field property=URL depends=required,mask msg name=mask key=error.invalid.ServiceProviderURL/ arg0 key=serviceProvider.url/ var var-namemask/var-name var-value^http:\/\/[^ ]*$/var-value /var /field /form There are great examples of using the validator in the Struts distribution. With this my code need not be concerned with the validity of the url string and is check by the validation framework on both client side(JavaScript) and server side and I only worry about errors obtaining a connection to the supplied url. Cheers, Greg -Original Message- From: Prashanth.S [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 9:36 AM To: [EMAIL PROTECTED] Subject: URL validation with struts??? Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, 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 e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: URL changed by user - how to restrict?
If you desparately want to do such things, then may be you can put the generated query string in the session and validate it , if the user has changed the query manually Panchasheel -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 10:10 AM To: 'Struts Users Mailing List' Subject: URL changed by user - how to restrict? Hi, I am developing a web application in which some parameters are passed through query string. I do not want to allow users to manipulate the query string. If they manipulate, they should be logged off and taken to login page. For ex.., I have a page http://mymachine:8080/appln/test.jsp?user=1004 In this page, user details are displayed. If a user changes the query string - from user=1004 to user=1005 - and clicks ENTER, then the details of 1005 are being displayed. I want to avoid this. In such cases, user should be logged off and taken to login screen. How can this be done using Struts? Any clue? I believe this can be done by checking HTTP_REFERER, but I'm unable to get it right. Sriram -Original Message- From: Greg Hess [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 7:31 PM To: 'Struts Users Mailing List' Subject: RE: URL validation with struts??? Hi Prashanth, I have done this using the Struts validator. I use the mask rule as follows: form name=serviceProviderForm field property=URL depends=required,mask msg name=mask key=error.invalid.ServiceProviderURL/ arg0 key=serviceProvider.url/ var var-namemask/var-name var-value^http:\/\/[^ ]*$/var-value /var /field /form There are great examples of using the validator in the Struts distribution. With this my code need not be concerned with the validity of the url string and is check by the validation framework on both client side(JavaScript) and server side and I only worry about errors obtaining a connection to the supplied url. Cheers, Greg -Original Message- From: Prashanth.S [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 9:36 AM To: [EMAIL PROTECTED] Subject: URL validation with struts??? Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - 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: URL changed by user - how to restrict?
For ex.., I have a page http://mymachine:8080/appln/test.jsp?user=1004 In this page, user details are displayed. If a user changes the query string - from user=1004 to user=1005 - and clicks ENTER, then the details of 1005 are being displayed. I want to avoid this. In such cases, user should be logged off and taken to login screen. How can this be done using Struts? Any clue? I believe this can be done by checking HTTP_REFERER, but I'm unable to get it right. Some sort of security could be in order... At the backend check that the user has permissions to edit that particular record. -TPP - This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: URL validation with struts???
Prashanth.S wrote: Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) The current commons-validator has a java class for validating a URL that I added, it is pretty extensive. I still need to write the equalivent Javascript. Look at the unit tests for how to use the class. Alternatively you can go to javascript.com to find a standalone version for javascript. Usually when we create the Javascript version it mirrors the java version so the two give the same results. The JavaDoc on the web site is really old so look at the source: http://cvs.apache.org/viewcvs/jakarta-commons/validator/src/share/org/apache/commons/validator/UrlValidator.java The Unit tests: http://cvs.apache.org/viewcvs/jakarta-commons/validator/src/test/org/apache/commons/validator/UrlTest.java Download the nightly which has all the below plus updated javadocs http://cvs.apache.org/builds/jakarta-commons/nightly/commons-validator/ Since method signatures have changed in commons-validator, the easiest way to get this though is to download a *nightly* version of struts:(**recommended**) http://cvs.apache.org/builds/jakarta-struts/nightly/ Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month!
Re: URL changed by user - how to restrict?
From what you've described, you don't need to pass any user number or id. With the internet, being the stateless beast that it is, how will your application know that any particular request is or isn't supposed to access some particular user number? I think you are going about this the wrong way. If a user changing the query string presents (what you describe as) a security breech, you're security scheme is severely flawed. -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 678-910-8017 AIM:jmitchtx - Original Message - From: sriram [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 10:09 AM Subject: URL changed by user - how to restrict? Hi, I am developing a web application in which some parameters are passed through query string. I do not want to allow users to manipulate the query string. If they manipulate, they should be logged off and taken to login page. For ex.., I have a page http://mymachine:8080/appln/test.jsp?user=1004 In this page, user details are displayed. If a user changes the query string - from user=1004 to user=1005 - and clicks ENTER, then the details of 1005 are being displayed. I want to avoid this. In such cases, user should be logged off and taken to login screen. How can this be done using Struts? Any clue? I believe this can be done by checking HTTP_REFERER, but I'm unable to get it right. Sriram -Original Message- From: Greg Hess [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 7:31 PM To: 'Struts Users Mailing List' Subject: RE: URL validation with struts??? Hi Prashanth, I have done this using the Struts validator. I use the mask rule as follows: form name=serviceProviderForm field property=URL depends=required,mask msg name=mask key=error.invalid.ServiceProviderURL/ arg0 key=serviceProvider.url/ var var-namemask/var-name var-value^http:\/\/[^ ]*$/var-value /var /field /form There are great examples of using the validator in the Struts distribution. With this my code need not be concerned with the validity of the url string and is check by the validation framework on both client side(JavaScript) and server side and I only worry about errors obtaining a connection to the supplied url. Cheers, Greg -Original Message- From: Prashanth.S [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 9:36 AM To: [EMAIL PROTECTED] Subject: URL validation with struts??? Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - 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: Use of Validator in a Wizard Validator
Hello, I use do my validations in the brackets. For example i test that a field of the form on the page 1 is valid : //first launch automatic validation ActionErrors errors = super.validate(mapping, request); //second do specific validation. if (page == 1) { //Check page 1 properties //here it test the form properties of page 1 : //retrieve the form and cast it appropriatly MyForm mf = (MyForm) form; //check properties if (dontSatisfyValidation(mf.getMyProperty()) //add an error if the property isn't validated errors.add... else //add a message if validation is ok for this field messages.add(... } You should have access to the Form generated from the request from the client and check the form properties, and your code could contain some functions, like dontSatisfyValidation, for verifiy that each field concerned by the page which is actually checked. For automatic validation, driven by rules defined in validator-config.xml (or validator-rules, check the 2 files), (i think you think to this when you say what is the method call I use to validate just a single field) you do : super.validate() on the beginning of your form. (which must extend ValidatorForm, check the Javadoc for this class). So good luck, re-read the doc and the examples if you don't understand my mail, best regards, Ludo Kearney, Michael wrote: Hmmm, no response. Let me rephrase the question. How do you perform field validation in your wizards? Thanks, Michael -Original Message- From: Kearney, Michael [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 12:28 PM To: '[EMAIL PROTECTED]' Subject: FW: Use of Validator in a Wizard Validator The Struts in Action book describes how to do multipage validations in chapter 12.10.1 by using the following code: if (page == 1) { //Check page 1 properties } if (page == 2) ( // And so on. Unfortunately, it doesn't go into detail about what goes inside the braces. What I'd like to know is what is the method call I use to validate just a single field so I don't have to reinvent the wheel. Best Regards, Michael Michael P. Kearney [EMAIL PROTECTED] 303-444-1101 x105 Qualstar Corporation Advanced Development 5480 Valmont Rd., Suite 250 Boulder, CO 80301-2367 - 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] -- Ludovic Maître Factory Productions | Tél: (33) 04 93 07 08 00 149, avenue des mimosas | Fax: (33) 04 93 07 04 02 06700 Saint-Laurent-du-Var (France) | Web: http://www.factory.fr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: URL changed by user - how to restrict?
I agree with what the others said. You can never, and should never, trust anything that the user can change. And you should certainly not be storing the logged in user's id in the query string. I think you may need to read a bit about basic http security. A framework like Struts requires you to actually know what you are doing when it comes to basic web design techniques. It does not give you some sort of 'magic key' that allows you to skip over all that stuff and start writing web applications right away - if you do, they will be riddled with holes. Btw, there is no way you can do what you're asking. HTTP_REFERER can be altered by the user too. -- If education is too expensive, try ignorance. On Tue, 15 Jul 2003 19:39:36 +0530 sriram [EMAIL PROTECTED] wrote: Hi, I am developing a web application in which some parameters are passed through query string. I do not want to allow users to manipulate the query string. If they manipulate, they should be logged off and taken to login page. For ex.., I have a page http://mymachine:8080/appln/test.jsp?user=1004 In this page, user details are displayed. If a user changes the query string - from user=1004 to user=1005 - and clicks ENTER, then the details of 1005 are being displayed. I want to avoid this. In such cases, user should be logged off and taken to login screen. How can this be done using Struts? Any clue? I believe this can be done by checking HTTP_REFERER, but I'm unable to get it right. Sriram -Original Message- From: Greg Hess [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 7:31 PM To: 'Struts Users Mailing List' Subject: RE: URL validation with struts??? Hi Prashanth, I have done this using the Struts validator. I use the mask rule as follows: form name=serviceProviderForm field property=URL depends=required,mask msg name=mask key=error.invalid.ServiceProviderURL/ arg0 key=serviceProvider.url/ var var-namemask/var-name var-value^http:\/\/[^ ]*$/var-value /var /field /form There are great examples of using the validator in the Struts distribution. With this my code need not be concerned with the validity of the url string and is check by the validation framework on both client side(JavaScript) and server side and I only worry about errors obtaining a connection to the supplied url. Cheers, Greg -Original Message- From: Prashanth.S [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 9:36 AM To: [EMAIL PROTECTED] Subject: URL validation with struts??? Hi all, I need to upload a resource present at a particular location by making user enter a valid URL...How can i do URL name validation using struts???Is there anything to do so??Do i need to do this in action form or action class??[what User entered is a valid url i.e,both name as well as resource present at that url) Thanks in advance Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - 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: URL validation with struts???
Dichotomy wrote: You could definitely do that, too. If you just create a new Url(yourstringhere) it will raise that exception if it's malformed, I would encourage you to look at the implementation of URL. It does only a small amount of validation on the format, but that may be enough, for your case. -Rob so it won't waste time creating a connection to a malformed url. I guess that's probably a better solution than the regex one, too, because it's simpler. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Passing Parameters Between Actions
Is there any reason you are forwarding from JSP? Try using Dispatcher in Action1 class like request.getRequestDispatcher(/Action2.do).forward(request, response); - jung Hunter Hillegas wrote: I am trying to pass a parameter between two actions and running into trouble. I call action 1 like this: /Action1.do?rec_num=1 Action1 does some processing and when complete it forwards via an ActionForward to Action2 as such: forward name=action2 path=/Action2.do/ Action2 has no way to retrieve the parameter originally passed in to the first action, rec_num. When I try to grab it using request.getParameter() I get a NPE. I also tried setting it as a request attribute and that didn't work. Session might work but I am trying not use sessions. Any ideas on what I can do? Thanks, Hunter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Populating Drop downs
Qasim, I actually use separate actions. I have an edit action, an update action (which handles both creation of a new record and updating of an existing record) and a list action (which views data about certain records): !-- BAND LIST -- action path=/band/list type=dove.struts.actions.BandAction parameter=list validate=false /action !-- BAND CREATE -- action path=/band/create type=dove.struts.actions.BandAction name=BandForm scope=request parameter=create validate=false input=/WEB-INF/jsp/html/band/edit.jsp /action !-- BAND EDIT -- action path=/band/edit type=dove.struts.actions.BandAction name=BandForm scope=request parameter=edit validate=false input=/WEB-INF/jsp/html/band/edit.jsp /action !-- BAND UPDATE -- action path=/band/update type=dove.struts.actions.BandAction name=BandForm scope=request parameter=update validate=true input=/band/create.action /action You'll see I have different actions fronting the same JSP. In addition I use a practice of hiding the JSPs behind the WEB-INF directory. The spec indicates that these directories must be secure so nobody can go to a JSP without visitng the action first. A second strategy I use is to build only one action for each of my sub actions (see the type=) are all identical. To differentiate which mode the action is in I assign a different parameter attribute for each. Then within my execute method I check the parameter value: String param = mapping.getParameter(); and then route to a private method inside the Action class. This keeps all the code in one place (in this case, in the BandAction class). Qasim Khawaja wrote: How do you distinguish the when the execute method is being called to populate the form and when it is being called to post the data from the form? An example for the struts-config would be most useful. Q Aaron Longwell wrote: The Action is called prior to presenting the JSP only if you've set up: an action mapping to map the user's URL to a an action a forward to the JSP and you set the Action's execute method to return a forward to that JSP The entry point into the action is the execute() method which returns an ActionForward object. To create an ActionForward object use code like the following in your execute() method: return mapping.findForward(name_of_forward); Qasim Khawaja wrote: I need to populate three drop downs in a jsp before presentation. Currently I have writted routines in the ActionForm which access the DAO class and populate the lists. The problem is that the DAO class throws an exception which means that I have to make my ActionForm aware of a hibernateException. I want to do this in the action class and make use of declarative exception handling. Is the Action called prior to presenting the jsp? If so what is the entry point? Q - 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: Text tag size
Using the size attribute to control the field width of a text input is not recommended. In our demos at http://www.netspread.com, we use style=width: 100pt; for many input fields. Note that the pt is one of absolute units used by browsers. It gives you the ability to control the screen layouts regardless what resolutions and what fonts the end users are using. So our demos works on screens with resolution 1600x1200 and 1024x768 and with different font settings. Jing Netspread Carrier http://www.netspread.com - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 9:04 AM Subject: Text tag size Hello everybody, I'm having a problem which I think nobody ever had. I need to create a form with multiple (equal) lines. Each line will have a few text boxes. It's made to work on a 800x600 resolution. While I was trying to reduce the size of every text box, I've noticed that if I create an HTML file with: input type=text ... size=1 and if I create a JSP, using Struts, with: html:text ... size=1 the sizes shown on the screen are different. The first one is smaller than the second. As I have many text boxes and a 800x600 resolution, I need every single pixel that I can get. Can you help me with this? I need to shrink Struts text tag. Thank you Rúben Carvalho __ Registe-se nas e-newsletters profissionais da Dashöfer, sem qualquer custo, e habilite-se a ganhar fabulosos prémios! Subscreva já! http://xekmail.aeiou.pt/dashofer - 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: Use of Validator in a Wizard Validator
Yes but... It's my understanding that super.validate() validates all the form's fields at once. In the case of a wizard you don't have all the fields populated by the user until they reach the last page. I'd like to take advantage of the rules in validation.xml and not (re)write the code inside the braces. -Original Message- From: Ludovic Maitre [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 8:34 AM To: Struts Users Mailing List Subject: Re: Use of Validator in a Wizard Validator Hello, I use do my validations in the brackets. For example i test that a field of the form on the page 1 is valid : //first launch automatic validation ActionErrors errors = super.validate(mapping, request); //second do specific validation. if (page == 1) { //Check page 1 properties //here it test the form properties of page 1 : //retrieve the form and cast it appropriatly MyForm mf = (MyForm) form; //check properties if (dontSatisfyValidation(mf.getMyProperty()) //add an error if the property isn't validated errors.add... else //add a message if validation is ok for this field messages.add(... } You should have access to the Form generated from the request from the client and check the form properties, and your code could contain some functions, like dontSatisfyValidation, for verifiy that each field concerned by the page which is actually checked. For automatic validation, driven by rules defined in validator-config.xml (or validator-rules, check the 2 files), (i think you think to this when you say what is the method call I use to validate just a single field) you do : super.validate() on the beginning of your form. (which must extend ValidatorForm, check the Javadoc for this class). So good luck, re-read the doc and the examples if you don't understand my mail, best regards, Ludo Kearney, Michael wrote: Hmmm, no response. Let me rephrase the question. How do you perform field validation in your wizards? Thanks, Michael -Original Message- From: Kearney, Michael [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 12:28 PM To: '[EMAIL PROTECTED]' Subject: FW: Use of Validator in a Wizard Validator The Struts in Action book describes how to do multipage validations in chapter 12.10.1 by using the following code: if (page == 1) { //Check page 1 properties } if (page == 2) ( // And so on. Unfortunately, it doesn't go into detail about what goes inside the braces. What I'd like to know is what is the method call I use to validate just a single field so I don't have to reinvent the wheel. Best Regards, Michael Michael P. Kearney [EMAIL PROTECTED] 303-444-1101 x105 Qualstar Corporation Advanced Development 5480 Valmont Rd., Suite 250 Boulder, CO 80301-2367 - 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] -- Ludovic Maître Factory Productions | Tél: (33) 04 93 07 08 00 149, avenue des mimosas | Fax: (33) 04 93 07 04 02 06700 Saint-Laurent-du-Var (France) | Web: http://www.factory.fr - 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: Indexed form values
Sandeep, Thank you for your response. I checked in mail archive and found several suggestions. In particular I looked at this suggestion http://www.mail-archive.com/[EMAIL PROTECTED]/msg72404.html and realized that there is a slight problem with this code. For those who would like to know how I got it working here it is: Change the Code which says : // THIS METHOD IS REQUIRED IF YOUR FORM IS OF REQUEST SCOPE. public MyBean getIndexedBeans(int index) { while (this.myBeans.size() index) this.myBeans.add(new MyBean()); return (MyBean) this.myBeans.get(index); } To this: // THIS METHOD IS REQUIRED IF YOUR FORM IS OF REQUEST SCOPE. public MyBean getIndexedBeans(int index) { while ((this.myBeans.size()-1) index) this.myBeans.add(new MyBean()); return (MyBean) this.myBeans.get(index); } because size is not zero-based where as index is. Thanks Amit -Original Message- From: Sandeep Takhar [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 5:08 PM To: Struts Users Mailing List Subject: Re: Indexed form values session scoped beans or request? If request - then there have been numerous replies about this FAQ which is that you have to initialize all values less than or equal to the index that are null. i.e. getObject(int index) sandeep --- Amit Kirdatt [EMAIL PROTECTED] wrote: I have a struts form where I am doing the following: logic:present name=form1 property=arrayList1 scope=request logic:iterate id=arrayValue1 name=form1 property=arrayList1 html:hidden name=arrayValue1 property=id1 indexed=true/ html:hidden name=arrayValue1 property=exampleBean.stuffValue indexed=true/ html:hidden name=arrayValue1 property=exampleBean.exampleInfo.exId1 indexed=true/ /logic:iterate /logic:present logic:present name=form1 property=arrayList2 scope=request logic:iterate id=arrayValue2 name=form1 property=arrayList2 html:hidden name=arrayValue2 property=id2 indexed=true/ html:hidden name=arrayValue2 property=exampleBean1.stuffValue indexed=true/ html:hidden name=arrayValue2 property=exampleBean1.exampleInfo.exId1 indexed=true/ /logic:iterate /logic:present I have to carry these hidden values thru 3 pages before inserting into the database, the first page is where these values get set. On the second page the values populate correctly, but on the second page the second iterate loop does not populate at all. After investigating I found that arrayList is not populating (size 0) from the second page to the third page, but the first iterarte loop works just fine thru all pages and inserts into the DB correctly. I have tried searching on the web and haven't found any answers. Can somebody please help! Thanks, Amit This e-mail, 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 e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, 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 e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Text tag size
Thank you Jing, we were already using css. Now you confirmed it :) Rúben Citando Jing Zhou [EMAIL PROTECTED]: Using the size attribute to control the field width of a text input is not recommended. In our demos at http://www.netspread.com, we use style=width: 100pt; for many input fields. Note that the pt is one of absolute units used by browsers. It gives you the ability to control the screen layouts regardless what resolutions and what fonts the end users are using. So our demos works on screens with resolution 1600x1200 and 1024x768 and with different font settings. Jing Netspread Carrier http://www.netspread.com - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 9:04 AM Subject: Text tag size Hello everybody, I'm having a problem which I think nobody ever had. I need to create a form with multiple (equal) lines. Each line will have a few text boxes. It's made to work on a 800x600 resolution. While I was trying to reduce the size of every text box, I've noticed that if I create an HTML file with: input type=text ... size=1 and if I create a JSP, using Struts, with: html:text ... size=1 the sizes shown on the screen are different. The first one is smaller than the second. As I have many text boxes and a 800x600 resolution, I need every single pixel that I can get. Can you help me with this? I need to shrink Struts text tag. Thank you Rúben Carvalho __ Registe-se nas e-newsletters profissionais da Dashöfer, sem qualquer custo, e habilite-se a ganhar fabulosos prémios! Subscreva já! http://xekmail.aeiou.pt/dashofer -- --- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: struts-user- [EMAIL PROTECTED] __ Registe-se nas e-newsletters profissionais da Dashöfer, sem qualquer custo, e habilite-se a ganhar fabulosos prémios! Subscreva já! http://xekmail.aeiou.pt/dashofer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
bean:size tag in Struts 1.0.2
Hello all, i have problem with bean:size tag it works so for me: bean:size id=ak_size scope=request name=cawisReport property=userArbeitskreis/ but don't work so: bean:define id=cawisUserArbeitskreis name=cawisReport property=userArbeitskreis scope=request/ bean:size collection=cawisUserArbeitskreis id=ak_size scope=page property=value/ stacktrace: javax.servlet.jsp.JspException at org.apache.struts.taglib.bean.SizeTag.doStartTag(SizeTag.java:201) ... i use struts 1.0.2. What do i wrong??? thanks for adwise regards Dmitri - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to build dropdown lists?
On 07/15/2003 10:04:13 AM Adam Hardy wrote: Susan Bradeen wrote: I also use a method call to retrieve my dropdown lists, but I gave up using an action as the input mapping parameter. I didn't see how I could implement it without putting a returning from validation check in there somewhere, and those particular setup actions have become complex enough already. I resorted to calling validate() manually in the save actions. Good or bad, it works well for my application. I set up an action mapping called failedValidate and gave it a parameter finished - this would set an action token variable in the app's action base class. I programmed it so the action token is always one of display / insert / update / delete / other / finished. In the case of finished, nothing happens. In all cases though, the base class makes sure the dropdown collection is there. Since it's in my action base class, I never have to worry about programming it manually. Ah ha. This sounds good. Thanks very much for the ideas, Adam. Susan - 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: 4th Of July Struts Challenge...
As it turns out, some of my ideas about a standard property of type Map versus a mapped property were a bit off. So, if you're still interested, here's something I hacked together. You'll notice I used a session scoped form so that Struts doesn't choke when it tries to populate the form. struts-config.xml: -- form-beans form-bean name=employeesForm type=org.apache.struts.action.DynaActionForm form-property name=employeesMap type=java.util.Map/ /form-bean /form-beans action-mappings action path=/employees/edit type=com.dotech.EditEmployeesAction name=employeesForm scope=session validate=false forward name=success path=/editEmployees.jsp/ /action action path=/employees/save type=org.apache.struts.actions.ForwardAction parameter=/viewEmployees.jsp name=employeesForm scope=session validate=false/ /action-mappings editEmployees.jsp: -- %@ taglib prefix=bean uri=http://jakarta.apache.org/struts/tags-bean; % %@ taglib prefix=curi=http://java.sun.com/jstl/core; % %@ taglib prefix=html uri=http://jakarta.apache.org/struts/tags-html; % %-- dynamically get a handle to the form --% bean:struts id=mapping mapping=/employees/save/ c:set var=attribute value=${mapping.attribute}/ c:set var=scope value=${mapping.scope}/ c:choose c:when test=${scope eq 'request'} c:set var=form value=${requestScope[attribute]}/ /c:when c:otherwise c:set var=form value=${sessionScope[attribute]}/ /c:otherwise /c:choose html headtitleEdit Employees/title/head body html:form action=/employees/save table c:forEach var=entry items=${form.map.employeesMap} tr tdc:out value=${entry.key}//td td input type=text name=c:out value=employeesMap(${entry.key}).name/ value=c:out value=${entry.value.name}/ /td td input type=text name=c:out value=employeesMap(${entry.key}).age/ value=c:out value=${entry.value.age}/ /td /tr /c:forEach tr td align=center colspan=3html:submit//td /tr /table /html:form /body /html EmployeeBean.java: -- package com.dotech; public class EmployeeBean { private String name; private String age; public EmployeeBean(String name, String age) { this.name = name; this.age = age; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getAge() { return this.age; } public void setAge(String age) { this.age = age; } } EditEmployeesAction.java: - package com.dotech; import java.util.*; import javax.servlet.http.*; import org.apache.commons.beanutils.*; import org.apache.struts.action.*; public class EditEmployeesAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Map empMap = new HashMap(); empMap.put(, new EmployeeBean(John Doe, 33)); empMap.put(, new EmployeeBean(Loser Boy, 22)); PropertyUtils.setProperty(form, employeesMap, empMap); return mapping.findForward(success); } } viewEmployees.jsp: -- %@ taglib prefix=bean uri=http://jakarta.apache.org/struts/tags-bean; % %@ taglib prefix=curi=http://java.sun.com/jstl/core; % %-- dynamically get a handle to the form --% bean:struts id=mapping mapping=/employees/save/ c:set var=attribute value=${mapping.attribute}/ c:set var=scope value=${mapping.scope}/ c:choose c:when test=${scope eq 'request'} c:set var=form value=${requestScope[attribute]}/ /c:when c:otherwise c:set var=form value=${sessionScope[attribute]}/ /c:otherwise /c:choose html headtitleView Employees/title/head body table c:forEach var=entry items=${form.map.employeesMap} tr tdc:out value=${entry.key}//td tdc:out value=${entry.value.name}//td tdc:out value=${entry.value.age}//td /tr /c:forEach /table /body /html Quoting Kris Schneider [EMAIL PROTECTED]: Okay, so that's way too much work ;-). I'm not sure, but I think one of the issues you're running into is the difference between a standard property of type Map and a mapped property. The first is declared like: public Map getEmployeesMap() public void setEmployeesMap(Map m)
RE: [ARTICLE] Succeeding with Struts Pt 2: Indexed Properties ofBeans
On Tue, 15 Jul 2003, James Turner wrote: Date: Tue, 15 Jul 2003 08:59:30 -0400 From: James Turner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Rick Reumann' [EMAIL PROTECTED], 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: [ARTICLE] Succeeding with Struts Pt 2: Indexed Properties of Beans Rick, I haven't found a good way to do this without a lot of gross %= hacking, specifically because the Struts and JSTL interators give you a handle to the index of the interated object, not the key. The iterated object has key and value properties to give you access to either the key or the value with a nested expression. But frankly, I don't see a huge need to do this. Since the ActionForm is a separate object (or should be) from the backend business object, you can map in and out between an array and a Map during form setup and Action processing. James Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Iterating the resultset contents in the view (jsp)
On Tue, 15 Jul 2003, Kris Schneider wrote: Well, okay, that makes the discussion a bit more abstract ;-). I understand your point, but the bottom line is that it's just a namespace (package) and an external library (JAR file). To my mind, the real question with either Result or RowSetDynaClass is how far from the data layer do you want the column names to propagate? In some cases that may be all the way to the view layer. Column names need propogate only as far as the SQL query, if that's what you want, thanks to the as capability of SQL: select customer_name as name, account_id as accountId from customers where past_due_status = 'Bad Boy'; the column names in the result set will be name and accountId, instead of whatever they are inside the database. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean:size tag in Struts 1.0.2
scope on bean:size isn't doing what you think it is doing. bean:size create page scope and scripting var... The bean scope within which to search for the JSP bean specified by the name attribute. If not specified, the available scopes are searched in ascending sequence. sandeep --- Dmitri Ilyin [EMAIL PROTECTED] wrote: Hello all, i have problem with bean:size tag it works so for me: bean:size id=ak_size scope=request name=cawisReport property=userArbeitskreis/ but don't work so: bean:define id=cawisUserArbeitskreis name=cawisReport property=userArbeitskreis scope=request/ bean:size collection=cawisUserArbeitskreis id=ak_size scope=page property=value/ stacktrace: javax.servlet.jsp.JspException at org.apache.struts.taglib.bean.SizeTag.doStartTag(SizeTag.java:201) ... i use struts 1.0.2. What do i wrong??? thanks for adwise regards Dmitri - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] auto convert resource property files to different language
Hi, I have a properties file which is in english, now i have to create properties files for different langauage like russian, spanish, french etc. now i dont know any of these languages is there any automatic conversion tool which will translate the properties file to different languages. If it is a open source will be nice :-) Ashish __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tlds not found compiling in Netbeans
I am developing using Netbeans and had the following line of code in my jsp files and similar for each other tld. %@ taglib uri=./../WEB-INF/struts-bean.tld prefix=bean % Everything compiled and worked fine when I ran the application in Tomcat. However, when I attempted to move the application to our web server which is running iPlanet, it didn't care for the ./../ and was unable to find my tld files so I changed the code for the jsp files so that it was exactly as the struts documentation and examples show beginning with just a forward slash: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % After doing that, the jsps won't compile in Netbeans which I assume is the reason that I used the ./../ in the first place when I started developing this app several months ago. My webapp is mounted in Netbeans and the WEB-INF directly is one level down and includes all of the tld files and web.xml file. My web.xml file contains the following and similar for each other tld. taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib Does anyone have any suggestions on how to get my code to compile? Thanks! ** This message is intended only for the designated recipient(s). It may contain confidential or proprietary information and may be subject to the attorney-client privilege or other confidentiality protections. If you are not a designated recipient, you may not review, use, copy or distribute this message. If you receive this in error, please notify the sender by reply e-mail and delete this message. Thank you. *** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do you access an application.properties value directly from within a class?
When Struts load, it grabs application.properties and stores it's keys and values somewhere. From within an action class I need to access a value in application.properties. How could one do this? tia, mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
A dynamic _map_ (not list) index?
I was looking at http://jakarta.apache.org/struts/faqs/indexedprops.html, and realized it's possible to get a dynamic arraylist index by using Struts-EL. Well, my question is, if I have a radio button like: logic:iterate id=element html:radio property='userSkill' value=value(somekey)/ /logic:iterate Can I _still_ use Struts-EL inside the value= attribute to generate a dynamic key based off some exposed iterator (e.g. element from above), which is indeed a String value? What's a way to do this? It isn't quite the same as an index for a list, it's not a number, and there's no concrete example for a dynamic map index, which is why I ask. Can someone clue me in? I'm sort of stuck :). Thank you. Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do you access an application.properties value directly fromwithin a class?
Hi Mark, This bit of code should help (from Ted Husted's book! ;-) ) Locale locale = (Locale) session.getAttribute(Action.LOCALE_KEY); MessageResources messages = servlet.getResources(); String message = messages.getMessage(locale, important.message); And if there are replacements ({0}..), eg: String message = messages.getMessage(locale, important.message, new Date()); -- If education is too expensive, try ignorance. On Tue, 15 Jul 2003 12:27:51 -0400 Mark Galbreath [EMAIL PROTECTED] wrote: When Struts load, it grabs application.properties and stores it's keys and values somewhere. From within an action class I need to access a value in application.properties. How could one do this? tia, mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How do you access an application.properties value directly from within a class?
getResources() -- Voytek Jarnot Quidquid latine dictum sit, altum viditur. -Original Message- From: Mark Galbreath [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 11:28 AM To: 'Struts Users Mailing List' Subject: How do you access an application.properties value directly from within a class? When Struts load, it grabs application.properties and stores it's keys and values somewhere. From within an action class I need to access a value in application.properties. How could one do this? tia, mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] auto convert resource property files to different language
You're dreaming mate. But depending on the size of the file I'll do it for $50/hour :-) If you're really adventurous and have time to kill what you could do is write something using the altavista babel fish page and parsing the results out of the page automatically and make it translate everything for you. It would still take bloody ages, I suppose, but less work and that would be a pretty useful soft :-) Altavista might send ninjas to hunt you down though... -- If education is too expensive, try ignorance. On Tue, 15 Jul 2003 09:21:19 -0700 (PDT) Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi, I have a properties file which is in english, now i have to create properties files for different langauage like russian, spanish, french etc. now i dont know any of these languages is there any automatic conversion tool which will translate the properties file to different languages. If it is a open source will be nice :-) Ashish __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Iterating the resultset contents in the view (jsp)
Sure, understood. In fact I do this myself. But the reality is it's still an identifier that's defined in the data layer, in this case embedded in SQL. My point was that I'd be more concerned with identifiers defined in the data layer getting referenced in the view layer then I would with using Result and ResultSupport outside of a web app. P.S. After an initial test, using Result and ResultSupport outside of a web app appears to work just fine (only requires jstl.jar). FWIW... Quoting Craig R. McClanahan [EMAIL PROTECTED]: On Tue, 15 Jul 2003, Kris Schneider wrote: Well, okay, that makes the discussion a bit more abstract ;-). I understand your point, but the bottom line is that it's just a namespace (package) and an external library (JAR file). To my mind, the real question with either Result or RowSetDynaClass is how far from the data layer do you want the column names to propagate? In some cases that may be all the way to the view layer. Column names need propogate only as far as the SQL query, if that's what you want, thanks to the as capability of SQL: select customer_name as name, account_id as accountId from customers where past_due_status = 'Bad Boy'; the column names in the result set will be name and accountId, instead of whatever they are inside the database. Craig -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tlds not found compiling in Netbeans
Try with: %@ taglib uri=http://jakarta.apache.org/struts/tags-bean; prefix=bean % Normally it will load it from the cached copy in the struts.jar. This should also reduce the clutter in web-inf. -- If education is too expensive, try ignorance. On Tue, 15 Jul 2003 12:22:04 -0400 [EMAIL PROTECTED] wrote: I am developing using Netbeans and had the following line of code in my jsp files and similar for each other tld. %@ taglib uri=./../WEB-INF/struts-bean.tld prefix=bean % Everything compiled and worked fine when I ran the application in Tomcat. However, when I attempted to move the application to our web server which is running iPlanet, it didn't care for the ./../ and was unable to find my tld files so I changed the code for the jsp files so that it was exactly as the struts documentation and examples show beginning with just a forward slash: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % After doing that, the jsps won't compile in Netbeans which I assume is the reason that I used the ./../ in the first place when I started developing this app several months ago. My webapp is mounted in Netbeans and the WEB-INF directly is one level down and includes all of the tld files and web.xml file. My web.xml file contains the following and similar for each other tld. taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib Does anyone have any suggestions on how to get my code to compile? Thanks! ** This message is intended only for the designated recipient(s). It may contain confidential or proprietary information and may be subject to the attorney-client privilege or other confidentiality protections. If you are not a designated recipient, you may not review, use, copy or distribute this message. If you receive this in error, please notify the sender by reply e-mail and delete this message. Thank you. *** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] auto convert resource property files to different language
You've just asked for the Holy Grail of language translation. I don't think that tool exists yet. There are companies that provide that service. -Michael -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 10:21 AM To: [EMAIL PROTECTED] Subject: [OT] auto convert resource property files to different language Hi, I have a properties file which is in english, now i have to create properties files for different langauage like russian, spanish, french etc. now i dont know any of these languages is there any automatic conversion tool which will translate the properties file to different languages. If it is a open source will be nice :-) Ashish __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How do you access an application.properties value directly from within a class?
If you're just looking for the values, grab it as a resource bundle. Here's how I grab it in a Business Delegate: // Get the application's messages resources ResourceBundle resources = ResourceBundle.getBundle(ApplicationResources); String appDBVersion = resources.getString(webapp.db_version); And then of course, there's errors and messages - where it grabs it automagically: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(errors.existing.user, userForm.getUsername(), userForm.getEmail())); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(user.deleted, userForm.getEmail())); And lastly, you can get it from the servlet context in a servlet outside of struts: MessageResources resources = ((MessageResources) getServletContext().getAttribute(Globals.MESSAGES_KEY)); resources.getMessage(userFormEx.username); HTH, Matt -Original Message- From: Mark Galbreath [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 10:28 AM To: 'Struts Users Mailing List' Subject: How do you access an application.properties value directly from within a class? When Struts load, it grabs application.properties and stores it's keys and values somewhere. From within an action class I need to access a value in application.properties. How could one do this? tia, mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How do you access an application.properties value directly fr om within a class?
I forgot to add the simplest way in an Action class: MessageResources resources = getResources(request); resources.getMessage(keyName); -Original Message- From: Raible, Matt Sent: Tuesday, July 15, 2003 10:51 AM To: 'Struts Users Mailing List' Subject: RE: How do you access an application.properties value directly fr om within a class? If you're just looking for the values, grab it as a resource bundle. Here's how I grab it in a Business Delegate: // Get the application's messages resources ResourceBundle resources = ResourceBundle.getBundle(ApplicationResources); String appDBVersion = resources.getString(webapp.db_version); And then of course, there's errors and messages - where it grabs it automagically: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(errors.existing.user, userForm.getUsername(), userForm.getEmail())); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(user.deleted, userForm.getEmail())); And lastly, you can get it from the servlet context in a servlet outside of struts: MessageResources resources = ((MessageResources) getServletContext().getAttribute(Globals.MESSAGES_KEY)); resources.getMessage(userFormEx.username); HTH, Matt -Original Message- From: Mark Galbreath [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 10:28 AM To: 'Struts Users Mailing List' Subject: How do you access an application.properties value directly from within a class? When Struts load, it grabs application.properties and stores it's keys and values somewhere. From within an action class I need to access a value in application.properties. How could one do this? tia, mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles and %@ taglib
In tiles, where should I be best putting the %@ taglib uri=required lib %? Each tile jsp with its own tags or put them all in the layout JSP I use? Thanks, Erez - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tiles and %@ taglib
That's a matter of preference and application server capabilities. I prefer to keep them all in the same layout.jsp but I'm using jboss-3.2.0 with jetty and it doesn't support it that way. From what I know, only JRun currently supports that option. (Correct me if I'm wrong someone). Once you find an application server that supports both styles, however, it really becomes a matter of preference. -Tim -Original Message- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 1:56 PM To: 'Struts Users Mailing List' Subject: Tiles and %@ taglib In tiles, where should I be best putting the %@ taglib uri=required lib %? Each tile jsp with its own tags or put them all in the layout JSP I use? Thanks, Erez - 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]
Extending RequestProcessor with Tiles
I have extended the org.apache.struts.action.RequestProcessor (i.e. processPreprocess() method) then i continued to implement tiles i.e. defining the plugin in my struts-config.xml. Now on startup i get the following error: TilesPlugin : Specified RequestProcessor not compatible with TilesRequestProcessor; - nested throwable: (javax.servlet.ServletException: TilesPlugin : Specified RequestProcessor not compatible with TilesRequestProcessor) at org.jboss.jetty.Jetty.deploy(Jetty.java:436) at org.jboss.jetty.JettyService.performDeploy(JettyService.java:243) I've also upgraded to struts 1.1 and still get the same error any ideas??? _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Extending RequestProcessor with Tiles
extend org.apache.struts.tiles.TilesRequestProcessor -- Voytek Jarnot Quidquid latine dictum sit, altum viditur. -Original Message- From: Pat Quinn [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 12:08 PM To: [EMAIL PROTECTED] Subject: Extending RequestProcessor with Tiles I have extended the org.apache.struts.action.RequestProcessor (i.e. processPreprocess() method) then i continued to implement tiles i.e. defining the plugin in my struts-config.xml. Now on startup i get the following error: TilesPlugin : Specified RequestProcessor not compatible with TilesRequestProcessor; - nested throwable: (javax.servlet.ServletException: TilesPlugin : Specified RequestProcessor not compatible with TilesRequestProcessor) at org.jboss.jetty.Jetty.deploy(Jetty.java:436) at org.jboss.jetty.JettyService.performDeploy(JettyService.java:243) I've also upgraded to struts 1.1 and still get the same error any ideas??? _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
reusing same form for inserts and updates
I've searched the archives for this type of discussion but I'm not really finding what I want. I'd like to reuse the same jsp form for both inserts and updates of a particular set of data. My current solution is to come into the action with a flag of new or edit. If edit, the action will fetch the existing data into the FormBean by the primary key (int) which is currently in the FormBean, then forward to the input view. If new, the action will just forward to the input view (thus the primary key is 0) The input view is the jsp form, which has a hidden property set to the primary key of the FormBean. The form is then submitted back to this action with a flag of save, and then it will check for the presence of the primary key (from the hidden field), and do an insert or update based on whether or not it is 0. Another variation of this is to set a specific field in the FormBean instead of the primary key, but it is the same idea (still requires handling this field as a hidden field in the form) Which I found at: http://www.reumann.net/do/struts/lessons I'd really like to clean this up a bit, hopefully by removing the requirement of setting a hidden property in the form. One idea was to put the new/edit information into the session, but this fails if the user has 2 browser windows open, trying to do a new record in one window and an update in another (since they share the session). Another idea was to attempt an update, and then fail back to an insert, or vice versa. But that is an extra db hit. Any suggestions or experiences would be helpful. Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: URL validation with struts???
On Tue, 15 Jul 2003, Gandle, Panchasheel wrote: That shoud do it right Open a new URL with a specified URL, if it throws MalformedURLException its bad URL Unfortunately, there's a gotcha to this approach -- the JVM you are running on has to understand the scheme part of the URL you are testing for. For example, you'll get a MalformedURLException on any https: URL (even if it's actually correct) if your JVM doesn't have the JSSE classes (or equivalent) that understands SSH. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How do you access an application.properties value directly fr om within a class?
Nice, clean, elegant solution - thanks a lot, Matt! -Original Message- From: Raible, Matt [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 12:54 PM To: 'Struts Users Mailing List' Subject: RE: How do you access an application.properties value directly fr om within a class? I forgot to add the simplest way in an Action class: MessageResources resources = getResources(request); resources.getMessage(keyName); -Original Message- From: Raible, Matt Sent: Tuesday, July 15, 2003 10:51 AM To: 'Struts Users Mailing List' Subject: RE: How do you access an application.properties value directly fr om within a class? If you're just looking for the values, grab it as a resource bundle. Here's how I grab it in a Business Delegate: // Get the application's messages resources ResourceBundle resources = ResourceBundle.getBundle(ApplicationResources); String appDBVersion = resources.getString(webapp.db_version); And then of course, there's errors and messages - where it grabs it automagically: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(errors.existing.user, userForm.getUsername(), userForm.getEmail())); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(user.deleted, userForm.getEmail())); And lastly, you can get it from the servlet context in a servlet outside of struts: MessageResources resources = ((MessageResources) getServletContext().getAttribute(Globals.MESSAGES_KEY)); resources.getMessage(userFormEx.username); HTH, Matt -Original Message- From: Mark Galbreath [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 10:28 AM To: 'Struts Users Mailing List' Subject: How do you access an application.properties value directly from within a class? When Struts load, it grabs application.properties and stores it's keys and values somewhere. From within an action class I need to access a value in application.properties. How could one do this? tia, mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 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: URL validation with struts???
Thats true, so if you have https, we could always truncate the 's' after http and pass it to URL to check whether it throws MalformedURLException. should work. Panchasheel -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 1:12 PM To: Struts Users Mailing List Subject: RE: URL validation with struts??? On Tue, 15 Jul 2003, Gandle, Panchasheel wrote: That shoud do it right Open a new URL with a specified URL, if it throws MalformedURLException its bad URL Unfortunately, there's a gotcha to this approach -- the JVM you are running on has to understand the scheme part of the URL you are testing for. For example, you'll get a MalformedURLException on any https: URL (even if it's actually correct) if your JVM doesn't have the JSSE classes (or equivalent) that understands SSH. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Error Handlers] instanceof ?
Off hand, would Struts be able to catch the exception with this desired handler? Action throws ServiceNotFoundException ExceptionHandler catches ServiceException Where ServiceNotFoundException is an instance of ServiceException? Thanks, Jacob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Iterating the resultset contents in the view (jsp)
On Tue, 15 Jul 2003, Kris Schneider wrote: Date: Tue, 15 Jul 2003 12:42:36 -0400 From: Kris Schneider [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Iterating the resultset contents in the view (jsp) Sure, understood. In fact I do this myself. But the reality is it's still an identifier that's defined in the data layer, in this case embedded in SQL. Isn't that going to be true even if you bury SQL inside a DAO? Someone somewhere is going to have to deal with the column names that are defined in your database. My point was that I'd be more concerned with identifiers defined in the data layer getting referenced in the view layer then I would with using Result and ResultSupport outside of a web app. A lot of people externalize SQL command strings into properties files so that they can tweak them for differences between databases. This would also give you a level of separation, in that you can reference the actual column names ONLY in the properties file strigns, and have your code using the result set deal only with the aliases set with as. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: reusing same form for inserts and updates
Woops... after thinking about this more, I realized that I *have* to put the primary key in the form somewhere, or I won't know what record to update... I'd still like to hear your experiences in this area though... Thanks Wes Rood wrote: I've searched the archives for this type of discussion but I'm not really finding what I want. I'd like to reuse the same jsp form for both inserts and updates of a particular set of data. My current solution is to come into the action with a flag of new or edit. If edit, the action will fetch the existing data into the FormBean by the primary key (int) which is currently in the FormBean, then forward to the input view. If new, the action will just forward to the input view (thus the primary key is 0) The input view is the jsp form, which has a hidden property set to the primary key of the FormBean. The form is then submitted back to this action with a flag of save, and then it will check for the presence of the primary key (from the hidden field), and do an insert or update based on whether or not it is 0. Another variation of this is to set a specific field in the FormBean instead of the primary key, but it is the same idea (still requires handling this field as a hidden field in the form) Which I found at: http://www.reumann.net/do/struts/lessons I'd really like to clean this up a bit, hopefully by removing the requirement of setting a hidden property in the form. One idea was to put the new/edit information into the session, but this fails if the user has 2 browser windows open, trying to do a new record in one window and an update in another (since they share the session). Another idea was to attempt an update, and then fail back to an insert, or vice versa. But that is an extra db hit. Any suggestions or experiences would be helpful. 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]
Is this really the best way to handle this problem
I've been struggling with a problem similar to the one described (and solved) at http://www.mail-archive.com/[EMAIL PROTECTED]/msg50901.html . Is this really the recommended way to solve population / repopulation of properties stored in a List() of whatever-data-object-i-need-in-the-form-of-a-bean ? Is there a better way to acheive the same result ? (I.e represent a collection in a form) I've read that a practice often used to represent collections (a DB-table for intstance) is to make a bean that has getters / setters for the properties of a single row and then have the ActionForm contain a List() of those beans. One for every row (in the DB-example). That far I can follow, and see how / why. But is there no better way to update the values in the ActionForm (beans) when the data is submitted than in the URL above ? //Linus Nikander - [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Iterating the resultset contents in the view (jsp)
--- Craig R. McClanahan [EMAIL PROTECTED] wrote: On Tue, 15 Jul 2003, Kris Schneider wrote: Date: Tue, 15 Jul 2003 12:42:36 -0400 From: Kris Schneider [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Iterating the resultset contents in the view (jsp) Sure, understood. In fact I do this myself. But the reality is it's still an identifier that's defined in the data layer, in this case embedded in SQL. Isn't that going to be true even if you bury SQL inside a DAO? Someone somewhere is going to have to deal with the column names that are defined in your database. My point was that I'd be more concerned with identifiers defined in the data layer getting referenced in the view layer then I would with using Result and ResultSupport outside of a web app. A lot of people externalize SQL command strings into properties files so that they can tweak them for differences between databases. This would also give you a level of separation, in that you can reference the actual column names ONLY in the properties file strigns, and have your code using the result set deal only with the aliases set with as. I've found this approach to be quite useful. It gets tough when you need to dynamically create a query based on a user's search form values. In that situation I define each SQL search chunk under it's own key and use MessageFormat to insert values appropriately. David Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Error Handlers] instanceof ?
--- Hookom, Jacob [EMAIL PROTECTED] wrote: Off hand, would Struts be able to catch the exception with this desired handler? Action throws ServiceNotFoundException ExceptionHandler catches ServiceException Where ServiceNotFoundException is an instance of ServiceException? Not currently. I was thinking about improving the ExceptionHandler to support that just today :-). It would be nice if the ExceptionHandler acted like a global try/catch block with the same inheritance rules. David Thanks, Jacob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: reusing same form for inserts and updates
My primary keys are the email addresses of the users, and I always bring up a blank form and allow the user to choose (radio buttons) to retrieve, update, or submit new records based on date. The userId is stored in session scope at login. Mark -Original Message- From: Wes Rood [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 1:13 PM To: Struts Users Mailing List Subject: reusing same form for inserts and updates I've searched the archives for this type of discussion but I'm not really finding what I want. I'd like to reuse the same jsp form for both inserts and updates of a particular set of data. My current solution is to come into the action with a flag of new or edit. If edit, the action will fetch the existing data into the FormBean by the primary key (int) which is currently in the FormBean, then forward to the input view. If new, the action will just forward to the input view (thus the primary key is 0) The input view is the jsp form, which has a hidden property set to the primary key of the FormBean. The form is then submitted back to this action with a flag of save, and then it will check for the presence of the primary key (from the hidden field), and do an insert or update based on whether or not it is 0. Another variation of this is to set a specific field in the FormBean instead of the primary key, but it is the same idea (still requires handling this field as a hidden field in the form) Which I found at: http://www.reumann.net/do/struts/lessons I'd really like to clean this up a bit, hopefully by removing the requirement of setting a hidden property in the form. One idea was to put the new/edit information into the session, but this fails if the user has 2 browser windows open, trying to do a new record in one window and an update in another (since they share the session). Another idea was to attempt an update, and then fail back to an insert, or vice versa. But that is an extra db hit. Any suggestions or experiences would be helpful. 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]
mapping.findForward( mapping.getInput() ) ?
In Cavaness's book Programming Jakarta Struts, there is a code sample on page 188 that contains a line I don't understand. In the execute method of an implementation of an Action class, is the following line of code: return mapping.findForward( mapping.getInput() ); Doesn't the input have to be an Action? The DTD says action or other resource. What other resource? Could I put the name of a tile in there? I tried putting the name of a forward in there, but the validation framework complained that it didn't start with a /. Thanks, -- Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [ARTICLE] Succeeding with Struts Pt 2: Indexed Properties of Beans
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED] The iterated object has key and value properties to give you access to either the key or the value with a nested expression. Right, but there's no way to use them with the indexed=true flag of the html tags. You still end up having to do some convoluted field name generation using EL or %=. James - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is this really the best way to handle this problem
I've seen two ways of dealing w/ this problem, both of which I see as 'hackish' in nature. Solution A: In your getters/setters you implement the following code public MyCustomBean getMyCustomBean(int index) { while(index = myCustomBeanList.size()) { myCustomBeanList.add(new MyCustomBean()); } return (MyCustomBean)myCustomBeanList.get(index); } In that way you'll never encounter the common IndexOutOfBoundsException. The problem here is that you tend to use alot of hidden fields in your UI to repopulate the data back into the dynamically created beans. Solution B: In your reset() method you repopulate your internal Collection of beans. The problem w/ this approach is that often times you have a separate Action that prepopulates your ActionForm. This provides for good separation - the Action is a retriever of a data (nothing more) and the ActionForm is merely a container for data (nothing more). With this approach your ActionForm suddenly starts becoming more intelligent than it really should be. Now it's aware of how to populate itself...not a good thing IMO. I'd be very interested in hearing other solutions to this problem as I find both of the above solutions cumbersome and hackish and would love to stop implementing them. I've been struggling with a problem similar to the one described (and solved) at http://www.mail-archive.com/[EMAIL PROTECTED]/msg50901.html . Is this really the recommended way to solve population / repopulation of properties stored in a List() of whatever-data-object-i-need-in-the-form-of-a-bean ? Is there a better way to acheive the same result ? (I.e represent a collection in a form) I've read that a practice often used to represent collections (a DB-table for intstance) is to make a bean that has getters / setters for the properties of a single row and then have the ActionForm contain a List() of those beans. One for every row (in the DB-example). That far I can follow, and see how / why. But is there no better way to update the values in the ActionForm (beans) when the data is submitted than in the URL above ? //Linus Nikander - [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] John M. Corro Cornerstone Consulting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A dynamic _map_ (not list) index?
Never mind this question, I answered it to myself. The EL works just as well on map backed forms as it does on list-backed forms, or list backed form properties, more correctly :). Sorry to bug anyone. Martin Tuesday, July 15, 2003, 9:34:16 AM, you wrote: MN I was looking at http://jakarta.apache.org/struts/faqs/indexedprops.html, MN and realized it's possible to get a dynamic arraylist index by using MN Struts-EL. Well, my question is, if I have a radio button like: MN logic:iterate id=element MN html:radio property='userSkill' value=value(somekey)/ MN /logic:iterate MN Can I _still_ use Struts-EL inside the value= attribute to generate a MN dynamic key based off some exposed iterator (e.g. element from above), MN which is indeed a String value? MN What's a way to do this? It isn't quite the same as an index for a list, MN it's not a number, and there's no concrete example for a dynamic map index, MN which is why I ask. MN Can someone clue me in? I'm sort of stuck :). MN Thank you. MN Martin MN - MN To unsubscribe, e-mail: [EMAIL PROTECTED] MN For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]