Newbie question about Tiles suitability.
Hi, I just got told I have to create a web site similar to myYahoo where the user can customize what they want to view on the screen. You know the type, where you can pick and choose from a number of categories and a page is custom created for you. Is this a job for the Tiles framework? Thanks for any help. Regards, Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How to use the html:text tag properly.
Hi, I am trying to get the value attribute to work in the text tag. I have an 'ITEM' bean with two properties. One is set up when the user selects an item. When they go to a page I want the page to display the existing value in 'item.primeLocation' and I want the text box to be prefilled with the value from 'item.primeLocation' but have the text user input go into 'newPrimeLocation. Both parameters are within the ITEM bean. I think the value attribute is supposed to get the from the 'primeLocation' but I actually get primeLocation passed into the text box. I must be doing something wrong. TR TDPrimary Location/TD TDbean:write name=ITEM property=item.primeLocation//TD TDhtml:text property=newPrimeLocation value=primeLocation/TD /TR Thanks for any help. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How to fill a String[] property?
Hi, I have a form with a string array property 'Activities'. The form has the following methods: private String[] mActivities = new String[6]; public void setActivities(String[] parm1) { mActivities = parm1; } public String[] getActivities() { return mActivities; } On my page I need 6 textboxes to be filled in each representing an element in the mActivities array. I have tried the following: tdhtml:text property=item.issue.chargeInfo.activities[0] //td ... tdhtml:text property=item.issue.chargeInfo.activities[5] //td but I get bean.populate errors. Any help is appreciated. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How to fill a String[] property-updated question.?
Hi, just an update. Before I access the page I initialized the String[] array elements to 1...6. When I get to the page the values in the String[] array are properly displayed in the corresponding text boxes but when I submit the page I get the following error: java.lang.IllegalArgumentException: array element type mismatch at org.apache.struts.util.PropertyUtils.setIndexedProperty(PropertyUtils.java:8 51) at org.apache.struts.util.PropertyUtils.setIndexedProperty(PropertyUtils.java:7 85) I don't understand why I can view the elements but not save the elements. Thanks for any info. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How to use the value attribute in html:text
Hi, I am trying to get the value attribute to work in the text tag. I have an 'ITEM' bean with two properties. One is set up when the user selects an item. When they go to a page I want the page to display the existing value in 'item.primeLocation' and I want the text box to be prefilled with the value from 'item.primeLocation' but have the text user input go into 'newPrimeLocation. Both parameters are within the ITEM bean. I think the value attribute is supposed to get the from the 'primeLocation' but I actually get primeLocation passed into the text box. I must be doing something wrong. TR TDPrimary Location/TD TDbean:write name=ITEM property=item.primeLocation//TD TDhtml:text property=newPrimeLocation value=primeLocation/TD /TR Thanks for any help. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How to set attribute via submit
Hi, I have a form with a couple of buttons. The form is submitted to a navigation action class that just looks at an action parameters and forwards the request. I want created a series of submit buttons with the same property but different values. If I set the value property of the tag then that is displayed as the text of the button. What I need to do is set the property and value of the button with a different String for the text displayed on the button. Any ideas? Thanks Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to track the row id......
Hi, I just finished doing something similar. I have an ArrayList with a bunch of charging objects. When the user goes to the summary screen I iterate through all the objects and show them the data. I have added two icons, edit and delete at the end of each charging row. Each of these icons is a link e.g.: html:link page=/editCharging.do indexed=true When the user clicks on the edit icon my editChargingAction is called with a request parameter of 'indexed'. This holds the element in the ArrayList that the user wants to edit. I take that index, get the details for that charge, put that object into request session and send them back to the same page. I have a form on that page that looks for that object and shows the details. Is this making any sense? Is this what you were looking for? Alex -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: February 15, 2002 12:35 AM To: [EMAIL PROTECTED] Subject: How to track the row id.. In a particular scenario im populating my form using logic:iterate with data fetched based on a query the user may edit or view the same(for each row) lets say im populating my order form with line item enrty and the user wants to edit or view each line item Now how can one generate and track the row ids...do we have any tags or attribues for any tag to do the same. If a tag attribute is doing the same then how can one get the index value generated. I have tried using html:link page=/editdetails.do?action=Edit paramId = % = index1 % bean:message key=edit.lineitems/ /html:link inside the logic:iterate tag is paramId generating an index value if so how do i track/fetch it and at the same time if we use indexed then what should be the value of indexed attribute do we have a clear cut solution for this scenarion...any links or resources -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: A good database pool?
Hi, is this part of the expresso package. IE do I download the whole expresso package or is this a separate add on that can be used without expresso. I went to the site and all I can find is the whole package. Thanks Alex -Original Message- From: Sandra Cann [mailto:[EMAIL PROTECTED]] Sent: February 13, 2002 12:02 AM To: Struts Users Mailing List Subject: RE: A good database pool? Suggest you try the Expresso Connection pooling at www.jcorporate.com as it is supported. Btw it is also open source. -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 4:58 PM To: Struts Subject: A good database pool? Hi, I have a couple of struts apps that use a lot of database connections. I have been moving them over to use a connection pool manager. I have found a couple of free ones e.g.. Poolman, jdbcpool but neither are being supported. Can someone suggest another database pool manger. I don't care if I have to pay for it I just want to make sure that it works and that there will be continued development on it. Thanks Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Screen Flow based on UserAgent in Struts
Hi, I like the below setup. I have always had the problem of modifying my apps to work with different devices. Half the time my apps are working with hand held devices, the other half with desktop browsers. Alex -Original Message- From: David M. Karr [mailto:[EMAIL PROTECTED]] Sent: February 11, 2002 1:50 PM To: [EMAIL PROTECTED] Subject: Re: Screen Flow based on UserAgent in Struts Sam == Sam Cheung [EMAIL PROTECTED] writes: Sam Hi, Sam Is there a way to config Struts to forward a different Sam jsp based on the User Agent of the HTTP Request? I Sam would like to use the User Agent to identify the Sam client type (e.g. where desktop or a mobile phone) and Sam send out either HTML content or WML content. Sam I come up this idea, I am wondering if there are Sam better solutions: Sam Have a different forward name, different path for each Sam device type: Sam For example, in struts-config.xml Sam actionpath=/logoff Sam type=org.apache.struts.webapp.example.LogoffAction Sam forward name=successHTML Sam path=/indexHTML.jsp/ Sam forward name=successWML Sam path=/indexWML.jsp/ Sam /action Sam And in the perform method of my action code, I have Sam something like: Sam if user agent is desktop Samreturn (mapping.findForward(successHTML)); Sam else Sam return ((mapping.findForward(successWML)); I wonder whether it would be useful to have something like this (feel free to imagine better naming API conventions): action path=... name=... type=... forward-group name=success choice match=.*mozilla.* path=/thing.html / choice match=.*kbrowser.* path=/thing.wml / /forward-group /action Then, the mapping.findForward() method would be overloaded with one that takes a match string. The match attribute in the choice element is a regular expression, which matches against the parameter. In this case, the parameter value you would provide would be the User-Agent header. This would allow view selection to be abstracted out of the Action class. Any view could be updated to get an alternate rendering, without changing the Action code. The caveat being that you'd have to agree on what always provides the match expression in each Action. The User-Agent is a good choice, but other applications might use something else. -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
A good database pool?
Hi, I have a couple of struts apps that use a lot of database connections. I have been moving them over to use a connection pool manager. I have found a couple of free ones e.g.. Poolman, jdbcpool but neither are being supported. Can someone suggest another database pool manger. I don't care if I have to pay for it I just want to make sure that it works and that there will be continued development on it. Thanks Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to specify scope of bean for html:options tag.
Thanks for the help. Luckily the search method is the way I need it. Alex -Original Message- From: Arnaud Buisine [mailto:[EMAIL PROTECTED]] Sent: January 23, 2002 10:56 AM To: Struts Users Mailing List Subject: RE: How to specify scope of bean for html:options tag. Tell me if I'm wrong, but it seems to me that the findAttribute(String) method from class javax.servlet.jsp.PageContext is used by Struts tags. This method searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null (cf. J2EE API Documentation). Hope it helps. -Message d'origine- De : Stephen Owens [mailto:[EMAIL PROTECTED]] Envoyé : mercredi 23 janvier 2002 16:44 À : Struts Users Mailing List Objet : RE: How to specify scope of bean for html:options tag. Alex, I believe there is a defined search order used to find the beans, and I think by default it would do what you want. So you may have to do exactly nothing to have this work the way you want. regards, Stephen Owens Corner Software -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 23, 2002 10:44 AM To: Struts Subject: How to specify scope of bean for html:options tag. Hi, I have two beans in request and session scope under the same name. I have to create a drop down using the html:options tag. If the bean under the request scope is found then I want to use that one for the options tag, if it is not then I want to use the one under the session tag. I can't seem to find a way to differentiate the two bean via the options tag. Any help is appreciated. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to specify scope of bean for html:options tag.
Thanks for the help. Luckily the search method is the way I need it. Alex -Original Message- From: Arnaud Buisine [mailto:[EMAIL PROTECTED]] Sent: January 23, 2002 10:56 AM To: Struts Users Mailing List Subject: RE: How to specify scope of bean for html:options tag. Tell me if I'm wrong, but it seems to me that the findAttribute(String) method from class javax.servlet.jsp.PageContext is used by Struts tags. This method searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null (cf. J2EE API Documentation). Hope it helps. -Message d'origine- De : Stephen Owens [mailto:[EMAIL PROTECTED]] Envoyé : mercredi 23 janvier 2002 16:44 À : Struts Users Mailing List Objet : RE: How to specify scope of bean for html:options tag. Alex, I believe there is a defined search order used to find the beans, and I think by default it would do what you want. So you may have to do exactly nothing to have this work the way you want. regards, Stephen Owens Corner Software -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 23, 2002 10:44 AM To: Struts Subject: How to specify scope of bean for html:options tag. Hi, I have two beans in request and session scope under the same name. I have to create a drop down using the html:options tag. If the bean under the request scope is found then I want to use that one for the options tag, if it is not then I want to use the one under the session tag. I can't seem to find a way to differentiate the two bean via the options tag. Any help is appreciated. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Why ActionMessages not part of Struts 1.0.1?
Thanks for the info. I think it is a great feature. Alex -Original Message- From: David Winterfeldt [mailto:[EMAIL PROTECTED]] Sent: January 17, 2002 7:34 PM To: Struts Users Mailing List Subject: Re: Why ActionMessages not part of Struts 1.0.1? Only bug fixes have gone into Struts 1.0.1. Adding the ActionMessages would be a feature. Plans are in the works for having a Struts 1.1 release which would be based off the nightly builds (no date set yet, but should happen relatively soon). David --- Alex Colic [EMAIL PROTECTED] wrote: Hi, I have been using the ActionMessages class for a while. For the last 6? months they have been part of the nightly build. I just downloaded the latest version of Struts and none of my code compiled. It looks like ActionMessages is still in the nightly code? Why? It's pretty stable. Never had a problem with it. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to use Log4j with a startup logging servlet
Hi, I have used option two. The code for my servlet is below. It works for me. If you have any suggestions, enhancements please send me a note. Alex package com.sirius.struts.action; import javax.servlet.*; import javax.servlet.http.*; import org.apache.log4j.*; public class genericLog4JServlet extends HttpServlet { private static final Category cat=Category.getInstance(genericLog4JServlet.class.getName()); public void init() throws javax.servlet.ServletException { ServletContext context=getServletContext(); /** * Get the Log4J settings and the logging paramters */ try { String strLogSetting =(String)this.getInitParameter(Log4JFileSetting); PropertyConfigurator.configure(context.getResource(strLogSetting)); } catch(java.net.MalformedURLException e){e.printStackTrace();} } } -Original Message- From: Eric Ma [mailto:[EMAIL PROTECTED]] Sent: January 15, 2002 12:33 PM To: [EMAIL PROTECTED] Subject: How to use Log4j with a startup logging servlet I want to use Log4J for logging exceptions thrown in a Struts-based web app. After searching through this list, I found 2 common solutions: 1. Extend the Struts ActionServlet and override the init() method to set up a Log4J Category. Then in any custom Action class I can just call servlet.Category.debug() (let's assume Category is a protected or public variable). 2. Write a separate startup servlet and again set up LOG4J in the init() method. But my question is, how do I invoke this servlet from my custom Action class? Do I need to do a RequestDispatcher.forward() to the servlet when an exception is thrown? Then how do I get back to the page I am on to display the error message? Eric Ma -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Struts design advice requested please.
Hi, I have been using Struts now for about a year and I really like it. It has saved me a lot of time and made my apps quite stable. I have just been placed on another large struts project. It will be pushing struts to the limit. A quick question on design. What I am going to do is a bit difficult to explain. This app is going to be used by users to input inventory data into two different databases, an AS400 and an Oracle/SQL database. The user will enter essentially the same type of inventory data into each system, but, there are differences between the two. Part of the project plan is that through a config switch, parameter etc, I will be telling struts if we are working with an AS400 system or an Oracle/SQL system and then the guy will slightly change, just the addition or deletion of a gui element. Example of required elements entered by the users in a form. AS400 ORACLE/SQL employeeID employeeID storeroom storeroom locationlocation location type bin Number My question revolves around the form bean. I though about making a form bean that includes all the properties that are required by the Inventory object for the AS400 and the ORACLE/SQL system. This would make one large generic form bean. Then I thought about making an abstract class that includes all the common elements amongst the object and from there I would extend and create an AS400 inventory form or an Oracle/SQL inventory form. If I go this way then how do I set up the Struts.xml file to use the specific inventory form, if it could be one of two? I hope what I am trying to convey is making sense. Depending on a config setting I think I should be using one of two form beans, not known until run time. Any help in setting up the above is appreciated. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Struts design advice requested please.
Thanks a lot I really appreciate all the advice. It really helped me out. One thing you said really surprised me. You said: For ActionForms, my preference is to use larger generic form beans. They are really a throw-away object, and linking them too closely to a hierarchy can be a waste of time. I have been doing the opposite of generic forms. My forms usually consist of objects within object. For example I might have an invoice object that has and employee and a part object within it. It would have been faster for me to make on big flat form but I thought that it would be better to break it up amongst a number of objects. Looking back though, most of my forms all they do is collect data that is used somewhere else. Something for me to think about. Thanks Alex -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: January 10, 2002 12:42 PM To: Struts Users Mailing List Subject: Re: Struts design advice requested please. Alex Colic wrote: I have been using Struts now for about a year and I really like it. It has saved me a lot of time and made my apps quite stable. I have just been placed on another large struts project. It will be pushing struts to the limit. A quick question on design. What I am going to do is a bit difficult to explain. This app is going to be used by users to input inventory data into two different databases, an AS400 and an Oracle/SQL database. The user will enter essentially the same type of inventory data into each system, but, there are differences between the two. Part of the project plan is that through a config switch, parameter etc, I will be telling struts if we are working with an AS400 system or an Oracle/SQL system and then the guy will slightly change, just the addition or deletion of a gui element. I would consider extending the ActionServlet so that it stores which schema is in use. The Action could then look at the schema setting to route or otherwise handle the request as needed. Ideally, the Action should be able to just pass the schema setting back to the business logic, without knowing anything about the schema itself, except that it is some fact the business layer needs to know. I though about making a form bean that includes all the properties that are required by the Inventory object for the AS400 and the ORACLE/SQL system. This would make one large generic form bean. Then I thought about making an abstract class that includes all the common elements amongst the object and from there I would extend and create an AS400 inventory form or an Oracle/SQL inventory form. This is always a tricky question when dealing with persistence layer issues. Scott Ambler's paper http://www.ambysoft.com/mappingObjects.pdf discusses this in depth. For ActionForms, my preference is to use larger generic form beans. They are really a throw-away object, and linking them too closely to a hierarchy can be a waste of time. The business logic beans that form the real peristence layer are another matter (see Ambler). But ActionForms are really just an expediency. If I go this way then how do I set up the Struts.xml file to use the specific inventory form, if it could be one of two? If you use subclassing, then you would have an ActionMapping for each ActionForm subclass, which may or may not use the same Action class. If you use one big bean, then they can all use the same Action, and it can sort out which fields are being used for the active scheme. In either case, you can use a separate page for each schema1 type, and let the controller route to one or the other, or pass the schema type to the page and let it use the logic tags to render the appropriate form. The latter reduces the number of pages that need to be maintained, but makes for larger pages. The former creates more individual pages, and seems like better MVC to some folk. It's really a six-of-one half-a-dozen of the other issue, and may be best left up to whomever has to maintain the presentation pages. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Building Java web applications with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Example of using Jmeter with Struts
Hi, after looking at it I can see that for simple tests its not big deal but I am tying to get it to work with a series of forms. You know the type, user logs in, selects something on a form, selects something on another form and then logs out. In my web apps I use the session to store user data. How can I set up JMeter to go through the above and pass the session ID properly. Any help is appreciated. Alex -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: January 8, 2002 6:01 AM To: Struts Users Mailing List Subject: Re: Example of using Jmeter with Struts For simple tests, tt isn't hard to use by hand. I've run copies in several different sessions (e.g. DOS boxes), and set each up interactively to simulate different types of users hitting the site in different ways. The best thing might be jump in poke around in the GUI for a bit (and then read the docs). Alex Colic wrote: Hi, does anyone have an example of using jmeter to stress test a struts app? I have downloaded the jmeter files and I am going over the docs but it looks pretty complicated. Any examples would be appreciated. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Ted Husted, Husted dot Com, Fairport NY USA. -- Building Java web applications with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Example of using Jmeter with Struts
Hi, does anyone have an example of using jmeter to stress test a struts app? I have downloaded the jmeter files and I am going over the docs but it looks pretty complicated. Any examples would be appreciated. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Another questions about checkboxes
Hi, I have a form that has a Boolean property that in the form reset method is reset to false. This form is used over two pages. In the first page there is a checkbox that the user can select to modify this Boolean property. This page is submitted to an action class that just forwards to the second page. In the second page I display the checkbox value. After the second page the form is submitted to another action to process. The problem. In the first page the checkbox works correctly. In the second page, which is a summary page of selections on the first page, the form values are shown correctly. When the second page gets submitted to the last action class, the checkbox is reset to false and that is the value that the action class gets. I know that the second page, even though it only displays the values shown in the first page, is calling the reset method of the form. I need the reset method to set the Boolean to false because the user might go back a page and uncheck the checkbox. Does anyone have any experience of using checkboxes when the form goes over multiple pages? Any ideas on how I can fix this. Thanks a lot of any help. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How to chain actions?
Hi, I have an action class that does one thing. I have another action class that does another thing. How can I have a page that populates a form and submits to one action class and then pass off the form to another action class for further work? Thanks Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How to return to the page that called the action class?
Hi, I have a generic action class that I want to set up that when the class is successful it send the user back to the page from which they came. How do I get that information? And, how would I structure my class to allow it to send the user back? Thanks for any info. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Can't forward to a global-Here's the code in question?
Here the action class, slightly abbreviated. package com.popware.rd.viPro.action; public class viInvoiceSummaryAction extends Action { private static final Category cat=Category.getInstance(viInvoiceSummaryAction.class.getName()); private HttpSession session; private ActionErrors errors=new ActionErrors(); private ActionMessages messages=new ActionMessages(); public ActionForward perform( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { errors.clear(); messages.clear(); session=request.getSession(); if(session == null || session.isNew()) return (mapping.findForward(logon)); Vector v=new Vector(); v=getInvoiceSummary(); if(messages.empty()) { if((v.size()0) (v!=null)) { request.setAttribute(invoiceSummary,v); } } if(!errors.empty()) { this.saveErrors(request,errors); return (new ActionForward(mapping.getInput())); } if(mapping.getAttribute()!=null) if(request.equals(mapping.getScope())) { request.removeAttribute(mapping.getAttribute()); } return (mapping.findForward(success)); } } I can see the logon page loading and then the rest of this classes code gets executed. Thanks for any help. Alex -Original Message- From: Tom Klaasen (TeleRelay) [mailto:[EMAIL PROTECTED]] Sent: Friday, December 07, 2001 4:30 AM To: Struts Users Mailing List Subject: RE: Can't forward to a global? -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: donderdag 6 december 2001 22:06 To: Struts Subject: Can't forward to a global? Hi, I have an action class that could get called after a users session has expired. When the action class is called I have the following code: if(session == null || session.isNew()) { return mapping.findForward(logon); } I have a global forward defined for logon. Now the problem: When a user's session is expired and the click a link they go to this action. The if statement evaluates to true and the forward to logon correctly occurs. Then the rest of the Action code continues to be evaluated. Why is the rest of my code following the above if statement continuing to be run when I have done a forward? Are you absolutely sure about this? No other people on your server who could generate the same debug code as you? Because I don't expect the code to continue: the return ...; statement jumps out of the method. hth, tomK -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Can a form submit to a vector?
Hi, your right that's what I want to do. I just have to figure out how to submit the form to a vector. Alex -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 05, 2001 4:11 PM To: Struts Users Mailing List Subject: RE: Can a form submit to a vector? Hey Alex, Not sure if I understand your setup. If I were doing this, I would just have the iterate at the top of the page, and a form at the bottom. When the form is submitted, the action adds the entry to the vector used in the top of the page, and goes back to the same page. Am I misunderstanding something? Cheers, Dave Alex Colic [EMAIL PROTECTED] on 12/04/2001 08:19:25 AM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To: Struts [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: RE: Can a form submit to a vector? Yes, I want a form when submitted to add a new object to the vector. IE: I have a class with a getCharging method that returns a vector. The vector holds charging objects. In the top half of the page I iterate through the vector and show a table of existing objects. In the bottom half of the page I want to create a form that when submitted adds another object to the vector. Thanks for any help. Alex -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 1:01 PM To: Struts Users Mailing List Subject: Re: Can a form submit to a vector? Do you mean dynamically? ie another row added to the vector above it without a submit? Dave Alex Colic [EMAIL PROTECTED] on 12/03/2001 12:40:57 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To: Struts [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: Can a form submit to a vector? Hi, I have a vector that holds charging objects. The object has properties such as name and amount. On a page, at the top I iterate through the charging objects and create a summary table. The table shows all the charging objects in the charging vector and outputs their name and amount. At the bottom of the page I want to create a form that the user can use to enter the name and amount details for another charging object, hit submit and have a new charging object added to the vector. Can this be done? Thanks a lot. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Can't forward to a global?
Hi, I have an action class that could get called after a users session has expired. When the action class is called I have the following code: if(session == null || session.isNew()) { return mapping.findForward(logon); } I have a global forward defined for logon. Now the problem: When a user's session is expired and the click a link they go to this action. The if statement evaluates to true and the forward to logon correctly occurs. Then the rest of the Action code continues to be evaluated. Why is the rest of my code following the above if statement continuing to be run when I have done a forward? Any help is appreciated. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Can a form submit to a vector?
Yes, I want a form when submitted to add a new object to the vector. IE: I have a class with a getCharging method that returns a vector. The vector holds charging objects. In the top half of the page I iterate through the vector and show a table of existing objects. In the bottom half of the page I want to create a form that when submitted adds another object to the vector. Thanks for any help. Alex -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 1:01 PM To: Struts Users Mailing List Subject: Re: Can a form submit to a vector? Do you mean dynamically? ie another row added to the vector above it without a submit? Dave Alex Colic [EMAIL PROTECTED] on 12/03/2001 12:40:57 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To: Struts [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: Can a form submit to a vector? Hi, I have a vector that holds charging objects. The object has properties such as name and amount. On a page, at the top I iterate through the charging objects and create a summary table. The table shows all the charging objects in the charging vector and outputs their name and amount. At the bottom of the page I want to create a form that the user can use to enter the name and amount details for another charging object, hit submit and have a new charging object added to the vector. Can this be done? Thanks a lot. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Why does my org.apache.struts.action.ActionServlet start twice?
Hi, I have a web app that is using org.apache.struts.action.ActionServlet. When I start the app in JBuilder 4 Ent along with Tomcat 3 The actionServlet loads twice. Any ideas why? Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Can a form submit to a vector?
Hi, I have a vector that holds charging objects. The object has properties such as name and amount. On a page, at the top I iterate through the charging objects and create a summary table. The table shows all the charging objects in the charging vector and outputs their name and amount. At the bottom of the page I want to create a form that the user can use to enter the name and amount details for another charging object, hit submit and have a new charging object added to the vector. Can this be done? Thanks a lot. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
how does this checkbox thing work-Thanks.
Thanks for the help. I got it working. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Help, can I do this..two fields one property.
Help, I have a page that is dynamically created. One of the fields is a date field. I have a javascript calendar that allows the user to input the date into that field. Now I have been told that they also need to select the time. I need to create a select box with values of (12am-11pm) and have the select value appended to the end of the date input box on submit. Any ideas on how to get around this predicament. Thanks for any info. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
how does this checkbox thing work?
Hi, can't seem to get this checkbox to work. I have an app that reads the fields of a database and creates an array of field objects. Then a jsp is produced allowing the user to input the new data. I have a checkbox that is tied to a field object that has a setValue(String) and getValue() method. When I read the database and the checkbox should be set I set the value to 1. This seems to have worked but when the screen is produced and the checkbox is checked and I uncheck it I find that the setValue() method is not being called and that the old value of 1 is being set. Any help is appreciated in understanding how to fix this. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Help!!Banging my head trying to figure out how to do this.
Hi, thanks all for the reply. I am going to have a look at those nesting tags. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Help!!Banging my head trying to figure out how to do this.
Help, I can't figure out how to structure this. I am trying to make a dynamic program that updates fields in a table. Essentially the program should work as follows: A user logs in. I get a list of objects that they can modify. For each object I get a list of tables. For each table I populated a vector of Field objects. All this goes into two Maps. The first map is(Object, Tables) the second map is (tableName, tableDefinition) with the tableDefinition object having a vector of fields. Hopefully this is not too confusing at this point. I use an iterate tag to iterate through the nested maps to dynamically create a nav bar of: object 2 | table name table name object 2 | table name table name Now the fun part. I can select a table and iterate through the tables fields and create a debug html table listing field name, field caption, field type, field default value. Now I need to create a form created from these fields. And the form when submitted need to populate the fields default value? First question: How does a form populate a field that is within a ArrayList that is within a map that is within another map? How can I create the input fields at run time? Any help is really appreciated. Thanks Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
getting indexed variable during scripting.
Hi, I have a logic:indexed loop that has a couple of html elements that use the indexed property. I need to get the current iteration and use that variable in a JavaScript statement. Specifically I have a text box that has a JavaScript calendar that when selected allows a user to select a date. When the user has selected the date the JavaScript function needs to know the name of the text box to place the values. A code snippet of the resulting source is as follows: TDinput type=text name=field[6].fieldDefaultValue value= readonly=readonly/TD tda href=javascript:show_calendar('addOnForm.a250171_dttm',null, null, 'DD/MON/'); I need to replace the a250171_dttm with the field[6].fieldDefaultValue dynamically. Thanks for any info. Alex -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to pass initialise parameters to action class
Thanks for all the info. I guess in my action class I will have to create an empty constructor that initialises that value. Alex
Comment on using the Struts platform for this project.
Hi, I have to create a app that allows users to change/input data into a database. Sounds simple. Problem is I have to make it dynamic so that is will work with any database or table. I have a back end VB app that will send me: Field name Field caption Field type Field display type e.g.. radio, drop down, text box etc. I then need to dynamically create a form with form elements. Is Struts suited for this or should I stick with a plain servlet? Alex
How to pass initialise parameters to action class
Hi, I have an action class that has a variable that I want set from the web.xml file. To prevent the action class from reading the xml file everytime it is accessed I wanted to set the variable once in the action classes init() method. After looking at the action class I see that there is no init() method. Any idea how I can set the value of a variable only once in the action class? Regards Alex
Thanks to all that have helped me.
Big thanks to all who have been helping me learn Struts. It's good to know that people on this list are willing to help each other. Alex
How to do this type of validation?
Hi, could someone give me some architecture hints on how to do the following: Lets say you have a business object that has a couple of mandatory and optional fields populated by the user. The user goes from page to page, each time inputting either a required piece of info or an optional piece of info. I need to create a web GUI to allow an administrator to specify which optional fields for their site are mandatory. When the user goes through each page he must populate the mandatory and any optional fields made mandatory. My first idea was to create an xml document that consisted of the business field name and then a true/false flag. The web page would allow the user to set the optional fields as required or not. Then I thought I could feed this document to my business object and set boolean fields to required or not. Then the question is how do I force a user to input a piece of info when they visit a mandatory page? An example of my proposed code is: private int stockNumber; //optional field private boolean bStockNumberRequired=false; //flag to specify if this field is now required public void setStockNumber(int i); public int getStockNumber(); public void isStockNumberRequired(boolean is) public boolean getStockNumberRequired(); Any thoughts are appreciated. Alex
Need Iterator/Indexed help quick, please.
Hi, I have gotten myself into a bit of a jam and I am wondering if someone could help me out. I got a web app that a customer wants to make some last minute changes to. From the looks of it, it looks simple but I can't figure it out. Hopefully someone has an idea on how I can do this. I have a vector, that holds a CategoryList object, that holds a vector of Category Objects. Each one of these objects has the usual set/get methods: CategoryList Object set/get CategoryList Vector add Category List adds a Category to the above Vector getCategory(int i) returns the Category at that element for the above Vector. Category Object set/get categoryGroup (String) set/get categoryValue (String) ***I think this is what I need populated*** set/get categoryValues (Vector) of Strings There can be an unknown number of category objects in the CategoryList Object. On my page I want to create a series of Select dropdowns with the categoryValues of each Category Object. I have managed to do this via: TABLE logic:iterate id=category name=CategoryList property=categoryList scope=session TR TD bean:write name=category property=categoryGroup / /TD TD html:select name=category property=categoryValue indexed=true bean:define id=categoryValue name=category property=categoryValues/ html:options name=categoryValue / /html:select /TD /TR /logic:iterate /TABLE This creates something like: TR TD Project /TD TD select name=category[0].categoryValue option value=CommissioningCommissioning/option option value=Commissioning,Engineering SignoffCommissioning,Engineering Signoff/option option value=Commissioning,Government AgenciesCommissioning,Government Agencies/option option value=Erection/InstallationErection/Installation/option option value=Erection/Installation,StructuralErection/Installation,Structural/o ption option value=Erection/Installation,Structural,Footings Foundation /select /TD /TR My problem is getting the value of what the user selected. All I want to do is for the first select box, whatever the user selected put that in the respective categories categoryValue property. But I do not see where that value is going. When I look at the request parameters I get: category[0].categoryValue = Erection/Installation,Structural,Footings Foundation In a nutshell is there a way to populate my objects with the value that the user has selected? Do I need to modify my object? Any help you can provide is highly appreciated. Alex pwCategory.java pwCategoryList.java
REPOST: A hint how to do the following with a bean.
Hi, Need a hint on how to do the following: I have a bean which is a vector of items. Each item object has a name, description price etc. When the user selects an item I create this vector and pass it to a page which iterates through the vector and creates a table. Something like: name desc price storeroombuyer The table I get has the same data for the first two rows. I want to take out those first two rows and place them into the table caption. Without iterating through the vector how can I get the name and desc property of the first item. That data is going to be the same for all the other items in the vector. Thanks for any help. Alex
RE: REPOST: A hint how to do the following with a bean.
Thanks for all the help. I got it working. Alex
A hint how to do the following with a bean.
Hi, Need a hint on how to do the following: I have a bean which is a vector of items. Each item object has a name, description price etc. When the user selects an item I create this vector and pass it to a page which iterates through the vector and creates a table. Something like: name desc price storeroombuyer The table I get has the same data for the first two rows. I want to take out those first two rows and place them into the table caption. Without iterating through the vector how can I get the name and desc property of the first item. That data is going to be the same for all the other items in the vector. Thanks for any help. Alex
RE: Can you comment on this design idea?
Hi, I have used SOAP in the past but the products I am working on have been developed using this VB back end. It has worked well for us so we are going along with the if it a'int broke then don't fix plan. What about my idea of checking application attributes in the actionservlet? Alex
re: Struts - XML - XSL
Hi, I don't know if this is what you are looking for but I just purchased a book from Orielly press that deals with Java and XSLT: http://www.oreilly.com/catalog/javaxslt/ I don't know how I can implement this with Struts. Hope this is helpful. Alex
newbe: radio button iteration
Hi, I am trying to iterate through a bean and populate a list of radio buttons. I pass an entity object (en) to a page. The entity object has a number and name parameter. I want to create a list of radio buttons all with the same name but the values being the entity number. For example: input type=radio name=entityNumber value=123 1996 DODGE DAKOTA PICK-UP TRUCK input type=radio name=entityNumber value=234 1996 DODGE BUS I have tried the following: logic:iterate id=en name=entitySearchList scope=request TR TD CLASS=TD_Border html:radio name=en property=entityNumber value=bean:write name=en property=entityNumber / / /TD TD CLASS=TD_Border bean:write name=en property=entityName / /TD /logic:iterate The above obviously does not work. I would appreciate it if someone could lend me a hand. Thanks Alex
struts architecture question.
Hi, I am trying to figure out if I have properly designed my classes. I have a class that extends ActionServlet. The only reason it does that is because all my web apps need a couple of generic objects in the application session before anyone can use the applications. So I overrode the doGet and doPost and init() methods. Examples are below: public void init() throws javax.servlet.ServletException { super.init(); //do Some Configuration; } public void doGet(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { HttpSession session= request.getSession(true); */ if(session.getAttribute(Constants.SERVLET_CONFIG)==null) { session.setAttribute(Constants.SERVLET_CONFIG, configSettings); } /** * place the rdserver object in the session */ if((session.getAttribute(Constants.RDSERVER))==null) { rdServer server=new rdServer(strHost, strPort); session.setAttribute(Constants.RDSERVER,server); } super.doGet( request, response); } I don't know what is wrong with the above it just looks wrong. And, when I start this app in tomcat I can see that the web app is being parsed and loaded twice. Any design tips, comments on the above are appreciated. Alex
Can you comment on this design idea?
Hi, hopefully someone can comment on an idea I have. I have a VB backend that I talk to via a socket to handle db access. When a connection is made to the back end I put a Boolean value of TRUE under the active key in the application session. If for whatever reason the VB backend goes down I get the key active and set it to FALSE. I created a tag that as the user goes from page to page it checks this key and if it is active it continues displaying the page and if it is not it takes the user to a generic, back end down page. A problem I found is that a user could be on a page and submit data to a servlet. If the backend has gone down while the user has been on a page, the servlet will not know about it and attempt to do some work. I do not want this to happen. I want a similar set-up that I have for the pages for the servlet. I was thinking of overriding the doGet and Post methods of the ActionServlet to check if the active key is true. If it is continue passing the request to the servlets if it is not then send them to a generic, back end not available page. Something like this: public void doPost(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { String errorPage=/serverNotAvailable.jsp; if(key) { //do usual work } else { RequestDispatcher disp=new request.getRequestDispatcher(errorPage); disp.forward(request,response); } super.doGet(request, response); any comments are appreciated. Alex
New message format help please.
Hi, I am trying to use the new HTMl:Messages in the struts nightly build. I am updating some of my code to use the new format. Two quick questions: 1: I am saving my messages in the action class via: ActionMessages messages=new ActionMessages(); messages.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage(response.title)); Is this correct? 2: How do I get these messages in my web page. I have tried: html:messages id=message name=%= com.popware.rd.Constants.MESSAGES % message=true bean:write name=message filter=false/BR /html:messages but this is obviously wrong. Any idea how to do this. Thanks for any info. Alex
Struts Console
Hi, Nice app. It should speed things up considerably. Just a quick suggestion for future enhancements. When it starts can it take the LF of the OS? When you do a file open can you specify a default directory. Thanks Alex
How to get context object while in Action
Hi, how do you get the servlet context object from within a Action class. I notice that the request.getSession.getServletContext is depreciated. I need to get values from the web.xml file. Thanks for the info. Alex = Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
More still can't you get these quotes arranged correctly?
I appreciate everyone helping me out. I was told that you can't use a bean expression to set the text of a submit button. What about a radio button. Below I am trying to iterate through an object and create a table with a radio button, and the number and name of this object. I want the radio button to hold the number of the object. Hence I am trying to set the value of the radio button to the entityNumber property. But I am having problems with the . I have tried escaping the quotes in the value parameter of the radio button but I have not been successful. Is what I am trying to do possible? Thanks for everyone's help. Alex logic:iterate id=entity name=entitySearchList scope=request TR TD html:radio name=entity property=entityNumber value=bean:write name=entity property=entityNumber/ / /TD TD bean:write name=entity property=entityNumber / /TD TD bean:write name=entity property=entityName / /TD /TR /logic:iterate = Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
Can you get these quotes arranged correctly?
Hi, I am having problems getting quotes arranged correctly. I have a radio button that I need the property set to a value in a bean. I have tried: html:radio name=rdoEntity value=bean:write name=entity property=entityNumber / / but I am getting errors creating the page. Can someone tell me what combination of quotes to use. Thanks Alex = Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
Still can't you get these quotes arranged correctly?
Hi, thanks for all the suggestions. I am still having trouble getting the text to show up properly. For a submit button I have escaped the quotes as suggested: html:submit property=submit value=bean:message key=\button.submit\ // When I call the page it does not evaluate the bean message tag. I get the following: input type=submit name=submit value=bean:message key=button.submit / All the other messages on the page are showing up correctly. Any further ideas are appreciated. Alex = Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
How to generically forward to page you came from?
Hi, I am creating a generic action class that after it is finished it needs to forward to the page that called it. I have tried mapping.getInput() but obviously since I haven't specified a input page in the struts.xml for the action class I can't use that. Any thoughts? Alex
Thanks to all that helped me out.
Hi, A big thanks to all that replied and tried to help me get the nightly build working with Tomcat. Although I was unsuccessful, I really do appreciate all the advice. I tried getting the nightly build of struts to work with Tomcat 3.2, 3.2.3, 4 but no luck. I rebuilt my applications to use version 1 of Struts. If it weren't for that iterate tag I would never have gone to a nightly build. I can't wait until the next version of Struts is out. Great work to the Struts team they have come out with an excellent product. Alex = Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
Question about html:link
Hi, how can I pass a javascript function to a link tag? My present tag is a href=javascript:doSummarry(A_NUMBER) The value of A_NUMBER is found in a bean via workrequest.number. Thanks for the help. Alex = Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
Really need you to get me out of a jam!!!!
Hi, Big problem. I have a major demo tommorow and I can't get my web apps to work with struts. I am using Tomcat 3.2 + the latest nightly build of struts. I needed the iterate tag. All my apps work within JBuilder but I cannot get them to work on there own. Every time I access a page I get an error that the message keys cannot be found. eg: exception javax.servlet.jsp.JspException: Missing message for key logon.title.bar Message Missing message for key logon.title.bar Localized Message Missing message for key logon.title.bar Stack trace javax.servlet.jsp.JspException: Missing message for key logon.title.bar at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:298) at _0002fpwEmpLogin_0002ejsppwEmpLogin_jsp_0._jspService(_0002fpwEmpLogin_0002ejsppwEmpLogin_jsp_0.java:115) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) In my web.xml file I have: !-- Action Servlet Configuration -- servlet servlet-nameaction/servlet-name servlet-classcom.popware.rd.action.genericActionServlet/servlet-class init-param param-nameapplication/param-name param-valueeuApplicationResources/param-value /init-param and the euApplicationResources file is in the class directory in web-inf. I can read the struts documentation but the struts-example gives me the same error. I downloaded Tomcat 4 beta 7 and that did not help. Can someone tell me exactly how to get the latest version of struts to work with tomcat? Any help is figuring this out is appreciated. Alex = Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Need help with error messages quick please
Hi, I am using the latest cut of Struts from the nightly build. I need the iterate function. Something has happened to my error messages. In my action class if a method fails I set the following error: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.invalidBidAmount)); I then save the error via: if(!errors.empty()) { this.saveErrors(request,errors); return (new ActionForward(mapping.getInput())); } When the user is redirect back to the page they came from all the user sees is the error.header msg. I have this tag in my web page after the body tag: html:errors/ I must be missing something. Could someone set me on the right track. Alex = Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
How to use image tag properly?
Hi, I am trying to do something simple. I have a bean that has a method that returns a boolean. Depending on the value I want to display one image or another. In other words, if the bean value is true then I want to display a check mark image, if it false I want to display another image. Any suggestions on how to accomplish this is appreciated. Alex = Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Can't find vector answer.
Hi, I know I have seen this on this list but my searches come up empty handed. I have a vector, 'list' returned to a page. I only want to show some text if the vector size is not 0 and the vector is present. I have tried this: logic:notEqual name=list parameter=size value=0 /logic:notEqual but the text still shows up. Any help is appreciated. Alex = Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
New Message tag format help please!
Hi, I notice that the message tags written by David Winterfeldt have been rolled into the Struts project. I downloaded the latest version of Struts and I am retrofitting the message tags. I think I figured out that I need that following code in my action class to save a message: messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(rfqRFQCreationResponse.title,Hello)); But now I am wondering how to retrieve the message on a page. I tried: %@ taglib uri=/WEB-INF/struts-validator.tld prefix=validator % validator:messagesExist name=MyMessage ul validator:messages id=message name=MyMessage libean:write name=message//li /validator:messages /ulhr /validator:messagesExist but this is not finding the message in the request session. Could you give me a quick tip and tell me how to access the new version of the messages on the page? Thanks Alex = Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
A bit of design help please?
Hi, I am wondering how the following can be done in Struts. You have a page with two frames, one being a navigation frame consisting of a series of links that populate the second frame. On start-up the second frame has a log in screen and the navigation frame just has a company image. On successful login you want the navigation pane to have a series of links to tasks that the user can do. They click on a task and the second frame fills with a form etc. When the user logs out or the session is killed the navigation frame links are removed. How can I control and keep the navigation frame synchronised with what is going on? Any help is appreciated. Alex
Re: A bit of design help please?
Hi, Thanks for the reply. Just a bit of elaboration. What I should do is have a simple login page. No problem. On successful login I send them to a framed page. So far so good. Question about this dynamic links. Could you elaborate on how to create them using struts? Alex -- Date: Thu, 16 Aug 2001 09:37:04 -0400 To: [EMAIL PROTECTED] From: Jon Crater [EMAIL PROTECTED] Subject: Re: A bit of design help please? Message-ID: [EMAIL PROTECTED] alex-- i think the best way to do this is not to have the frameset appear until after a successful login. obviously, you don't want the links to your functional areas to appear until after the user has been authenticated. so throw up a non-framed page which contains your login form. after authenticating the user, forward to your frameset, where you can dynamically build navigation links in the navigation frame based on permissions, etc, and where you can prepopulate the content pane with a default page until the user selects a link. targeting the content pane from the link is simple HTML (a href=/SomeAction.do target=contentlink text/a). your forward should then go to the content pane, where your output is displayed. when the session dies or the user logs out, simply forward him/her to the login page or some other non-framed page. hope this helps...
ActionForm not being updated. Please advice.
Hi, I am trying to get that iterate tag to work. I am interating through a vector a displaying the results. I have one field that I want the user to update hence I have made it a text box. When the page displays, the data is correct but when the user enters something into the text box and hits submit, the form in the actionservlet has the old data not what the user has entered. My jsp is as follows: html:form action=viRFQBid.do logic:iterate id=item name=ItemBidForm property=itemList TR TD CLASS=TD_Border bean:write name=item property=number / /TD TD CLASS=TD_Border html:textarea name=item property=partDescription / /TD TD CLASS=TD_Border html:text name=item property=unitPrice indexed=true / /TD /TR /logic:iterate /html:form Anything the user enters in the unit price is ignored, the old value is present in the form. My Struts config is: form-beans type=org.apache.struts.action.ActionFormBean form-bean name=ItemBidForm type=com.popware.rd.viPro.form.ItemBidForm/ /form-beans action-mappings actionpath=/viRFQSummary type=com.popware.rd.viPro.action.viRFQSummaryAction name=ItemBidForm input=/pwRFQList.jsp forward name=successpath=/pwRFQBid.jsp/ /action !-- Process the rfqBid action -- actionpath=/viRFQBid type=com.popware.rd.viPro.action.viRFQBidAction name=ItemBidForm input=/pwRFQList.jsp forward name=successpath=/pwRFQBidResponse.jsp/ /action /action-mappings viRFQSummaryAction works, the form is populated and passed to pwRFQBid.jsp but whatever the user enters as a unit cost is ignored. I take the form out in viRFQBidAction and check it. Any help in figuring this out is appreciated. Alex
How to use the indexed property-Please get me going?
Hi I am trying to use the indexed property with a page. I have a vector that holds a series of item objects. Each item object as a name, desc and unit price field. The page iterates through the vector and creates a table displaying the name and desc of an item and a text field for the unit price. I want the user to input the unit price and then submit the table. I have added indexed=true to the unit price text field: bean:write name=item property=unitPrice indexed=true / I have downloaded the 0912 nightly build. When I get to the page with the above table I get the following error: javax.servlet.ServletException: org.w3c.dom.DOMImplementation: method createDocumentType(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lo rg/w3c/dom/DocumentType; not found If I take the index=true off I do not get the above error? Could someone please help me out. Alex
Re: I think I found a bug in Struts?
When the app starts I put all the lists which are vectors into the application session. I do this by getting the servletcontext object and putting the vector into there. Alex * Date: Tue, 7 Aug 2001 12:41:11 -0700 (PDT) To: Struts [EMAIL PROTECTED] From: Craig R. McClanahan [EMAIL PROTECTED] Subject: Re: I think I found a bug in Struts? Message-ID: Pine.BSF.4.21.0108071238430.72473-10@localhost On Tue, 7 Aug 2001, Alex Colic wrote: Hi, It took a while but I think I found why the lists I put in application scope were not being refreshed. When my app starts I put a couple of lists into the servletcontext so that all my pages can access them. If the lists change I update the lists and then I expect the next time the user access the page that the lists would reflect the changes. I did a quick test and I found that my class was updating the list and putting them into the session. Where are they really? In the session or in application scope? That portion briefly is: protected ServletContext context; context.setAttribute(COMMON_PROBLEM_LIST,tbeList ); On my page I have the following: logic:present name=CommonProblemList scope=application html:select property=wrTitle bean:define id=list name=CommonProblemList scope=application property=list / html:options collection=list property=name/ /html:select /logic:present I stepped through the logic:present tag and found that while it looks for the bean it goes into the RequestUtils class. It enters the lookup method and scan through the scope value. It is finding that scope does equal application but the bean it is returning is the old one with the old data. I would step through the pageContext class but because it is abstract I am trying to find the concrete implementation of it. bean = pageContext.getAttribute(name, PageContext.APPLICATION_SCOPE); Any help in resolving this is highly appreciated. The concrete implementation of PageContext (and every other interface and abstract class in the Servlet and JSP APIs) is inside your servlet container. Alex Craig Alex Colic.vcf
Advice on how to implement the following:
Hi, I need a bit of advice on how to implement the following. I am creating a page that holds a list of item names along with their description. So far I created a vector that holds an array of items and then passes it to a Struts page in the request scope. The page then iterates the array and then produces the page. So far no problem. Now I need to add a text field in which the user can input prices for these items. Then I need that form submitted to my actionservlet for processing. This is where I get lost. I thought of adding a price field to my item class and then as the vector is iterated on the page I create a textfield binding it to the price field in the bean. But when the page is submitted I don't think the vector will be passed to my action servlet for parsing. Any help is appreciated Alex
objects still being cached why?
Hi, I am still having that problem with objects being cached. In my jsp I have some data that is displayed regularly. Therefore I have put that object into the context via: context.setAttribute(CommonProblemList ,tbeList ); When the data the list is based upon changes, I have a monitor class that listens for that change and then repopulates a similar object and then puts it into the context via the method/line above. Then in my JSP I access the data via the below: TR TDbean:message key=prompt.select/TD TD logic:present name=CommonProblemList scope=application html:select property=wrTitle bean:define id=list name=CommonProblemList scope=application property=list / html:options collection=list property=name/ /html:select /logic:present TD /TR I have set nocachein my actionservlet via: init-param param-namenocache/param-name param-valuetrue/param-value /init-param My problem is that if I change the data in my database the data in my JSP page is not updated. I have stepped through my code and my monitor class does see the change in the database, it is compiling a new object and it is placing it into the application context. I checked the object data being placed and it does have the new data in it but if I got to the web page which uses that object it only shows the old data. If I shut tomcat down and restart it I do see the new data. Can someone suggest what is going on here and how to fix it? Thanks for the help. Regards Alex Alex Colic.vcf
best way to create front end to web.xml
Hi, I need to create a GUI front end to the web.xml file. This way the file can be configured from a web page. What I thought about doing was to create an admin screen, have the user log in, and check against a file etc. Then I was going to get the servletContext, open a stream and read the web.xml file. Then populate a vector and pass it to a struts page that would set up a series of labels and textboxes with prefilled info. Once the user has submitted the page I was going to read through the parameters and update the file. Sound good? Regards Alex Alex Colic.vcf
Question about struts and list caching?
Hi, hope someone can help me out here. I think I have a problem with struts and my classes caching list. In my jsp I have some data that is displayed regularly. Therefore I have put that object into the context via: context.setAttribute(CommonProblemList ,tbeList ); When the data the list is based upon changes, I have a monitor class that listens for that change and then repopulates a similar object and then puts it into the context via the method/line above. Then in my JSP I access the data via the below: TR TDbean:message key=prompt.select/TD TD logic:present name=CommonProblemList scope=application html:select property=wrTitle bean:define id=list name=CommonProblemList scope=application property=list / html:options collection=list property=name/ /html:select /logic:present TD /TR My problem is that if I change the data in my database the data in my JSP page is not updated. I have stepped through my code and my monitor class does see the change in the database, it is compiling a new object and it is placing it into the application context. I checked the object data being placed and it does have the new data in it but if I got to the web page which uses that object it only shows the old data. If I shut tomcat down and restart it I do see the new data. Can someone suggest what is going on here and how to fix it? Thanks for the help. Alex Alex Colic.vcf
RE: Question about struts and list caching?
I added the following to my web.xml but it did not make a difference: init-param param-namenocache/param-name param-valuetrue/param-value /init-param Any other thoughts? Alex -Original Message- Date: Mon, 30 Jul 2001 10:22:08 -0400 To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] From: Zeltser, Mark [EMAIL PROTECTED] Subject: RE: Question about struts and list caching? Message-ID: [EMAIL PROTECTED] Alex, Did you try to set init param for ActionSerlvet to true for nocache tag?
why is servlet.init method being called twice.
Hi, I created a base actionservlet class that in its init method, the first thing it does is call super.init(). In this base class I set up common settings for all my web apps. I then created a series of classes that all extend my base ActionServlet class and in their init method the first thing they call is super.init. The problem is that as my webapps start the init methods in all three classes are being called twice? Is this correct? Alex Alex Colic.vcf
help with checkbox
Hi, I am hoping someone can point me in the right direction. First, I have a checkbox that regardless of if the user checks it or not I need it to be set to true. Can someone suggest a way via JavaScript or otherwise to set this checkbox to true. Second, for the same checkbox, if I do not set its value and then go a few pages forward I have a status page that displays the value of the checkbox. If I have not checked the box the value is false, if I then go back a few pages and then check the box and go to forward to the status page again it is shown as checked but, if I go back and uncheck the box and then go forward it is still shown as checked. Any ideas what is up. Thanks Alex
Thanks for all the internationalisation help.
Hi, Sorry I have not thanked everyone for all their help. Using everyone's suggestions I have created a web page which allows a user to select a different language for my web app. Once again thanks all. Alex
Help with selecting an image to display.
Hi, I am looking for advice regarding the use of two images. Lets say you have a class status that has two boolean state properties isModify() and isNew(). If isModify() returns true then I want to display modify.gif and call the JavaScript function modify() and, if isNew() is true then I want to display new.gif and also call modify(). Anyone have an example of this or could offer some advice? Thanks. Regards Alex Alex Colic.vcf
setting boolean to yes/no
Hi, I have a form with a checkbox that sets a boolean property in one of my classes. At a later page I display a msg if the user has selected the checkbox and I get 'true' or 'false' displayed. What I am actually looking for is a 'Yes' or 'No' to be displayed. Is there a clean way of getting the boolean value and then converting it to the 'yes/no' and then displaying them on a page? Thanks for any help. Alex Alex Colic.vcf
viewing combo box
Hi, lets say you have a combo box filling from a vector. I can get this to work but I don't want the combo box to show if there are no options in it. In other words if the vector=0. What the best way to do this. Thanks for the help. Alex Alex Colic.vcf
Please help with logic notPresent
Hi, I have an object in the session that if it is not there I want to display and error msg to the user. My error code is as follows: logic:notPresent name=VendorResourceList scope=session font color=red bean:message key=error.fatal / /font /logic:notPresent I would think that the above code would show the message if the VendorResourceList object is not found in the session but the error msg is always displayed even though the below code snippet works. TABLE TR TD bean:message key=prompt.vendorNumber/ /TD TD logic:present name=VendorResourceList scope=session I am here /logic:present /TD Amy help in understanding this is appreciated. Alex Alex Colic.vcf
Setting focus to textbox?
Hi, I am getting an error setting focus to a textbox. My form tag is as follows: html:form action=reqHeader focus=requisitionHeader.reqTitle method=GET I have created a text box as follows: html:text property=requisitionHeader.reqTitle size=16 maxlength=20 / What I am trying to do is set focus to the text box when the page is loaded. Any ideas where I have gone wrong? Thanks for the help. Alex Alex Colic.vcf
Setting value to a textarea?
Hi, I am trying to set the value of a textarea that I have created via: TD html:textarea name=requisition property=requisitionLines.description value=requisitionLines.pcitem.name cols=20 rows=10 /html:textarea /TD When the page is displayed the textarea text is populated with requisitionLines.pcitem.name not the value held in the bean. Could someone tell me what I am doing wrong? Thanks Alex Alex Colic.vcf
Using value of one bean in a textarea?
Hi, I have a bean whose value I can display via: bean:write name=requisition property=requisitionLines.pcitem.name/ What I want to do is create a textarea and have the value of the defaulted to the above name value. My textarea has been created as follows: html:textarea name=requisition property=requisitionLines.description cols=20 rows=10 Could you please tell me how to set the value of that textare by default to the above bean? Thanks for any help. Regards Alex
how to forward from one action servlet to another?
Hi, how do you forward from one action servlet to another? I have a form that gets submitted to a servlet that I may depending on a value pass it off to another servlet to process. Any help is appreciated. Alex ext. 104 Fax: 1-905-777-0132
Re: how to forward page on logic:notPresent?
Hi, I thought about login:forward but from what I know I would have to know the name of the next page and place that in this tag. I don't want to do that because if I change the order of my pages in the struts.xml file then I have to remember to change this tag. I think what I am looking for is a way to either, immediately submit this page if an object in the session does not exist and this let the action servlet figure out what the next page should be or, check in the previous page if this object exists and if does not then bypass this page. Any thoughts, suggestions? Regards Alex Original Message Date: Wed, 09 May 2001 07:50:08 To: [EMAIL PROTECTED] From: Bart Moberts [EMAIL PROTECTED] Subject: Re: how to forward page on logic:notPresent? Message-ID: [EMAIL PROTECTED] From: Alex Colic [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Struts [EMAIL PROTECTED] Subject: how to forward page on logic:notPresent? Date: Tue, 8 May 2001 16:47:12 -0400 Hi, suppose you have an object in the session. If the user access a page that uses this object you want data to be displayed but if this object is not in the session you want the page submitted so that the user will end up on the next page. A sort of a wizard app.. page 1 to 2 to 3 where you bypass page 2 if the object is not there. I can use the logic:notPresent to check to see if the object is not in the session but how would you forward the user? Thanks for any help. Alex Hello Alex Maybe you can do this with logic:forward tag? Grtz
icons not showing up-Repost?
My mistake. I was testing all possibilities and I sent you a bad example. This set of HTML code works: IMG SRC=./Images/cancel.gif ALT=Cancel NAME=btnCancel This struts code does not: html:image src=./Images/cancel.gif alt=Cancel property=action value=cancel / When the page is resolved the above struts code equals: input type=image name=action src=./Images/cancel.gif alt=Cancel value=cancel What I am trying to do is have a couple of buttons on the page all submit the page with different actions. Then in the action servlet read which button was submitted via: String theAction = request.getParameter(action); Is my logic sound? Any ideas? Regards Alex Original Message Date: Tue, 8 May 2001 15:12:48 -0600 To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] From: Kyle Robinson [EMAIL PROTECTED] Subject: RE: icons not showing up? Message-ID: [EMAIL PROTECTED] Your src is different in each case. The first one includes a . at the beginning, the second does not.
why is this form not being properly submitted?
Hi, I have a form with two buttons. If the user clicks one button the form is submitted via the standard action defined in the form tag. If it is the second button, I change the action and submit the form. The problem is that I have a text box on the form that when I check its value in the action servlet that parameter is not being passed. A snipped of my html page is as follows: html:form method=POST action=wrSearch TABLE name=tblModifyWRCriteria TR TD bean:message key=prompt.wrNumber / /TD TD INPUT TYPE=text ID=wrNumber Name=wrNumber SIZE=20 /TD TD On the default button wrNumber is submitted to the action servlet but on the the second button I do the following: function doWRModify(wrNumber) { workrequest.wrNumber.value=wrNumber; workrequest.action=/wrModify.do; workrequest.submit(); } I set the value of the text box, then I reset the action then I submit the form. In the below case I get null returned: String strWRNumber=request.getParameter(wrNumber); Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132
RE: why is this form not being properly submitted-solved?
Hi, thanks your hints below solved the problem. Alex quoted message: Date: Tue, 8 May 2001 10:46:52 -0700 To: [EMAIL PROTECTED] From: Abraham Kang [EMAIL PROTECTED] Subject: RE: why is this form not being properly submitted? Message-ID: 002e01c0d7e6$dd825510$[EMAIL PROTECTED] Hi Alex, Can you put a alert(workrequest.wrNumber.value); in function doWRModify(wrNumber) after you assign the value to wrNumber? Is the form name, workrequest (View Source to check)? Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132
how to forward page on logic:notPresent?
Hi, suppose you have an object in the session. If the user access a page that uses this object you want data to be displayed but if this object is not in the session you want the page submitted so that the user will end up on the next page. A sort of a wizard app.. page 1 to 2 to 3 where you bypass page 2 if the object is not there. I can use the logic:notPresent to check to see if the object is not in the session but how would you forward the user? Thanks for any help. Alex
icons not showing up?
Hi, I am trying to use struts to show a couple of icons. The following html works: IMG SRC=./Images/cancel.gif ALT=Cancel NAME=btnCancel onClick=doCancel(); but this does not? html:image src=/Images/cancel.gif alt=Cancel property=action alue=cancel/ In the struts way the form is submitted but the icon does not show up. Any help is appreciated. Regards Alex
How to check if an array is null
Hi, I have a class which has a method 'Columns' which is a one dim array of Strings. How can I check to see if that method returns null. I want to write out one message if it is null another if it is not. Thanks for the help. Regards Alex
How to use html:base? with images?
Hi, I am trying to get some images to work but so far no luck. My web app directory is as follows myCompany/... place for my JSP's myCompany/Images..all my images are here. On one of my pages, pwSubmit.jsp I have the following tag. html:image page=/Images/cancel.gif alt=Cancel property=action value=cancel / For the above Struts tag the image does not show up but if I use the below HTML tag the image does. IMG SRC=./Images/cancel.gif ALT=Cancel NAME=btnCancel When I look at the source I see the following for html:base base href=http://localhost/myCompany/pwWRSubmit.jsp; and for the image tag. input type=image name=action src=/myCompany/Images/cancel.gif alt=Cancel value=cancel Any help is appreciated. Regards Alex
How to get value of button submitted?
Hi, I have a couple of buttons on a web page, all with the same property but with a different value. I want to be able to submit that form and then have my actionservlet figure out what to do depending on which one of the buttons the user select. I have a web page with image buttons as follows: html:form method=GET action=wrSubmit html:image page=/Images/cancel.gif alt=Cancel property=action value=cancel / html:image page=/Images/exit.gif alt=Exit property=action value=exit / html:image page=/Images/create.gif alt=Create property=action value=create / html:image page=/Images/modify.gif alt=Modify property=action value=modify / /html:form In my action class regardless of which button I press the code below always resolves to null. String theAction = request.getParameter(action) ; Any ideas what I am doing wrong? Regards Alex
How to iterate to create select box.
Hi, I am trying to iterate through a vector to populate a select box. I have a class CategoryList in application scope that holds a list of Categories. Each category has a CategoryGroup name and a vector of CategoryValues. At run time I am trying to create a page that dynamically creates the above select boxes not knowing how many elements will be in the list. I can iterate through the CategoryGroupName via: logic:iterate id=category name=CategoryList property=categoryList scope=application bean:write name=category property=categoryGroup filter=true/ !--need to figure out how to create select box -- /logic:iterate Any help in figuring this out is appreciated. My category class is as follows: public class pwCategory { private String categoryGroup; private String categoryName; private String categoryAbrv; private int categoryNumber; private String categoryValue; java.util.Vector categoryValues; public pwCategory() { } public String getCategoryGroup() { return categoryGroup; } public void setCategoryGroup(String newCategoryGroup) { categoryGroup = newCategoryGroup; } public void setCategoryAbrv(String newCategoryAbrv) { categoryAbrv = newCategoryAbrv; } public String getCategoryAbrv() { return categoryAbrv; } public void setCategoryNumber(int newCategoryNumber) { categoryNumber = newCategoryNumber; } public int getCategoryNumber() { return categoryNumber; } public void setCategoryValue(String newCategoryValues) { categoryValue = newCategoryValues; } public String getCategoryValue() { return categoryValue; } public void setCategoryValues(java.util.Vector newCategoryValues) { categoryValues = newCategoryValues; } public java.util.Vector getCategoryValues() { return categoryValues; } } My categoryList class is as follows: import java.util.*; import com.popware.avantis.*; public class pwCategoryList { private List categoryList=new Vector(); public pwCategoryList() { } public List getCategoryList() { return categoryList; } public void setCategoryList(List categoryList) { this.categoryList = categoryList; } public void addCategoryList(pwCategory newCategory) { categoryList.add(newCategory); } } Regards Alex
How to have two tags populate one field?
Hi, I have a bit of a problem. I have a select box and a text box which I need to both point to one property. The combo has a list of titles. The user could select one of these titles or input there own but when they submit the box I need the following to occur: If there is text in the text box then that is the title else the option selected is the title. Could this be done within Struts? Regards Alex Colic, HBA, B. Ed PopWare Inc. Driving down the cost of conversions! E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132
How to create multiple select boxes?
Hi, quick questions. I am trying to figure out how to create multiple select boxes on the fly. I have a class CategoryList the extends vector. To this list I add elements of type Category, which has a getCategoryValues() method which returns a vector of categories (String) as well as a getCategoryName(). Now the big questions, on a page I want to pull this object out of the session kept under the key CategoryList and create select boxes out of the Category objects held in CategoryList. At design time I do not know how many elements there are in CategoryList but for each element I need to create a select box populated by that elements getCategoryValues() method; Any help or pointers is appreciated. Alex
How to submit JSP to itself?
Hi, How do you set-up the action property of a form tag if you want the JSP to submit the form to itself? When the user wants to go to the next page I have a next button that in its onclick event I will set the forms.action property via JavaScript. Thanks for any help. Alex
Need help with logic:iterate :)
Hi, I am trying to get a handle on the logic:iterate tag. I have an object in application scope under the key 'storeroomList.' There is a vector of objects under the property 'storeroomList'. Each one of the objects in this vector has a property 'name.' What I am trying to do is go through the vector and print out the names. I have attempted the below but the only storeroom name to be printed out to the screen is the last storeroom. I traced the execution of the iterate class and it looks to be getting the correct data, going through each element of the vector and pulling out the name property and then looping through all the elements without printing them to the screen and then the bean:write is called. Any help is as usual greatly appreciated. Oh, bonus question.. Lets say I only wanted to print out a particular storeroom. Iterate through the vector but only print the storeroom that had the name "main." logic:iterate id="storerooms" name="storeroomList" scope="application" property="storeroomList"/ bean:write name="storerooms" property="name" /BR /logic:iterate Regards Alex
why is init method of actionservlet being called twice?
Hi, I have subclassed actionservlet. In the init method of my subclass I have called super.init(); For some reason as I step through my code the init method of my subclass is being run through twice. Any idea why? my web.xml file is as follows: !-- Action Servlet Configuration -- servlet servlet-nameaction/servlet-name servlet-classcom.myCompany.rd.pwActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecom.myCompany.rd.reqPro.ApplicationResources/param-value /init-param init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param param-namedebug/param-name param-value2/param-value /init-param init-param param-namedetail/param-name param-value2/param-value /init-param init-param param-namevalidate/param-name param-valuetrue/param-value /init-param load-on-startup2/load-on-startup /servlet Regards Alex
Update on caching lists.
Hi so far my list caching is going well, I have set up a thread to monitor database changes and to update the lists stored in the servlet context. Unfortunately, although my program is noticing the change in the database and it is recompiling the data and putting the new data into the context under the same name, the lists are not being updated. I place lists in the servletcontext via: context.setAttribute("storeroomList",storerooms ); When the lists change I recall my cachelist method and the above line is repeated. I thought that would replace the present list with the new one but that is not occurring. Is there another way I am supposed to be replacing attributes? To test I opened up a web page populated with my list and then went to the database and changed some values in the list. My program then caught these changes, and repopulated the lists and then placed them in the context again. I then opened up another window and the page was populated with the old data. Any help in this matter is appreciated. Alex
Update on caching lists.
Oh, I thought about using removeAttribute() and then setting the attribute of the list again but I am worried about pulling a list out of the servletcontext just as a person might be accessing a page that needs that list. Regards Alex
how to cache lists?
Hi, Lets say you have a web app that runs over a number of web pages in a wizard fashion. On each one of these pages you need to present the user with a select box holding lists. e.g. locations, cities, etc. This data is read from a database and rarely changes. How would you cache these lists so that as each user access this site they do not need to have this info downloaded again? I was thinking in the init() of my ActionServlet to access the database and get these lists then place them in the session with Application scope. I think this would allow each user to access the data without reaccessing the database. Any comments or suggestions are appreciated. Regards Alex