Re: html:form : pre-populating fields from the Action java code
You can use 3 differents FlightBean and then populate the *value attribute* in each html:text/ When you click only one form submit is sent Luis Gervaso On Fri, 22 Oct 2004 15:28:16 +0900, Bill Keese [EMAIL PROTECTED] wrote: I have a question about pre-populating the fields of a form you display in the browser. To pre-populate fields, the Action saves a Form bean in the context via request.setAttribute(inputForm, inputForm), and html:form tag looks up the form bean. html:form determines the form bean's name automatically based on the specified action and the settings in struts-config.xml. But, what if you wanted a web page with multiple forms all pointing at the same action? For example, an airline ticket website might display 10 possible flights and have a button to book each flight. All the buttons point at the same bookFlight action, but the flight number attribute is different. In other words, how do I implement the code below without using the name (or beanName) attribute: MyAction.java: request.setAttribute(inputForm1, new InputForm($499, flight 31)); request.setAttribute(inputForm2, new InputForm($599, flight 32)); request.setAttribute(inputForm3, new InputForm($699, flight 33)); MyPage.jsp: html:form beanName=inputForm1 action=bookFlight.do html:button ... / /html:form html:form beanName=inputForm2 action=bookFlight.do html:button ... / /html:form html:form beanName=inputForm3 action=bookFlight.do html:button ... / /html:form Bill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Un saludo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OT FRIDAY: RIA Flash vs Java Ex:
http://www.jext.org/apps/jext.jnlp Could one do this medium type of application in Flash? See the Java RiA advantage in this ex. This is nice becuase when I go to client's or on my Mac/Linux/Windows accounts, I can edit right away, w/o messing arround looking for their funky editor. Commes in handy, put it in your toolbox, like when some strange conf needs to be edited and your ide is bussy. .V - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
bean:write/ I think I have a scope problem....
All I'm using the bean:write/ tag to get a value out of the Session scope as follows... bean:write name='currentStatusBean' property='reportID'/ I seem to be getting the wrong value, however when I grab the object into a local variable However, if I do THIS, I get the correct value CurrentStatusBean status = (CurrentStatusBean) session.getAttribute(); status.getReportID(); So, I tried taking the status bean and sticking it in the page context before the bean:write/ tag gets to it thinking that maybe there was a bean of that name already in the pageContext the tag was using first and I STILL got the wrong value. Keep in mind the correct reportID is in fact in the object on the session. What am I doing wrong? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [html:select/optionsCollection] I don't get it! :(
Fri, 22 Oct 2004 15:46:22 +0200, Albrecht, Michael [EMAIL PROTECTED] wrote: Hi Arnaud! Yo Michael! The following lines show you an example for optionsCollection - tag: html:select property=duration value=7 html:optionsCollection name=searchForm property=durations value=days label=text / /html:select I got something similar: html:select name=objectifs property=%= id[ + indx + ] % value=%= id[ + indx + ] % html:optionsCollection name=objectifs property=nomsRubriquesList value=id label=nom/ /html:select I got a 'objectifs' bean in the request scope. The bean has a Vector of 'ste.beans.Rubrique'? You can get the 'List' with 'getNomsRubriquesList()' method. In the bean Rubrique, I got 'getId()' (returns an int) and I got 'getNom()' (String). The error message I got is: No getter method available for property nom for bean under name [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]' The bean searchForm has got an attribute of type java.util.List called durations (of course there`s a public method getDurations()). A duration-object /-item of this list has got two attributes called days and text (that means getDays() and getText()) which are both of type String. So that is why I can use optionsCollection, because label and value is part of the same bean. The Getters have to be created because they will be used by BeanUtils framework. The property duration of the html:select - tag is an attribute of the form associated with the Struts action, which is called by submit. This form bean has nothing to do with searchForm. Hopefully this helps you out of your chaos. :( Michael Thanks for your help ;-) -- Arnaud Vandyck http://fosdem.org/ Free and Open Source Developers' European Meeting February 26-27 2005, Bruxelles, Belgium - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tiles and exceptions
Hello world, My webapp is getting a little bit bigger every day?. On the same rythm grows my struts knowlegde. But a this point i'm stuck with managing exceptions in my tiles element. I made little test. I gather all my tiles authenticationLayout defined this way in a single jsp (authentication_test.jsp). Obviously, i also made some modification in my struts-config.xml (tiles layout became became real for path and input elements of my action and lobal-exceptions). definition name=rootLayout path=/tiles-layouts/rootLayout.jsp put name=header value=/tiles-components/header.jsp/ put name=top value=/tiles-components/top.jsp/ put name=body value=/tiles-components/body.jsp/ put name=footer value=/tiles-components/footer.jsp/ /definition definition name=authenticationLayout extends=rootLayout put name=bodyvalue=/tiles-components/authentication.jsp/ /definition And i'm not sure to understand why the jsp catch the exception (my pretty error appears in the rendered html page) and the tiles element does not (the whole body is blank). Is there a soul to explain that to me? What about a work-around? THX, ___[ Pub ] Envie de discuter gratuitement avec vos amis ? Téléchargez Yahoo! Messenger http://yahoo.ifrance.com _ Envie de discuter gratuitement avec vos amis ? Téléchargez Yahoo! Messenger http://yahoo.ifrance.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tiles and exceptions
At 2:25 PM + 10/22/04, liooil wrote: And i'm not sure to understand why the jsp catch the exception (my pretty error appears in the rendered html page) and the tiles element does not (the whole body is blank). Is there a soul to explain that to me? What about a work-around? I'm not sure I understand - there's no reason your JSP should catch the exception unless you have handling for that in the JSP - in which case, you shouldn't be surprised! :) But if you don't have error handling in the tile itself (for example, a JSTL c:catch tag), then an exception in there will be thrown. What I find somewhat annoying is that Global Exception handlers can't function effectively to catch tiles JSP errors, because the HttpServletResponse has already been committed by the time the exception is thrown. I'd like to figure out a good fallback strategy inside the Global Exception Handler for when response.isCommitted() is true. I've tried a few things, but nothing so far that I'd consider making part of the Struts core. In the meantime, c:catch is probably the best solution. Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn back; I'll know I'm in the wrong place. - Carlos Santana
Best practises to get message resource in java class,
Hi I am working on a struts application, In this a Action class calls a java class which does all the business logic, then this java class returns a ArrayList which has 1 Completion flag, 0 successfull, 1 error 2 All messages to be displayed 3 Data for jsp screen These messages generated due to problem with data for business logic, for example value cannot be 2 if user = ABC I want these messages to be Internationalized, I will define these messages in resource file, and generate them in this java class What is the best way of doing it, i want these java classes to be decoupled from struts, so can be used in any web application. What will be the best way to do so Ashish __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Need Ideas for This Puzzle
The puzzle relates to displaying check boxes (checkbox or multibox). What I have are members who belong to professional groups and sub-groups. E.g., Group A with sub-groups A-1, A-2, A-3, A-4. Group B with sub-groups B-1, B-2, B-3 Group C with sub-groups C-1, C-2, C-3, C-4, C-5, C-6 etc. web site users make multiple selections among groups. And all members in those groups will receive an e-mail message. I can display a check box for every single sub-group. And give each group a select all check box. All I have to take care are the checked sub-groups. The challege comes as the roles of the web site users are introduced. According to the role of the web site user, I have to display certain groups (not all the groups) and certain sub-groups (not all sub-groups within a group) to him/her. How do I disply groups and their sub-groups under such a condition? __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need Ideas for This Puzzle
There are at least two good solutions. I like the second one best. 1. Tag Conditional Logic Solution Just use the c:if, c:choose and c:when tags. I assume, Caroline, that you are using JSTL. If not, then there are equivalent solutions with Struts logic tags. 2 Action Conditional Delivery Solution Or, you can read the role of the user going into the Action that forwards to the response object displaying the options and only deliver the options appropriate to the role of the user. Michael McGrady Caroline Jen wrote: The puzzle relates to displaying check boxes (checkbox or multibox). What I have are members who belong to professional groups and sub-groups. E.g., Group A with sub-groups A-1, A-2, A-3, A-4. Group B with sub-groups B-1, B-2, B-3 Group C with sub-groups C-1, C-2, C-3, C-4, C-5, C-6 etc. web site users make multiple selections among groups. And all members in those groups will receive an e-mail message. I can display a check box for every single sub-group. And give each group a select all check box. All I have to take care are the checked sub-groups. The challege comes as the roles of the web site users are introduced. According to the role of the web site user, I have to display certain groups (not all the groups) and certain sub-groups (not all sub-groups within a group) to him/her. How do I disply groups and their sub-groups under such a condition? __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo - 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: Need Ideas for This Puzzle
There are at least two good solutions. I like the second one best. 1. Tag Conditional Logic Solution Just use the c:if, c:choose and c:when tags. I assume, Caroline, that you are using JSTL. If not, then there are equivalent solutions with Struts logic tags. 2 Action Conditional Delivery Solution Or, you can read the role of the user going into the Action that forwards to the response object displaying the options and only deliver the options appropriate to the role of the user. As a third alternative, rather than do everything on conditional tags in your jsp I would probably opt for either an addional bean or additional properties in your ActionForm that is contains methods such as isGroupADisplayed() etc etc and set the properties in your Action that loads the form. Regards Roger __ This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted. __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Need Ideas for This Puzzle
Here's my idea: Create a bean that has multiple Boolean fields, with each corresponding to a checkbox you might want to display. In the action that loads data for this page, process the user's role and set the bean's Boolean values accordingly. Store the bean so that the jsp can read it. For all the checkboxes, the jsp will read the bean and display only the checkboxes that have a corresponding true value. In the action that saves the data from this page, process only those checkboxes that were displayed. Wiebe -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Friday, October 22, 2004 9:03 AM To: [EMAIL PROTECTED] Subject: Need Ideas for This Puzzle The puzzle relates to displaying check boxes (checkbox or multibox). What I have are members who belong to professional groups and sub-groups. E.g., Group A with sub-groups A-1, A-2, A-3, A-4. Group B with sub-groups B-1, B-2, B-3 Group C with sub-groups C-1, C-2, C-3, C-4, C-5, C-6 etc. web site users make multiple selections among groups. And all members in those groups will receive an e-mail message. I can display a check box for every single sub-group. And give each group a select all check box. All I have to take care are the checked sub-groups. The challege comes as the roles of the web site users are introduced. According to the role of the web site user, I have to display certain groups (not all the groups) and certain sub-groups (not all sub-groups within a group) to him/her. How do I disply groups and their sub-groups under such a condition? __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo - 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: Need Ideas for This Puzzle
From: Caroline Jen [EMAIL PROTECTED] The challege comes as the roles of the web site users are introduced. According to the role of the web site user, I have to display certain groups (not all the groups) and certain sub-groups (not all sub-groups within a group) to him/her. How do I disply groups and their sub-groups under such a condition? I would decide who sees what by calling helper classes from the Action, then only place objects in the request or session that the user is allowed to see. That way by the time you get to the JSP all you have to do is iterate over what's there. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best practises to get message resource in java class,
The Struts source code itself offers many examples of how to programatically access localized text from a mesage bundle. The MessageResources class is the key to this -- it's also the code used by tags like bean:message for ths purpose. For example, here's some snippets from how one might use a MessageResources instance to localize the text for a particular result: // MessageResources bundle for this application protected static MessageResources messages = MessageResources.getMessageResources(com.mycompany.MyBunde); ... // Look up an message string using the Locale for this request Locale locale = (Locale) request.getAttribute(Globals.LOCALE_KEY); String text = messages.getMessage(messages, some.message.key); Craig On Fri, 22 Oct 2004 08:48:16 -0700 (PDT), Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi I am working on a struts application, In this a Action class calls a java class which does all the business logic, then this java class returns a ArrayList which has 1 Completion flag, 0 successfull, 1 error 2 All messages to be displayed 3 Data for jsp screen These messages generated due to problem with data for business logic, for example value cannot be 2 if user = ABC I want these messages to be Internationalized, I will define these messages in resource file, and generate them in this java class What is the best way of doing it, i want these java classes to be decoupled from struts, so can be used in any web application. What will be the best way to do so Ashish __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail - 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: Need Ideas for This Puzzle
What about something like: % boolean checked = isChecked(a); // check if the value should be checked by default if(showCheckbox(user, a)) { // check if, for this user, the checkbox should be visible % input type=checkbox name=a value=a %= checked ?checked: % % } else { // show disabled checkbox (or leave that out to show nothing...) % input type=checkbox name=noname %= checked ? checked : % disabled=diabled / % if(checked) { // don't need hidden value if default is unchecked % input type=hidden name=a value=a % } } % --- Wiebe de Jong [EMAIL PROTECTED] wrote: Here's my idea: Create a bean that has multiple Boolean fields, with each corresponding to a checkbox you might want to display. In the action that loads data for this page, process the user's role and set the bean's Boolean values accordingly. Store the bean so that the jsp can read it. For all the checkboxes, the jsp will read the bean and display only the checkboxes that have a corresponding true value. In the action that saves the data from this page, process only those checkboxes that were displayed. Wiebe -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Friday, October 22, 2004 9:03 AM To: [EMAIL PROTECTED] Subject: Need Ideas for This Puzzle The puzzle relates to displaying check boxes (checkbox or multibox). What I have are members who belong to professional groups and sub-groups. E.g., Group A with sub-groups A-1, A-2, A-3, A-4. Group B with sub-groups B-1, B-2, B-3 Group C with sub-groups C-1, C-2, C-3, C-4, C-5, C-6 etc. web site users make multiple selections among groups. And all members in those groups will receive an e-mail message. I can display a check box for every single sub-group. And give each group a select all check box. All I have to take care are the checked sub-groups. The challege comes as the roles of the web site users are introduced. According to the role of the web site user, I have to display certain groups (not all the groups) and certain sub-groups (not all sub-groups within a group) to him/her. How do I disply groups and their sub-groups under such a condition? __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo - 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] ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need Ideas for This Puzzle
Hi, Caroline, Just a little follow up to all these good suggestions. I agree that if you use the Action, then you should definitely use helper classes and hopefully decouple them from the action. I like to use multithreading in the helper classes generally. The suggestions about using the ActionForm instead are also good. I guess to decide whether you want to go with Action or ActionForm should depend on whether your logic makes the choice of roles one of presentation or one of buisness logic. I think it could go either way. Definitely these are two different approaches. Michael McGrady Wendy Smoak wrote: From: Caroline Jen [EMAIL PROTECTED] The challege comes as the roles of the web site users are introduced. According to the role of the web site user, I have to display certain groups (not all the groups) and certain sub-groups (not all sub-groups within a group) to him/her. How do I disply groups and their sub-groups under such a condition? I would decide who sees what by calling helper classes from the Action, then only place objects in the request or session that the user is allowed to see. That way by the time you get to the JSP all you have to do is iterate over what's there. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT]: Need Ideas for This Puzzle
Maybe it's because it's Friday, or maybe it's because I've been especially dense this week, but isn't multithreading orthogonal to the problem? Dennis Michael McGrady [EMAIL PROTECTED] 10/22/2004 02:05 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To Struts Users Mailing List [EMAIL PROTECTED] cc Subject Re: Need Ideas for This Puzzle Hi, Caroline, Just a little follow up to all these good suggestions. I agree that if you use the Action, then you should definitely use helper classes and hopefully decouple them from the action. I like to use multithreading in the helper classes generally. The suggestions about using the ActionForm instead are also good. I guess to decide whether you want to go with Action or ActionForm should depend on whether your logic makes the choice of roles one of presentation or one of buisness logic. I think it could go either way. Definitely these are two different approaches. Michael McGrady Wendy Smoak wrote: From: Caroline Jen [EMAIL PROTECTED] The challege comes as the roles of the web site users are introduced. According to the role of the web site user, I have to display certain groups (not all the groups) and certain sub-groups (not all sub-groups within a group) to him/her. How do I disply groups and their sub-groups under such a condition? I would decide who sees what by calling helper classes from the Action, then only place objects in the request or session that the user is allowed to see. That way by the time you get to the JSP all you have to do is iterate over what's there. - 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]
Request parameters not making it to Actions?
Hello all... I've got a strange situation that's been bugging me for a while. First, some quick background: I wrote an application about two years ago that was based on a proprietary framework that has now been converted to Struts. One of the things this proprietary framework was missing was the concept of ActionForms. Instead, when you hit your controller classes, you dealt with the Request object directly to get your parameters. Since as usual I had to get the conversion done in far less time than it should have been done in, I basically would up not really using ActionForms except to transfer data back to the view. In other words, no validation is don in the ActionForms, and they are not auto-populateed by Struts. My Actions still deal directly with Request, I just populate the ActionForm on the way out to the JSP (I intended to use the ActionForms more properly later, but that time has never presented itself). So, now I come to the issue... It seems that every now and again (average of about 25 times per 50,000 transaction) I get NPE's in my Actions and they are always because some value that was expected to be in Request is null. Now, the front-end does a bunch of validation (JavaScript) and I've gone over it a ton of times and there doesn't seem to be any way a user could submit a form without filling in required elements (and most of them should be blanks anyway, not nulls). I thought about maybe they were using the Back button in some crazy way, but the app opens in a new chromless window, so they would have to be using a keyboard shortcut. I've tried every crazy thing I could think of to break it, but it never seems to break. I have NEVER ONCE replicated one of these problems. So, my question comes down to this... has anyone ever seen a situation where a Struts-based app running on Tomcat (5.0.25 I believe) would lose request data, either as a fault of Struts or of Tomcat? Could it be some Tomcat tuning issue? (I will ask this same question on the Tomcat list, but I wanted to start here first). Any thoughts would be appreciated. Fortunately no one is complaining because the app is generally quite stable, but these once-in-a-while exceptions are pissing me off more than anything else! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Request parameters not making it to Actions?
I should point out, before anyone calls me on it, that this is strictly an internal app that is IE-specific (as per the overlords of the company's orders). Therefore, there's no chance that user disabled scripting or anything, and indeed they wouldn't have been able to even log in if they had. So, the validations before submission are most definitely firing. I'm convinced they aren't broke, but it's possible they could be... I'm proceeding under the belief that they aren't though and therefore an invalid submission is not being made at any point (unless it's a navigation problem, i.e., back, which is still a possibility) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Fri, October 22, 2004 3:10 pm, [EMAIL PROTECTED] said: Hello all... I've got a strange situation that's been bugging me for a while. First, some quick background: I wrote an application about two years ago that was based on a proprietary framework that has now been converted to Struts. One of the things this proprietary framework was missing was the concept of ActionForms. Instead, when you hit your controller classes, you dealt with the Request object directly to get your parameters. Since as usual I had to get the conversion done in far less time than it should have been done in, I basically would up not really using ActionForms except to transfer data back to the view. In other words, no validation is don in the ActionForms, and they are not auto-populateed by Struts. My Actions still deal directly with Request, I just populate the ActionForm on the way out to the JSP (I intended to use the ActionForms more properly later, but that time has never presented itself). So, now I come to the issue... It seems that every now and again (average of about 25 times per 50,000 transaction) I get NPE's in my Actions and they are always because some value that was expected to be in Request is null. Now, the front-end does a bunch of validation (JavaScript) and I've gone over it a ton of times and there doesn't seem to be any way a user could submit a form without filling in required elements (and most of them should be blanks anyway, not nulls). I thought about maybe they were using the Back button in some crazy way, but the app opens in a new chromless window, so they would have to be using a keyboard shortcut. I've tried every crazy thing I could think of to break it, but it never seems to break. I have NEVER ONCE replicated one of these problems. So, my question comes down to this... has anyone ever seen a situation where a Struts-based app running on Tomcat (5.0.25 I believe) would lose request data, either as a fault of Struts or of Tomcat? Could it be some Tomcat tuning issue? (I will ask this same question on the Tomcat list, but I wanted to start here first). Any thoughts would be appreciated. Fortunately no one is complaining because the app is generally quite stable, but these once-in-a-while exceptions are pissing me off more than anything else! - 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: Need Ideas for This Puzzle
Keeping the unused fields around as hidden fields is a good idea. It will keep your 'select all' javascript from getting complicated. Just make sure that your action doesn't process any of the fields that were made hidden, because hackers could modify those hidden fields manually before sending back the response. Wiebe -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Friday, October 22, 2004 10:59 AM To: Struts Users Mailing List Subject: RE: Need Ideas for This Puzzle What about something like: % boolean checked = isChecked(a); // check if the value should be checked by default if(showCheckbox(user, a)) { // check if, for this user, the checkbox should be visible % input type=checkbox name=a value=a %= checked ?checked: % % } else { // show disabled checkbox (or leave that out to show nothing...) % input type=checkbox name=noname %= checked ? checked : % disabled=diabled / % if(checked) { // don't need hidden value if default is unchecked % input type=hidden name=a value=a % } } % --- Wiebe de Jong [EMAIL PROTECTED] wrote: Here's my idea: Create a bean that has multiple Boolean fields, with each corresponding to a checkbox you might want to display. In the action that loads data for this page, process the user's role and set the bean's Boolean values accordingly. Store the bean so that the jsp can read it. For all the checkboxes, the jsp will read the bean and display only the checkboxes that have a corresponding true value. In the action that saves the data from this page, process only those checkboxes that were displayed. Wiebe -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Friday, October 22, 2004 9:03 AM To: [EMAIL PROTECTED] Subject: Need Ideas for This Puzzle The puzzle relates to displaying check boxes (checkbox or multibox). What I have are members who belong to professional groups and sub-groups. E.g., Group A with sub-groups A-1, A-2, A-3, A-4. Group B with sub-groups B-1, B-2, B-3 Group C with sub-groups C-1, C-2, C-3, C-4, C-5, C-6 etc. web site users make multiple selections among groups. And all members in those groups will receive an e-mail message. I can display a check box for every single sub-group. And give each group a select all check box. All I have to take care are the checked sub-groups. The challege comes as the roles of the web site users are introduced. According to the role of the web site user, I have to display certain groups (not all the groups) and certain sub-groups (not all sub-groups within a group) to him/her. How do I disply groups and their sub-groups under such a condition? __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo - 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] ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.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: Request parameters not making it to Actions?
I don't know if this is happening to you, but one thing to examine your client side JavaScript code for is setting an input element's disabled property. If you ever do this, and then submit the form that contains that element, the browser will *not* include the element with the request. In turn, this would have the effect of not setting that property in your form bean, leading to the types of symptoms you are observing. If your UI wants to selectively disable the ability of the user to change an input field, you should manipulate the readonly property instead. That's because readonly input elements are still included. Craig On Fri, 22 Oct 2004 12:10:42 -0700 (PDT), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello all... I've got a strange situation that's been bugging me for a while. First, some quick background: I wrote an application about two years ago that was based on a proprietary framework that has now been converted to Struts. One of the things this proprietary framework was missing was the concept of ActionForms. Instead, when you hit your controller classes, you dealt with the Request object directly to get your parameters. Since as usual I had to get the conversion done in far less time than it should have been done in, I basically would up not really using ActionForms except to transfer data back to the view. In other words, no validation is don in the ActionForms, and they are not auto-populateed by Struts. My Actions still deal directly with Request, I just populate the ActionForm on the way out to the JSP (I intended to use the ActionForms more properly later, but that time has never presented itself). So, now I come to the issue... It seems that every now and again (average of about 25 times per 50,000 transaction) I get NPE's in my Actions and they are always because some value that was expected to be in Request is null. Now, the front-end does a bunch of validation (JavaScript) and I've gone over it a ton of times and there doesn't seem to be any way a user could submit a form without filling in required elements (and most of them should be blanks anyway, not nulls). I thought about maybe they were using the Back button in some crazy way, but the app opens in a new chromless window, so they would have to be using a keyboard shortcut. I've tried every crazy thing I could think of to break it, but it never seems to break. I have NEVER ONCE replicated one of these problems. So, my question comes down to this... has anyone ever seen a situation where a Struts-based app running on Tomcat (5.0.25 I believe) would lose request data, either as a fault of Struts or of Tomcat? Could it be some Tomcat tuning issue? (I will ask this same question on the Tomcat list, but I wanted to start here first). Any thoughts would be appreciated. Fortunately no one is complaining because the app is generally quite stable, but these once-in-a-while exceptions are pissing me off more than anything else! - 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]
[OT] Re: Request parameters not making it to Actions?
Possibly many of you already have your own approaches for seeing what's actually transmitted over the wire, but if you don't - check out the LiveHTTPHeaders extension to Firefox - I love it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Request parameters not making it to Actions?
That's an interesting thought Craig... I actually was very much aware of that behavior, having been burnt in the past... A lot of my GUI design does in fact disable elements because it's hard to get disabled elements to look exactly like Windows elements do when disabled by just manipulating read-only. My code does take this into account, but it's possible the users are doing some really unexpected thnigs and thereby breaking my code (because, of course, the code isn't ingerently broke! :) ). I considered this possibility a while ago and all but dismissed it, now I think I may go re-visit it a bit... -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Fri, October 22, 2004 3:30 pm, Craig McClanahan said: I don't know if this is happening to you, but one thing to examine your client side JavaScript code for is setting an input element's disabled property. If you ever do this, and then submit the form that contains that element, the browser will *not* include the element with the request. In turn, this would have the effect of not setting that property in your form bean, leading to the types of symptoms you are observing. If your UI wants to selectively disable the ability of the user to change an input field, you should manipulate the readonly property instead. That's because readonly input elements are still included. Craig On Fri, 22 Oct 2004 12:10:42 -0700 (PDT), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello all... I've got a strange situation that's been bugging me for a while. First, some quick background: I wrote an application about two years ago that was based on a proprietary framework that has now been converted to Struts. One of the things this proprietary framework was missing was the concept of ActionForms. Instead, when you hit your controller classes, you dealt with the Request object directly to get your parameters. Since as usual I had to get the conversion done in far less time than it should have been done in, I basically would up not really using ActionForms except to transfer data back to the view. In other words, no validation is don in the ActionForms, and they are not auto-populateed by Struts. My Actions still deal directly with Request, I just populate the ActionForm on the way out to the JSP (I intended to use the ActionForms more properly later, but that time has never presented itself). So, now I come to the issue... It seems that every now and again (average of about 25 times per 50,000 transaction) I get NPE's in my Actions and they are always because some value that was expected to be in Request is null. Now, the front-end does a bunch of validation (JavaScript) and I've gone over it a ton of times and there doesn't seem to be any way a user could submit a form without filling in required elements (and most of them should be blanks anyway, not nulls). I thought about maybe they were using the Back button in some crazy way, but the app opens in a new chromless window, so they would have to be using a keyboard shortcut. I've tried every crazy thing I could think of to break it, but it never seems to break. I have NEVER ONCE replicated one of these problems. So, my question comes down to this... has anyone ever seen a situation where a Struts-based app running on Tomcat (5.0.25 I believe) would lose request data, either as a fault of Struts or of Tomcat? Could it be some Tomcat tuning issue? (I will ask this same question on the Tomcat list, but I wanted to start here first). Any thoughts would be appreciated. Fortunately no one is complaining because the app is generally quite stable, but these once-in-a-while exceptions are pissing me off more than anything else! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Request parameters not making it to Actions?
Thanks for the heads-up Ben! Most of my time is spent in IE though... I use HTTPWatch to do the same thing. The problem though is that I've never once been able to replicate this problem, so it wouldn't help me any. I suppose I could have all my users install HTTPWatch, but that wouldn't go over well with the not technically-inclined masses ;) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Fri, October 22, 2004 3:41 pm, Ben Anderson said: Possibly many of you already have your own approaches for seeing what's actually transmitted over the wire, but if you don't - check out the LiveHTTPHeaders extension to Firefox - I love it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tiles Question
I have found a suspecious behaviour with tiles. If I set the Attribute with an all lower case or all upper case String everything seems to work fine. When I use mixed case with a string like Foo tiles won't import the attribute into the tile, and what is worse, when the tile return, the attribute cann nolonger be found with the mixed case attribute name. Is this a defect? or is mixed case attributes a situation to stay away from. I programatically assign the String, so I have to String.toLowerCase ( ), to make my situation work. If this is a bug, I will submit a report. -Original Message- From: Sean Schofield [mailto:[EMAIL PROTECTED] Sent: Thursday, October 21, 2004 8:22 AM To: Struts Users Mailing List Subject: Re: Tiles Question snip - Root Cause - java.lang.NoSuchMethodError: org.apache.log4j.Category.log(Ljava/lang/String;Lorg/apache/log4j/Level;Ljav a/lang/Object;Ljava/lang/Throwable;)V at org.apache.commons.logging.impl.Log4JCategoryLog.trace(Log4JCategoryLog.java :77) at org.apache.struts.util.PropertyMessageResources.init(PropertyMessageResour ces.java:84) /snip If you look at the RootCause of your application you'll notice something about log4j. I am not an expert on log4j (although I use it just fine.) Check that you are running the latest log4j and commons-logging. I'm assuming you have setup commons-logging to use log4j. Make sure that's all configured properly. I have the following line in my commons_logging.properties file to accomplish this: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategory Log HTH, sean - 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]
MessageResources native to ascii conversion
Hi, I have a struts based application which supports several locales (italian, french, korean etc). There are different .properties files to accomplish this. The respective .properties files of each language were translated recently. When I bring up the app in Korean, it seems like the strings are not displayed correctly. I went thru some web sites and found out that I had to convert the Korean translated file to ascii. I tried to use native2ascii tool shipped with Java1.4.2 and was getting back a sun.io.MalformedException. I used EUC-KR as the encoding. Am I doing something wrong here? When I bring up the GUI in French, it seemed like the strings were being displayed correctly, but I can't tell as I don't speak French. Do I have to do a native2ascii conversion on the French and Italian files too? If yes, what encoding should I use? Help appreciated, Kumar
RE: Request parameters not making it to Actions?
Frank, Do any of your forwards have redirect=true in them and point to a JSP? That would do a browser redirect to make the browser go to a JSP, resulting in lost parameters. Any change of posting part of your struts-config.xml for us to skim over and point anything out that looks unusual? When you get NPE's from missing parameters, do you have other parameters that were submitted but some that are missing? Are you log printing to be able to verify that whenever it does happen, that only some parameters are missing and not just all? Regards, David -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, October 22, 2004 3:17 PM To: [EMAIL PROTECTED] Subject: Re: Request parameters not making it to Actions? I should point out, before anyone calls me on it, that this is strictly an internal app that is IE-specific (as per the overlords of the company's orders). Therefore, there's no chance that user disabled scripting or anything, and indeed they wouldn't have been able to even log in if they had. So, the validations before submission are most definitely firing. I'm convinced they aren't broke, but it's possible they could be... I'm proceeding under the belief that they aren't though and therefore an invalid submission is not being made at any point (unless it's a navigation problem, i.e., back, which is still a possibility) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Fri, October 22, 2004 3:10 pm, [EMAIL PROTECTED] said: Hello all... I've got a strange situation that's been bugging me for a while. First, some quick background: I wrote an application about two years ago that was based on a proprietary framework that has now been converted to Struts. One of the things this proprietary framework was missing was the concept of ActionForms. Instead, when you hit your controller classes, you dealt with the Request object directly to get your parameters. Since as usual I had to get the conversion done in far less time than it should have been done in, I basically would up not really using ActionForms except to transfer data back to the view. In other words, no validation is don in the ActionForms, and they are not auto-populateed by Struts. My Actions still deal directly with Request, I just populate the ActionForm on the way out to the JSP (I intended to use the ActionForms more properly later, but that time has never presented itself). So, now I come to the issue... It seems that every now and again (average of about 25 times per 50,000 transaction) I get NPE's in my Actions and they are always because some value that was expected to be in Request is null. Now, the front-end does a bunch of validation (JavaScript) and I've gone over it a ton of times and there doesn't seem to be any way a user could submit a form without filling in required elements (and most of them should be blanks anyway, not nulls). I thought about maybe they were using the Back button in some crazy way, but the app opens in a new chromless window, so they would have to be using a keyboard shortcut. I've tried every crazy thing I could think of to break it, but it never seems to break. I have NEVER ONCE replicated one of these problems. So, my question comes down to this... has anyone ever seen a situation where a Struts-based app running on Tomcat (5.0.25 I believe) would lose request data, either as a fault of Struts or of Tomcat? Could it be some Tomcat tuning issue? (I will ask this same question on the Tomcat list, but I wanted to start here first). Any thoughts would be appreciated. Fortunately no one is complaining because the app is generally quite stable, but these once-in-a-while exceptions are pissing me off more than anything else! - 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: MessageResources native to ascii conversion
Struts uses java.util.ResourceBundle instances inside it's MessageResources implementation. In particular, the most common mechanism is to implicitly use PropertyResourceBundle instances that take a properties file and turn it into a ResourceBundle. Therefore, you must follow all the rules described in the Javadocs for the java.util.Properties and java.util.PropertyResourceBundle classes with regard to encoding. More information interspersed below, but please check out the Javadocs for these classes. There's also a ton of useful information about internationalizing and localizing Java apps in general in the Internationalization trail of the Java Language Tutorial. Here's the welcome page for it: http://java.sun.com/docs/books/tutorial/i18n/index.html On Fri, 22 Oct 2004 16:15:29 -0600, Kumar V Kadiyala [EMAIL PROTECTED] wrote: Hi, I have a struts based application which supports several locales (italian, french, korean etc). There are different .properties files to accomplish this. The respective .properties files of each language were translated recently. As stated in the Javadocs, a properties file *must* be encoded in ASCII. Therefore, if you edit your source properties file in EUC_KR, you will need to translate it into ascii before packaging the file into your webapp. The simplest way is the native2ascii tool: native2ascii -encoding EUC_KR src/mycompany/mypackage/MyBundle.properties \ build/WEB-INF/classes/mycompany/mypackage/MyBundle.properties As others have pointed out, there's a convenient Ant task for this purpose, if you are using Ant in your build environment. When I bring up the app in Korean, it seems like the strings are not displayed correctly. I went thru some web sites and found out that I had to convert the Korean translated file to ascii. I tried to use native2ascii tool shipped with Java1.4.2 and was getting back a sun.io.MalformedException. I used EUC-KR as the encoding. Am I doing something wrong here? The EUC_KR encoding requires the $JAVA_HOME/lib/charsets.jar to be on the classpath, because it's not built in to the standard runtime. See http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html for more info. When I bring up the GUI in French, it seemed like the strings were being displayed correctly, but I can't tell as I don't speak French. Do I have to do a native2ascii conversion on the French and Italian files too? If you do not happen to use any accented characters, it will work ... but that is pretty unlikely. Therefore, you should be performing the transformation on these files too. If yes, what encoding should I use? Whatever encoding is supported by your editing tools (and by native2ascii) is fine ... I personally recommend UTF-8 for everything, so that I don't have to remember which encoding to use on which file. Help appreciated, Kumar Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Request parameters not making it to Actions?
Hi David, Nope, no redirects anywhere. When the NPE's occur, as near as I can tell, only some of them are missing (which actually makes Craig's suggestion more likely, maybe I missed an error path through the code)... I do dump all the request parameters to the log on every request (don't worry, that's a config parameter that can be turned on and off real-time, I'm not crazy enough to leave it on all the time :) ). Here's my config file... Note that I replaced the name of the application with myapp and the name of the company with mycompany... Not that I think it would have been any big deal to leave them as-is, I figure better safe then sorry when it comes to matters of potential confidentiality violations... Also, keep in mind this is converted from a non-Struts application, so some of what is done here naybe isn't what I'd normally do but was the easiest way to make the conversion happen. ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config global-forwards forward name=reload path=/jsp/reloadSystem.jsp / forward name=exception path=/jsp/exception.jsp / /global-forwards action-mappings !-- ** Web Services *** -- !-- All Web Service requests are targeted to this entry -- action path=/myappWebServices type=com.mycompany.myapp.actions.WebServicesAction / !-- ** Image Server *** -- !-- This is called to server a BLOB from the database -- action path=/app/BLOBServer type=com.mycompany.myapp.actions.BLOBServerAction / !-- ** API *** -- !-- Called to load the API frame at system startup -- action path=/app/loadAPI type=com.mycompany.myapp.actions.APIAction forward name=defaultForward path=/jsp/api.jsp / /action !-- ** Logon *** -- !-- Called from the Logon page when user tried to logon -- action path=/app/logon type=com.mycompany.myapp.actions.LogonAction forward name=logonOK path=/jsp/logonOK.jsp / /action !-- Called to change a user's password -- action path=/app/changePassword type=com.mycompany.myapp.actions.ChangePasswordAction / !-- ** Log off *** -- !-- Called from the Home page to log off the user -- action path=/app/logoff type=com.mycompany.myapp.actions.LogoffAction forward name=defaultForward path=/jsp/logoff.jsp / /action !-- ** Home *** -- !-- Called to show the Home page -- action path=/app/home type=com.mycompany.myapp.actions.HomeAction forward name=defaultForward path=/jsp/home.jsp / /action !-- Called when a new client is selected from the drop-down -- action path=/app/changeClient type=com.mycompany.myapp.actions.ChangeClientAction forward name=defaultForward path=/jsp/home.jsp / /action !-- ** Menu: myapp *** -- !-- -- action path=/app/menumyappCreatemyapp type=com.mycompany.myapp.actions.myappFindAccountAction forward name=defaultForward path=/jsp/myappFindAccount.jsp / /action !-- -- action path=/app/menumyappRecallmyapp type=com.mycompany.myapp.actions.RecallmyappAction forward name=defaultForward path=/jsp/recallmyapp.jsp / /action !-- -- action path=/app/menumyappCalloutReasonQueue type=com.mycompany.myapp.actions.CalloutQueuesAction forward name=defaultForward path=/jsp/calloutQueues.jsp / /action !-- -- action path=/app/menumyappCalloutResponseQueue type=com.mycompany.myapp.actions.CalloutQueuesAction forward name=defaultForward path=/jsp/calloutQueues.jsp / /action !-- -- action path=/app/menumyappCheckProcessing type=com.mycompany.myapp.actions.CPFindmyappAction forward name=defaultForward path=/jsp/cpFindmyapp.jsp / /action !--
RE: Request parameters not making it to Actions?
Frank, Nothing jumps out at me from skimming over that struts config, other than this thought: the new Struts 1.2.4 wildcard mapping might make that config file much more readable. :( Regards, David -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Friday, October 22, 2004 7:35 PM To: Struts Users Mailing List Subject: Re: Request parameters not making it to Actions? Hi David, Nope, no redirects anywhere. When the NPE's occur, as near as I can tell, only some of them are missing (which actually makes Craig's suggestion more likely, maybe I missed an error path through the code)... I do dump all the request parameters to the log on every request (don't worry, that's a config parameter that can be turned on and off real-time, I'm not crazy enough to leave it on all the time :) ). Here's my config file... Note that I replaced the name of the application with myapp and the name of the company with mycompany... Not that I think it would have been any big deal to leave them as-is, I figure better safe then sorry when it comes to matters of potential confidentiality violations... Also, keep in mind this is converted from a non-Struts application, so some of what is done here naybe isn't what I'd normally do but was the easiest way to make the conversion happen. ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config global-forwards forward name=reload path=/jsp/reloadSystem.jsp / forward name=exception path=/jsp/exception.jsp / /global-forwards action-mappings !-- ** Web Services *** -- !-- All Web Service requests are targeted to this entry -- action path=/myappWebServices type=com.mycompany.myapp.actions.WebServicesAction / !-- ** Image Server *** -- !-- This is called to server a BLOB from the database -- action path=/app/BLOBServer type=com.mycompany.myapp.actions.BLOBServerAction / !-- ** API *** -- !-- Called to load the API frame at system startup -- action path=/app/loadAPI type=com.mycompany.myapp.actions.APIAction forward name=defaultForward path=/jsp/api.jsp / /action !-- ** Logon *** -- !-- Called from the Logon page when user tried to logon -- action path=/app/logon type=com.mycompany.myapp.actions.LogonAction forward name=logonOK path=/jsp/logonOK.jsp / /action !-- Called to change a user's password -- action path=/app/changePassword type=com.mycompany.myapp.actions.ChangePasswordAction / !-- ** Log off *** -- !-- Called from the Home page to log off the user -- action path=/app/logoff type=com.mycompany.myapp.actions.LogoffAction forward name=defaultForward path=/jsp/logoff.jsp / /action !-- ** Home *** -- !-- Called to show the Home page -- action path=/app/home type=com.mycompany.myapp.actions.HomeAction forward name=defaultForward path=/jsp/home.jsp / /action !-- Called when a new client is selected from the drop-down -- action path=/app/changeClient type=com.mycompany.myapp.actions.ChangeClientAction forward name=defaultForward path=/jsp/home.jsp / /action !-- ** Menu: myapp *** -- !-- -- action path=/app/menumyappCreatemyapp type=com.mycompany.myapp.actions.myappFindAccountAction forward name=defaultForward path=/jsp/myappFindAccount.jsp / /action !-- -- action path=/app/menumyappRecallmyapp type=com.mycompany.myapp.actions.RecallmyappAction forward name=defaultForward path=/jsp/recallmyapp.jsp / /action !-- -- action path=/app/menumyappCalloutReasonQueue type=com.mycompany.myapp.actions.CalloutQueuesAction forward name=defaultForward path=/jsp/calloutQueues.jsp / /action !-- -- action
[Struts-Chain] how to use another chain for preprocessing?
I'm curious about Struts-Chain and have read through the 1.2.4 source on it plus the 1.3 SVN repository. I don't see anything suggesting how to make my action chain itself to another action in the struts-config.xml example. Nor do I see anything suggesting how to have an action be processed by a chain other than the default chain. Is struts-chain supposed to be as one chain per web.xml pattern matching? Are the chains supposed to do that and use a common struts configuration object? (I.e. Just /do/whatever invokes chain a but mapping /dothis/whatever3 invokes a different chain? Thanks for any help. Regards, David the Curious ([EMAIL PROTECTED]) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Struts-Chain] how to use another chain for preprocessing?
The code that is in the repository now has focused on providing a chain implementation that is fundamentally backwards compatible with existing Struts 1.1/1.2 functionality. As such, it emulates the current RequestProcessor architecture by passng all requests through a single commonly configured pipeline (which can, of course, be customized). Going beyond strict backwards compatibility, there's lots of options: * A chain can already invoke another chain using the generic LookupCommand capability. The other chain's name can be determined either literally (via the name property) or indirectly (via the nameKey property, naming a context property where some other processing logic has stored the name of the chain to be executed). * Given this, it would be trivial, for example, to create a chain equivalent to the standard DispatchAction, which based the name of the chain to run on some request parameter, or other incomding characteristic on the request. In the servlet-standard chain, this technique is used to execute a user-defined preprocess chain if there is one, ignoring it otherwise. * Alternatively, it would be possible to set things up so that the name of the action implicitly selects a correspondingly named chain (if there is one); defaulting to the standard chain if there is nothing special. That way you could customize the processing of individual actions without having to affect all of them. * Regarding chaining of actions themselves, if you are using the standard request processing chain that remains as bad an idea as it has always been in Struts, and I don't see any reason to make it easier with chaining than it is today. Instead, a different approach is likely to be better -- for example, building a chain that forwards to a view named foo could automatically look up a setup chain (specific to that view) and execute it if it's there. This would likely eliminate many occurrences of the setup action -- view -- process action design that you see in lots of Struts code. What a chain does is totally up to who designs the chain. Once you free yourself from a requirement to be backwards compatible (leaving the existing servlet-standard chain there for people that *do* want that), there's a lot of room to innovate. So, the answer to nearly all of yor questions is yes, you can do that if you want to. Craig On Fri, 22 Oct 2004 20:23:28 -0400, David G. Friedman [EMAIL PROTECTED] wrote: I'm curious about Struts-Chain and have read through the 1.2.4 source on it plus the 1.3 SVN repository. I don't see anything suggesting how to make my action chain itself to another action in the struts-config.xml example. Nor do I see anything suggesting how to have an action be processed by a chain other than the default chain. Is struts-chain supposed to be as one chain per web.xml pattern matching? Are the chains supposed to do that and use a common struts configuration object? (I.e. Just /do/whatever invokes chain a but mapping /dothis/whatever3 invokes a different chain? Thanks for any help. Regards, David the Curious ([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: Request parameters not making it to Actions?
I wouldn't doubt it :) Unfortunately, I know the glacial pace we upgrade versions of anything around here... case in point: we're still stuck with JDK 1.3.1. Argh! I think the chances of migrating to Struts beyond 1.1 is virtually nil. Is it really that bad to read though?? It's verbose, but I don't find it particuarly bad to read :) David G. Friedman wrote: Frank, Nothing jumps out at me from skimming over that struts config, other than this thought: the new Struts 1.2.4 wildcard mapping might make that config file much more readable. :( Regards, David -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Friday, October 22, 2004 7:35 PM To: Struts Users Mailing List Subject: Re: Request parameters not making it to Actions? Hi David, Nope, no redirects anywhere. When the NPE's occur, as near as I can tell, only some of them are missing (which actually makes Craig's suggestion more likely, maybe I missed an error path through the code)... I do dump all the request parameters to the log on every request (don't worry, that's a config parameter that can be turned on and off real-time, I'm not crazy enough to leave it on all the time :) ). Here's my config file... Note that I replaced the name of the application with myapp and the name of the company with mycompany... Not that I think it would have been any big deal to leave them as-is, I figure better safe then sorry when it comes to matters of potential confidentiality violations... Also, keep in mind this is converted from a non-Struts application, so some of what is done here naybe isn't what I'd normally do but was the easiest way to make the conversion happen. ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config global-forwards forward name=reload path=/jsp/reloadSystem.jsp / forward name=exception path=/jsp/exception.jsp / /global-forwards action-mappings !-- ** Web Services *** -- !-- All Web Service requests are targeted to this entry -- action path=/myappWebServices type=com.mycompany.myapp.actions.WebServicesAction / !-- ** Image Server *** -- !-- This is called to server a BLOB from the database -- action path=/app/BLOBServer type=com.mycompany.myapp.actions.BLOBServerAction / !-- ** API *** -- !-- Called to load the API frame at system startup -- action path=/app/loadAPI type=com.mycompany.myapp.actions.APIAction forward name=defaultForward path=/jsp/api.jsp / /action !-- ** Logon *** -- !-- Called from the Logon page when user tried to logon -- action path=/app/logon type=com.mycompany.myapp.actions.LogonAction forward name=logonOK path=/jsp/logonOK.jsp / /action !-- Called to change a user's password -- action path=/app/changePassword type=com.mycompany.myapp.actions.ChangePasswordAction / !-- ** Log off *** -- !-- Called from the Home page to log off the user -- action path=/app/logoff type=com.mycompany.myapp.actions.LogoffAction forward name=defaultForward path=/jsp/logoff.jsp / /action !-- ** Home *** -- !-- Called to show the Home page -- action path=/app/home type=com.mycompany.myapp.actions.HomeAction forward name=defaultForward path=/jsp/home.jsp / /action !-- Called when a new client is selected from the drop-down -- action path=/app/changeClient type=com.mycompany.myapp.actions.ChangeClientAction forward name=defaultForward path=/jsp/home.jsp / /action !-- ** Menu: myapp *** -- !-- -- action path=/app/menumyappCreatemyapp type=com.mycompany.myapp.actions.myappFindAccountAction forward name=defaultForward path=/jsp/myappFindAccount.jsp / /action !-- -- action path=/app/menumyappRecallmyapp
RE: [Struts-Chain] how to use another chain for preprocessing?
Craig, I just don't (yet) see how or where you can set an action override. Am I supposed to add a chain called servlet-complete-preprocess and put my own code in to figure out what action is being invoked and somehow which chain I want to call next? I guess I was expecting something in the struts-config.xml via a set-property or something that easy to suggest where or how to chain it. I suppose this means I need more reading. Can you suggest any links? Regards, David -Original Message- From: Craig McClanahan [mailto:[EMAIL PROTECTED] Sent: Friday, October 22, 2004 9:39 PM To: Struts Users Mailing List Subject: Re: [Struts-Chain] how to use another chain for preprocessing? The code that is in the repository now has focused on providing a chain implementation that is fundamentally backwards compatible with existing Struts 1.1/1.2 functionality. As such, it emulates the current RequestProcessor architecture by passng all requests through a single commonly configured pipeline (which can, of course, be customized). Going beyond strict backwards compatibility, there's lots of options: * A chain can already invoke another chain using the generic LookupCommand capability. The other chain's name can be determined either literally (via the name property) or indirectly (via the nameKey property, naming a context property where some other processing logic has stored the name of the chain to be executed). * Given this, it would be trivial, for example, to create a chain equivalent to the standard DispatchAction, which based the name of the chain to run on some request parameter, or other incomding characteristic on the request. In the servlet-standard chain, this technique is used to execute a user-defined preprocess chain if there is one, ignoring it otherwise. * Alternatively, it would be possible to set things up so that the name of the action implicitly selects a correspondingly named chain (if there is one); defaulting to the standard chain if there is nothing special. That way you could customize the processing of individual actions without having to affect all of them. * Regarding chaining of actions themselves, if you are using the standard request processing chain that remains as bad an idea as it has always been in Struts, and I don't see any reason to make it easier with chaining than it is today. Instead, a different approach is likely to be better -- for example, building a chain that forwards to a view named foo could automatically look up a setup chain (specific to that view) and execute it if it's there. This would likely eliminate many occurrences of the setup action -- view -- process action design that you see in lots of Struts code. What a chain does is totally up to who designs the chain. Once you free yourself from a requirement to be backwards compatible (leaving the existing servlet-standard chain there for people that *do* want that), there's a lot of room to innovate. So, the answer to nearly all of yor questions is yes, you can do that if you want to. Craig On Fri, 22 Oct 2004 20:23:28 -0400, David G. Friedman [EMAIL PROTECTED] wrote: I'm curious about Struts-Chain and have read through the 1.2.4 source on it plus the 1.3 SVN repository. I don't see anything suggesting how to make my action chain itself to another action in the struts-config.xml example. Nor do I see anything suggesting how to have an action be processed by a chain other than the default chain. Is struts-chain supposed to be as one chain per web.xml pattern matching? Are the chains supposed to do that and use a common struts configuration object? (I.e. Just /do/whatever invokes chain a but mapping /dothis/whatever3 invokes a different chain? Thanks for any help. Regards, David the Curious ([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]
How can I set values to message parameters by using bean:message tag?
Hi all, I am wondering if there is a way to set values to message paramerts by using bean:message, for example, I have a message entry in my application.properties file like this:Welcome, {0} And in my JSP file, I'd like to render this message as Welcome,Some Onewhich Some One is fetched from the UserBean in my session scope. I am wondering if the tag bean:message can do this, or is there another way? Thanks a lot! Best wishes! Yufan Shi We are Online! http://www.ivanshi.com/