RE: Splitting ApplicationResource.properties
Becky, Attached is an extension of ActionServlet that I wrote which loads multiple resource bundles based on a properties file that specifies everything to load. This may not be exactly what you want, but it might give you some good ideas - Hope it helps - Margaret -Original Message- From: Becky Moyer [mailto:[EMAIL PROTECTED]] Sent: Monday, January 21, 2002 3:30 PM To: [EMAIL PROTECTED] Subject: Re: Splitting ApplicationResource.properties So, from Martin Cooper's post at http://www.mail-archive.com/struts-dev%40jakarta.apache.org/msg04548.html, I gather that while there is an apparent assumption that each application has a single source of message resources in both Struts 1.0.x and the latest code, I can infer there is a way around it?? The new subapp concept looks pretty cool. But does that mean you can install subapps on the fly, while your servlet engine is running? My ActionServlet has a set of pages that allow developers to upload an almost-war file (that has a struts-config.xml but no web.xml file) and it's read in and available immediately, all classes are loaded in... things are put in set places. This allows new sections of the site to be added without reloading tomcat. Anyway, back to the topic at hand, I am still confused. With Struts 1.0, can I add new messages without restarting (as I can add ActionMappings, etc, without restarting)? I have been trying to look at the Struts code to see how it's done now, and I am just not seeing a way I can add my messages. Thanks for your reply, Becky Original Message Follows From: Ted Husted [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Splitting ApplicationResource.properties Date: Mon, 21 Jan 2002 15:01:21 -0500 There's some recent work going on in the nightly build that might interest you. http://www.mail-archive.com/struts-dev%40jakarta.apache.org/msg04354.html Becky Moyer wrote: Hello all... I can't seem to find the answer to my question in the archive, the javadoc, or the source, so I was hoping someone could figure this one out. I have a class extending ActionServlet to read struts-config.xml files from places other then WEB-INF/ in order to split apart the different aspects of my webapp. I would also like to be able to split up my resource.properties files. I can find these files in my ActionServlet, but I can't figure out how to read them in so that they will be available for bean:message key=mykey/ tags. I've tried doing a props.load and a System.setProperties(props), and after I did that I saw that Struts stores those messages using its own Properties object...I'm just not sure how I can get the new properties in without losing the old properties, since it looks like I have to create a new MessageResource object in the ActionServlet to add in a new properties file. I'm going to keep staring at the code and the javadoc, but does someone have any ideas as to what I need to do with the properties to make them available to bean:message?? I feel like I am missing something staring me in the face! Thanks in advance, Becky _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- 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] _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] MultiBundleActionServlet.java Description: Binary data -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to pass initialise parameters to action class
Alex, why not just lazy load the value in an accessor for the value? in general I prefer this over an init method, but it guess it's just a stylistic preference... hope this helps - Margaret -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 9:31 AM To: Struts Subject: 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
RE: How to handle a PopUp Form from another Form?
Nimmi - In doing something similar to what you want to do I did the following: 1) Create javascript function to open a new modal window (I am only concerned with supporting IE5.5, so using #showModalDialog works for me 2) create the link using plain ol' html, with an onClick handler that points to my javascript function. Build the url to pass to the function using html:rewrite which allows you to specify your forward, etc as you are currently doing with the html:link tag 3) For the action that I open in the popup, I define both success and failure pages. The success page contains javascript that looks for the opener window and refreshes it, then closes the popup window. 4) using the #showModalDialog is the most effective way that I have found to prevent the user from going back to the opener window. Hope this helps - Margaret -Original Message- From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 4:53 PM To: '[EMAIL PROTECTED]' Subject: RE: How to handle a PopUp Form from another Form? This is what my current html:link tag looks in my originator form(SubmitQuotes.jsp): html:link forward=partDetails paramId=partNumber paramName=submitQuotesForm paramProperty='%= rfqList[ + i +].PartNumber %' where partDetails is an action class that retrieves the details for the part from the database into an ActionForm PartForm. The mapping for partUpdate.do will have a forward defined to part.jsp which displays data in partForm. 1. How do I specify in above html:link that part.jsp should open up in a new window with no location bar, tool bar,etc (The forward in mappings only allow TARGET parameter)? 2. The form action in part.jsp would be savePartInfo.do action class which saves part changes to database. If the partForm passes all validations I have to save the data and close this popup window and put control back to SubmitQuotes.jsp. How would I close the popup window in action class savePartInfo? 3. If I specified inputForm=part.jsp in savePartInfo mapping, would it correct to assume that if the partForm validations failed the control would return back to the popup window(part.jsp) and NOT to the SubmitQuotes.jsp? 3. How do I make sure that while part.jsp is open the user cannot go back to SubmitQuotes.jsp? Hope this makes clear what I am trying to achieve. -Nimmi -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 4:09 PM To: [EMAIL PROTECTED] Subject: RE: How to handle a PopUp Form from another Form? I haven't done this before, but am not sure what the problem is. You say you have an indexed link to partInfo.do, which you can bring up in a new window using target=. Submit etc from this window should return you to this window if error etc.. Where exactly is your difficulty? Dave Shamdasani Nimmi-ANS004 [EMAIL PROTECTED] on 10/22/2001 04:47:25 PM Please respond to [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: RE: How to handle a PopUp Form from another Form? It is an indexed link. I already know how to get the indexed link to include the part number. What I want to do is: This link should point to an action class, say partInfo.do, which retrieves the complete information about that part and puts it into an ActionForm and then forwards to a JSP in a NEW window(with no location bar,no tool bar,etc.)on top of the originator window. User submits to this ActionForm have to follow the normal ActionForm features, i.e., bring back the part form screen in case of actionerrors. And If the update is successful then the part changes are to be saved to the database and the popup window closed and user allowed to continue work on the originator window Until the user has successfully updated the data and the popup window is closed, he/she should not be able to get to the originator form. I hope someone has handle this situation and can help me. -Nimmi -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 3:27 PM To: [EMAIL PROTECTED] Subject: Re: How to handle a PopUp Form from another Form? Perhaps you can use a indexed link which brings up the data in the popup form. As for the second part, could you use javascript onload function in the original page, which checks to see if popup exists, and if it does puts focus back on it? Cheers, Dave Shamdasani Nimmi-ANS004 [EMAIL PROTECTED] on 10/22/2001 02:50:51 PM Please respond to [EMAIL PROTECTED] To: struts-user@jakarta. apache. org (E-mail) [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: How to handle a PopUp Form from another Form? Hi, I am looking for suggestions on how to handle this situation: I have a grid form (i.e., a form with tabular data). One of the columns of this tabular data is PartNumber which when clicked on a row should popup a form in a new window bringing up
RE: dynamic forwards
Lisa, I haven't tried it myself, but according to the doc for the html:link tag, you can specify a bean that returns a map which specifies all of the parameters... the contents of that bean clearly could change between invocations, thus giving you dynamic parameters... Hope this helps - Margaret -Original Message- From: lisa ward [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 26, 2001 12:52 PM To: [EMAIL PROTECTED] Subject: dynamic forwards Hi all, I am having the exact same problem as Chiji, so I have just copied and pasted a bulk of his email (Sorry Chiji) . Im literally pulling my hair out over this one. Chiji, if you have solved the problem let me know or point me in the right direction. Thanks Chiji's email reads: -- start of Chiji's email-- Hi, Im in a bit of dilema, I don't understand is what I should do if the parameters which are used by the html:link (forward) tag are generated on the fly. I can't hard code all the forwards in my config file because I don't know how may parameters there will be in advance. Since I don't know the amount parameters in advance I can't specify which form bean each of the actions with, appended parameter values, should use. This is what my problem looks like: in config file: forward name=search path=/do/search / action path=/search name=searchForm input=/seach.jsp scope=request / in jsp file: logic:iterate id=pageNumber name=pageList offset=0 html:link forward=search paramName=pageNumber paramId=pageNumber bean:write name=pageNumber / /html:link /logic:iterate html:hidden property=pageNumber / when I use: html:link forward=search it works fine and think this is because of the mapping in the config file. I would want the forward to 'search' (/do/search) as well as the forward to 'search' and it parameters (/do/search?pageNumber=1) to use the same form bean. I hope this makes sense. -- end of Chiji's email-- Thanks Lisa _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
RE: link with dynamic page attribute
Antonio - Unfortunately you cannot nest tags... you'll have to resort to a scriptlet in this case: html:link page=/ServiceReport.do?operation=deleteoperationActivityId=%=activity.get Id()%/ This seems to be something that everyone intuitively wants to do - hopefully the capability will be added in a later jsp spec... a second option is to put all of the parameters in a map (just as an illustration): % HashMap requestParamMapBean = new HashMap(); requestParamMapBean.put(operation, delete); requestParamMapBean.put(operationActivityId, activity.getId()); % html:link page=/ServiceReport.do name = requestParamMapBean/ Hope this helps - Margaret Martin -Original Message- From: Antonio Lourinho [mailto:[EMAIL PROTECTED]] Sent: Monday, September 24, 2001 11:00 AM To: [EMAIL PROTECTED] Subject: link with dynamic page attribute Hi, i'm new to Struts and i'm already working on a project that takes advantage of it. The problem is: i'm trying to put a link, and the page attribute depends upon the value of a bean defined by an iterate tag. something like: html:link page=/ServiceReport.do?operation=deleteoperationActivityId=bean:getProper ty name=activity property=id// the error is: org.apache.jasper.compiler.ParseException: C:\Dev\Projectos\ControloHoras\web_app\ServiceReport.jsp(171,115) Attribute activity has no value Does anybody have a clue? Antonio - Portugal _ INTERNET MAIL FOOTER A presente mensagem pode conter informação considerada confidencial. Se o receptor desta mensagem não for o destinatário indicado, fica expressamente proibido de copiar ou endereçar a mensagem a terceiros. Em tal situação, o receptor deverá destruir a presente mensagem e por gentileza informar o emissor de tal facto. - Privileged or confidential information may be contained in this message. If you are not the addressee indicated in this message, you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. -
RE: Reflection vs. Direct Method Call
Kevin, Our performance engineers have done some benchmarks on jdk 1.3 and have basically declared the difference insignificant... now it probably goes without saying that you wouldn't want to do everything with reflection, but a little in the right places is certainly a good thing - Margaret -Original Message- From: Kevin McLain [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 26, 2001 5:33 PM To: [EMAIL PROTECTED] Subject: Reflection vs. Direct Method Call Hello All, Just a general performance question Does anyone know the performance difference between a direct method call and introspection like Struts uses? I would be interested in hearing the differences for different Java implementations (I have heard that JDK 1.4 will be making huge improvements in this area) because I have heard that there can be significant differences. The application I am considering using Struts with would require large amounts of numerical data to be posted through the introspection and therefore if introspection performance is a problem I would have to choose another framework or roll my own. Thanks for any help, Kevin -Original Message- From: Andreas Amundin [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 26, 2001 2:50 PM To: '[EMAIL PROTECTED]' Subject: RE: Use of form beans - design issue... First let me preface with the fact that I have been dabbling with struts for about 6 weeks, so please take what I say with a grain of salt. And anyone else out there please correct me if I am wrong. See my inserted replies below. From: Burleson, Thomas [mailto:[EMAIL PROTECTED]] snip Currently -- as I understand it -- the ActionForm (bean) is populated by the ActionServlet using introspection. And the Bean is then used by the Action (handler) to modify/update the business layer or model data. Then the actionForward is used to indicate which JSP the Servlet should forward/dispatch to. The page (which could be a different JSP page or the same used for the request) then searches for the ActionForm (bean) and creates one if it does not exist in the request scope. This is where my understanding differs. As I understand it the ActionForm is created by the JSP if none exists. As far as I know it is possible to directly load a JSP page with a form without invoking any pre-processing action servlet. So (finally) here is the issue: The controller and handler uses a dumb bean to modify the model (MVC). Cool! But to gather information for use on a JSP, the bean must know how to gather that data from the business layer (model). BAD!! Following your understanding of how things work I completely agree with what you are writing above. However, let me now state that I don't think beans used in a JSP should ever have any dependencies on the model. IMHO beans for use in JSPs should be dumb holders of information. They are the input and output parameters of the JSP. To populate beans for a JSP a pre-processing action servlet should use model classes or EJB entity beans. The action servlet controls how information from the model is propagated to the view. The handler should configure the bean BEFORE dispatching to the JSP. This way, the bean remains dumb and the handler centralizes all knowledge of the business layer. Exactly. Struts seems to use 2 different patterns/approaches: the incoming processing is very different than the processing used during display of the JSP. I would say Struts have an approach for incoming, from the form, processing that automatically populates the form bean with the information from the form. For the processing during the display of a JSP all that happens is that the form bean is created if one cannot be found. The found form bean, newly created or not, is used to populate the default values of the form. I hope this explanation makes sense. Andreas
RE: web application initialization
I've had success with this, but I only overrode initApplication(), rather than all of init(). is your web.xml pointing to your new subclass? -Original Message- From: Fabien Le Floc'h [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 19, 2001 11:06 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: web application initialization Thank you for the tip, this is definitely working and is not too ugly. However I still find a little bit stupid we have to create a new Servlet just to use its init method. Or maybe not if your Log4j servlet allows you to modify the logging / the log4j properties remotely (but that is another project, and it is bad not to use struts for that). I tried just to extend the ActionServlet and rewrite the init method (adding lines to it). After modifying the web.xml, it still did not work. Has anyone a clue why? Did anybody try to extend ActionServlet? Regards, Fabien Abraham Kang [EMAIL PROTECTED] writes: Hi Fabien, I typically do this in a StartupServlet in my web.xml. Here is an example of how I initialize Log4j: web-app context-param param-nameweblogic.jsp.keepgenerated/param-name param-valuetrue/param-value /context-param servlet servlet-namelog4j/servlet-name servlet-classcom.infogain.DOG.logging.servlet.Log4jServlet/servlet-class init-param param-namedebug/param-name param-value2/param-value /init-param init-param param-namewlpi_log4j_conf/param-name param-value/WEB-INF/wlpi_log4j_conf.properties/param-value /init-param init-param param-namebase_category/param-name param-valuecom.infogain.DOG/param-value /init-param init-param param-namebase_priority/param-name param-valueinfo/param-value /init-param load-on-startup1/load-on-startup /servlet ... The init() method of Log4jServlet handles stuff that needs to run before Struts (struts's load-on-startup is 2). --Abraham -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Fabien Le Floc'h Sent: Wednesday, July 18, 2001 10:58 PM To: [EMAIL PROTECTED] Subject: web application initialization Hi, I would like to know if it is possible to have some code called at the web application initialization (something like the init() method of the first servlet called by the web app - which here is ActionServlet). Should I just extend ActionServlet? regards, Fabien
RE: struts-config parameter
in your action code you can retrieve it from the ActionMapping passed in to the perform method via: mapping.getParameter(); We are using this parameter to indicate the method name to invoke from perform, so that we have a handful of action classes with many methods on them rather than a lot of very thin action classes. good luck - Margaret -Original Message- From: Christoph Breidert [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 19, 2001 12:56 PM To: '[EMAIL PROTECTED]' Subject: struts-config parameter Hi everyone, in the dtd of struts-config it says: 'parameter General purpose configuration parameter that can be used to pass extra information to the Action selected by this mapping.' How can I access this parameter in the action. Am I missing something ? Thanks in advance, Christoph Breidert Software - Development sitewaerts GmbH Hebelstraße 15 D-76131 Karlsruhe Tel: +49 (721) 920 918 0 Fax: +49 (721) 920 918 29 http://www.sitewaerts.de