Re:
On Fri, 14 Sep 2001, Thierry Cools wrote: > Date: Fri, 14 Sep 2001 15:38:33 +0200 > From: Thierry Cools <[EMAIL PROTECTED]> > Reply-To: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > Subject: > Hi, after a long absence, I'm back again in the struts world ;-) > > I have the following problem, I'd like to add an image on my page, > where the name of this image is stored in the database ( not the image > itself, just the pathlocation and the name); So I've a form bean with > a 'getImagePath()' method that returns a String. > > But the name & property attributes in the img tag are already reserved for multiple >parameters, > so, the question is, how can I get my Image coming from my get method, without using >scriptlets and all that stuff ? > > Thanks for your help, > Thierry Hello Thierry, Welcome back! If your need is to display a different image depending on the user's Locale, this can be satisfied with the "pageKey" or "srcKey" attribute: which looks up "image.key" in the application resources for the user's current Locale. If you need something more generalized (such as images that are personalized per user, independent of Locale), a runtime exression might be your best bet: Craig McClanahan
RE: Application scope objects
The technique that Kimerly describes works well in many environments. In a Servlet2.3 environment (such as Tomcat 4), you also have the option to use an application event listener that is notified when the application is started, and when it is being shut down. For more information, see the Servlet 2.3 specification at: http://java.sun.com/products/servlet/download.html Craig McClanahan On Thu, 13 Sep 2001, MacKellar, Kimberly wrote: > Date: Thu, 13 Sep 2001 16:38:12 -0500 > From: "MacKellar, Kimberly" <[EMAIL PROTECTED]> > Reply-To: [EMAIL PROTECTED] > To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> > Subject: RE: Application scope objects > > I created a servlet that is loaded at server initialization by including the > following in web.xml > > > Initialization > com.tfp.fraudban.InitializationServlet > 1 > > > and in the init method of InitializationServlet I make a call like > > getServletContext().setAttribute("returnTypes", list); > > which saves an ArrayList list into the attribute returnTypes in the > servlet's context. list is being populated by some calls to the database. > > Kim > -Original Message- > From: Debasish Ghosh [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 13, 2001 4:24 PM > To: [EMAIL PROTECTED] > Subject: Application scope objects > > > Hi All - > > In my application, I would like to cache some of the > objects at the application scope in order to reduce > database access. What is the most recommended way of > achieving this in Struts ? Should I make them members > of OurActionServlet, which is derived from > ActionServlet ? > > Please suggest. > > Regards. > > - Debasish > > __ > Terrorist Attacks on U.S. - How can you help? > Donate cash, emergency relief information > http://dailynews.yahoo.com/fc/US/Emergency_Information/ >
template qn
hi all, i'm new to struts and i have a qn on the use of template tag with the tag. i had used the tag to provide content in my template file. however, instead of displaying the text "Welcome" as stored in my MessageResources.properties file it display "" as it is. now shldn't there be a tranlsation of something or did i missed out anything? here's a snippet of my template page: <%@ page language="java" %> <%@ taglib uri="/taglibs/struts-template" prefix="template" %> <%@ taglib uri="/taglibs/struts-bean" prefix="bean" %> and the code for the page that uses this template TIA +trish
Re: dealing with HashMaps instead of beans
I'm almost certain that syntax won't work with Struts 1.0 but mapped properties support has been added to the BeanUtils project and seems likely that it would work with a nightly build of Struts using the latest BeanUtils. Anyone know for sure? I'm sure I'll be in a position to try it out first hand in the very near future though. Erik - Original Message - From: "Paul King" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 20, 2001 9:21 AM Subject: Re: dealing with HashMaps instead of beans > For HashMaps, would a property reference look like the following? > > > > My understanding is that this would translate to product.get("productName"). > That would be fine for extracting data, which is the primary issue. > > paul > > Erik Hatcher wrote: > > > Check out BeanUtils: > > > > http://cvs.apache.org/viewcvs/jakarta-commons/beanutils/src/java/org/apache/ > > commons/beanutils/BeanUtils.java?annotate=1.6 > > > > around line 330 I think this is what you'd need, and its something that > > the Struts tags would need to start using. It might even be sort of already > > in the works by others. Anyone?? > > > > Erik > > > > - Original Message - > > From: "Paul King" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, September 19, 2001 11:29 PM > > Subject: Re: dealing with HashMaps instead of beans > > > > > Thanks Erik. I'm looking for a general solution, so possible changes to > > the > > > Commons code could give me some hope. This would be similar to behavior > > NeXT > > > used to implement to allow generic data bearing objects like HashMaps to > > work > > > interchangeably within their frameworks that managed bean-like objects. > > > > > > In addition to bean:write, I want to be able to use other std tags that > > expect > > > beans (e.g., html:options). Also, there are lots of tables loaded into > > HashMaps > > > in these apps. So... I don't think custom taglibs would be a good fit. > > > > > > paul > > > > > > Erik Hatcher wrote: > > > > > > > It'd only be a few line custom Taglib to write a tag that does a HashMap > > key > > > > lookup. It's not possible with in its current form, > > although > > > > I believe the Commons BeanUtils code has recently been updated to > > include > > > > this kind of lookup, but its not necessary in order to write a simple > > custom > > > > tag. > > > > > > > > Erik > > > > > > > > - Original Message - > > > > From: "Paul King" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]> > > > > Sent: Wednesday, September 19, 2001 4:45 PM > > > > Subject: dealing with HashMaps instead of beans > > > > > > > > > I've encountered 2 jsp apps recently that are passing data around in > > > > > HashMaps instead of java classes with getters and setters. Without > > > > > re-writing everything, I'm trying to use struts to re-write the > > display > > > > > and controller code of these apps, but I haven't found a good way to > > > > > deal with these non-bean HashMaps. I really want to avoid changing > > all > > > > > the model code that deals with HashMaps, but I'd like to use the > > > > > bean-oriented taglibs that struts offers. > > > > > > > > > > Here's an example. The model api provides a getProducts method, which > > > > > returns a List of HashMaps that contain product-related keys > > (productID, > > > > > productName, productDescription, ...). Ideally, I could do something > > > > > like this: > > > > > > > > > > > > > > > productID is > > > > > productName is > > > > > productDescription is > > > > property="productDescription"/> > > > > > > > > > > > > > > > So, is there some trick or workaround to get HashMaps to work in this > > > > > and other cases where beans are expected? I've seen previous threads > > > > > that demonstrate how individual map entries can be accessed as valid > > > > > beans, but that's not the issue here. > > > > > > > > > > Thanks, > > > > > > > > > > paul > > > > > > > > > > > > > > > > > > > > > > >
How do I define the form bean and JSP for this
Hi, I have a situation where I have a collection of Name/Value pairs. I want to define a JSP which will display the Name part of the Nam/Value pair and a text box for Value part of the Name/Value pair. Since this collection of Name/Value pairs could be having dynamically varying no of Name/Value pairs, I do not know how should I create a JSP for this and the corresponding form bean? Please help, this is very urgent. Thanks dd __ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/
RE: a question
Hi Ted, Thanks a lot for pointing it out, I fully agree. We should conform to Struts ActionForm and ActionClass, but that does not mean for every button in the form, we have to use a different form, a different action class. Thanks, Sharon -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 20, 2001 5:30 PM To: [EMAIL PROTECTED] Subject: Re: a question There's no requirement that 3 different pairs of ActionForms and Actions be used. They could just as easily be handled by one. That's an architectural decision that is up to the developer. The greatest advantage is that using an Action can remove scriplets from the JSP. The Action can acquire whatever dynamic data is needed by the JSP and deliver it in the request. This way the JSP can focus on displaying data rather than acquiring it. You can change the way data is displayed without touching the business logic, and, conversely, change the business logic without touching the way data is displayed. The overall design is much cleaner, and IMHO, much easier to document and understand. The Struts Actions are very performant, especially when used to handle a suite of tasks rather than a single purpose. The processing has to take place someplace. It's just a matter of whether you want to mix it all up in the JSP, or move to a specialized object. "Yang, Sharon" wrote: > > Hi, > >If every request to be mapped to an Action class, what advantage of this >approach? >For example, if originally I have 3 buttons within one HTML form in the old >design, >Now I want to change to use 3 different pairs of Struts ActionForm and >ActionClass, just try to gain >the clarity and separation of the logic, I wonder if this would cause a lot >of overhead, or >would this be too cumbersome for WEB designer to figure out. > > Thanks, > > Sharon
Re: a question
There's no requirement that 3 different pairs of ActionForms and Actions be used. They could just as easily be handled by one. That's an architectural decision that is up to the developer. The greatest advantage is that using an Action can remove scriplets from the JSP. The Action can acquire whatever dynamic data is needed by the JSP and deliver it in the request. This way the JSP can focus on displaying data rather than acquiring it. You can change the way data is displayed without touching the business logic, and, conversely, change the business logic without touching the way data is displayed. The overall design is much cleaner, and IMHO, much easier to document and understand. The Struts Actions are very performant, especially when used to handle a suite of tasks rather than a single purpose. The processing has to take place someplace. It's just a matter of whether you want to mix it all up in the JSP, or move to a specialized object. "Yang, Sharon" wrote: > > Hi, > >If every request to be mapped to an Action class, what advantage of this >approach? >For example, if originally I have 3 buttons within one HTML form in the old >design, >Now I want to change to use 3 different pairs of Struts ActionForm and >ActionClass, just try to gain >the clarity and separation of the logic, I wonder if this would cause a lot >of overhead, or >would this be too cumbersome for WEB designer to figure out. > > Thanks, > > Sharon
a question
Hi, If every request to be mapped to an Action class, what advantage of this approach? For example, if originally I have 3 buttons within one HTML form in the old design, Now I want to change to use 3 different pairs of Struts ActionForm and ActionClass, just try to gain the clarity and separation of the logic, I wonder if this would cause a lot of overhead, or would this be too cumbersome for WEB designer to figure out. Thanks, Sharon
style class not rendered for errors
The following setting for error display did not seem to affect eventhough the jsp that contains does link in the style sheet. ANy idea why this is so? Thank you for your response. Thinh in ApplicationResources.properties: errors.header=Errors: errors.footer= in jsp: ... ...
Re: ActionMessages throwing NullPointer and message is in properties??
I was setting messages to null in previous code - thanks for the tip! Matt --- [EMAIL PROTECTED] wrote: > First idea... >ensure that neither messages nor aTimesheetDO is null > > On Thu, 20 September 2001, Matt Raible wrote: > > > > > I am getting a NullPointerException on the following code: > > > > messages.add(new ActionMessage("timesheetManage.reset.success", > > aTimesheetDO.getEmployeeName())); > > > > And in my ApplicationResources.properties file, I have the following entry: > > > > timesheetManage.reset.success=Timesheet for \"{0}\" re-generated > successfully > > from holidays and work profile (if applicable). > > > > Any ideas? > > > > Thanks, > > > > Matt > > > > __ > > Terrorist Attacks on U.S. - How can you help? > > Donate cash, emergency relief information > > http://dailynews.yahoo.com/fc/US/Emergency_Information/ > > -- > Steven Valin > [EMAIL PROTECTED] __ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/
Re: Struts JBoss / Tomcat and From
Title: Struts JBoss / Tomcat and From Why do you use ActionForm as value object in EJB? I thnik, this is not a clean design, since you make your EJB code dependent on Struts. Struts beloongs to the web layer, EJB to the businness layer. Your EJB do not need things like HttpRequest, so'd try to make them independet from the servlet.* package. I'd suggest a simple redesign. Use simple beans as value object and nest them in your action forms. Struts supports nested properties, so will not need to create delegating propertry setters and getters in your action form. (unless you want to do some conversions - ActionForms' properties should be string based, value objects should use the "real" type of the property) -- gR P.S.: Of course it would be nice, if struts.jar could be installed in server scope instead of application scope. I suppose, it would need some changes in the class loading in ActionServlet. - Original Message - From: Nortje, Andrew To: '[EMAIL PROTECTED]' Sent: Thursday, September 20, 2001 10:50 PM Subject: Struts JBoss / Tomcat and From I have deployed my app using JBoss/Tomcat. I recently started using the ActionForm as value objects in my EJB's. JBoss now needs struts.jar in the class path, so it can find ActionForm, so I put sturts.jar in JBOSS_HOME/lib/ext. This works fine put it kills struts. Struts now throws a ClassNotFoundException for my ActionForm's. If I remove the stuts.jar from the JBoss class path JBoss dies and struts works again. Anyone got some advice for me here? Thanks in advance. Andrew This is the exception that get thrown by Tomcat Error: 500 Location: /jazzman/contact/details/address.jsp Internal Servlet Error: javax.servlet.ServletException: Exception creating bean of class com.jazzman.contact.details.view.AddressValue: java.lang.ClassNotFoundException: com.jazzman.contact.details.view.AddressValue at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459) at contact.details._0002fcontact_0002fdetails_0002faddress_0002ejspaddress_jsp_0._jspService(_0002fcontact_0002fdetails_0002faddress_0002ejspaddress_jsp_0.java:409) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at org.apache.tomcat.core.Handler.service(Handler.java:287) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Unknown Source) Root cause: javax.servlet.jsp.JspException: Exception creating bean of class com.jazzman.contact.details.view.AddressValue: java.lang.ClassNotFoundException: com.jazzman.contact.details.view.AddressValue at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:527) at contact.details._0002fcontact_0002fdetails_0002faddress_0002ejspaddress_jsp_0._jspService(_0002fcontact_0002fdetails_0002faddress_0002ejspaddress_jsp_0.java:95) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper
Struts and Websphere Test Environment 3.5.3
Hi All, Has anyone been able to get the Struts examples to run under the Websphere Test Environment in VisualAge for Java v3.5.3? Which configuration files need to be adjusted? What are the steps you took? I am getting a HTTP error 503 when trying to run the examples? I have been referencing an article that I found on the IBM website from Kyle Brown that tells the necessary steps. However, I have been unsuccessful. Thanks. Bye. Tedie West Product Development eBreviate Office: 972-797-9262 [EMAIL PROTECTED]
Re: Implementation of Synchronizer Token
Many thanks Ted for a point in the right direction. I'll let you know what I come up with. Steve On Thu, 20 September 2001, Ted Husted wrote: > > It's not mentioned in the UserGuide, which is an oversight. It is used > in the Examples application. The implementation is part of the Action. > > http://jakarta.apache.org/struts/api/org/apache/struts/action/Action.html > > If you find a good place to insert coverage in the Users Guide, don't > hesitate to provide a "patch" that we could plug into the documentation > ;-) > > -- Ted Husted, Husted dot Com, Fairport NY USA. > -- Custom Software ~ Technical Services. > -- Tel +1 716 737-3463 > -- http://www.husted.com/about/struts/ > > > [EMAIL PROTECTED] wrote: > > > > The Struts documentation doesn't seem to indicate that Struts provides an >implementation of the Synchronizer Token described on p.77 of Core J2EE Patterns. > > > > Can somebody tell me if I have overlooked something in the documentation? > > > > If I haven't, does anybody have any suggestions for a custom Synchronizer Token >implementation for use within a Struts-based web app? > > > > TIA, Steve > > > > -- > > Steven Valin > > [EMAIL PROTECTED] -- Steven Valin [EMAIL PROTECTED]
RE: indexed attribute on TextTag not in tld
Download a nightly build from the past month or so, they have been recently included. Heidi -Original Message- From: Paap, Keith [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 20, 2001 4:57 PM To: [EMAIL PROTECTED] Subject: indexed attribute on TextTag not in tld I'm trying to use the 'indexed' attribute on the html:text tag and I receive the following error: Parse Error in JSP page: The attribute 'indexed' for custom tag 'text' on line '46' of page '/jsp/map/setup/updateObjectives.jsp' is not declared as an attribute for this tag, perhaps it should be added to the TLD. I'm using Struts 1.0 and had downloaded the binaries rather than attempting to go through the work of building from the source. The indexed attribute does show as a valid attribute the API documentation but the error is correct, it is not in the tld. Does the 1.0 version not include that attribute? I did find the source at http://husted.com/about/struts/indexed-tags.htm that involves this change. Is my only chance of using the indexed property mean I need to go get the source for 1.0 and then apply those changes and rebuild? I have not done a build of the Struts source so any direction someone could provide would be most appreciated. I also have not yet gone through the work of getting familiar with ant. TIA, Keith Paap
indexed attribute on TextTag not in tld
I'm trying to use the 'indexed' attribute on the html:text tag and I receive the following error: Parse Error in JSP page: The attribute 'indexed' for custom tag 'text' on line '46' of page '/jsp/map/setup/updateObjectives.jsp' is not declared as an attribute for this tag, perhaps it should be added to the TLD. I'm using Struts 1.0 and had downloaded the binaries rather than attempting to go through the work of building from the source. The indexed attribute does show as a valid attribute the API documentation but the error is correct, it is not in the tld. Does the 1.0 version not include that attribute? I did find the source at http://husted.com/about/struts/indexed-tags.htm that involves this change. Is my only chance of using the indexed property mean I need to go get the source for 1.0 and then apply those changes and rebuild? I have not done a build of the Struts source so any direction someone could provide would be most appreciated. I also have not yet gone through the work of getting familiar with ant. TIA, Keith Paap
Struts JBoss / Tomcat and From
Title: Struts JBoss / Tomcat and From I have deployed my app using JBoss/Tomcat. I recently started using the ActionForm as value objects in my EJB's. JBoss now needs struts.jar in the class path, so it can find ActionForm, so I put sturts.jar in JBOSS_HOME/lib/ext. This works fine put it kills struts. Struts now throws a ClassNotFoundException for my ActionForm's. If I remove the stuts.jar from the JBoss class path JBoss dies and struts works again. Anyone got some advice for me here? Thanks in advance. Andrew This is the exception that get thrown by Tomcat Error: 500 Location: /jazzman/contact/details/address.jsp Internal Servlet Error: javax.servlet.ServletException: Exception creating bean of class com.jazzman.contact.details.view.AddressValue: java.lang.ClassNotFoundException: com.jazzman.contact.details.view.AddressValue at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459) at contact.details._0002fcontact_0002fdetails_0002faddress_0002ejspaddress_jsp_0._jspService(_0002fcontact_0002fdetails_0002faddress_0002ejspaddress_jsp_0.java:409) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at org.apache.tomcat.core.Handler.service(Handler.java:287) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Unknown Source) Root cause: javax.servlet.jsp.JspException: Exception creating bean of class com.jazzman.contact.details.view.AddressValue: java.lang.ClassNotFoundException: com.jazzman.contact.details.view.AddressValue at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:527) at contact.details._0002fcontact_0002fdetails_0002faddress_0002ejspaddress_jsp_0._jspService(_0002fcontact_0002fdetails_0002faddress_0002ejspaddress_jsp_0.java:95) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at org.apache.tomcat.core.Handler.service(Handler.java:287) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Unknown Source)
Re: Implementation of Synchronizer Token
It's not mentioned in the UserGuide, which is an oversight. It is used in the Examples application. The implementation is part of the Action. http://jakarta.apache.org/struts/api/org/apache/struts/action/Action.html If you find a good place to insert coverage in the Users Guide, don't hesitate to provide a "patch" that we could plug into the documentation ;-) -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ [EMAIL PROTECTED] wrote: > > The Struts documentation doesn't seem to indicate that Struts provides an >implementation of the Synchronizer Token described on p.77 of Core J2EE Patterns. > > Can somebody tell me if I have overlooked something in the documentation? > > If I haven't, does anybody have any suggestions for a custom Synchronizer Token >implementation for use within a Struts-based web app? > > TIA, Steve > > -- > Steven Valin > [EMAIL PROTECTED]
RE: [ANNOUNCE] Struts Console
That is why I always use a PrintWriter instead. java.io.StringWriter sw = new java.io.StringWriter(); java.io.PrintWriter out = new java.io.PrintWriter(sw); out.println("Hello Sailor!"); out.println("Hello World!"); String result = sw.toString(); -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 13, 2001 7:39 AM To: [EMAIL PROTECTED] Subject: Re: [ANNOUNCE] Struts Console I concur that this is off to a nice start and should be useful to many people. If you want to tailor the EOL for the particular platform (you may already know this) you can append System.getProperties().getProperty("line.separator") to the end of each line instead of hardcoding '\n' or "\r\n". On Thu, 13 September 2001, Bill Clinton wrote: > > Hello, > It ran fine under Redhat 7.1, other than a bunch of missing font > messages. I personally did not like the way it reformatted my entire > struts-config. Could this be because it is not interpreting unix text > file format correctly, or does it do this on windows too? Also, it put > a bunch of ^Ms in my file which is an annoying, but somewhat common > occurance when viewing dos/windoze text files in unix. > I personally would not have any need for a program like this. I am > more comfortable editing a well commented xml file. But everbody is > different and many people might find this very useful. It looks like > you have done a very nice job so far - keep up the good work! > > Bill > > James Holmes wrote: > > >I have put together a GUI for Struts called Struts > >Console. Struts Console is a Java Swing based > >application for managing Struts configuration files. > > > >Struts Console is availbale at: > >http://www.geocities.com/jholmes612/ > > > >Just unpack the zip file and view the README for > >details on running Struts Console. > > > >I'd like to get people's feedback and find out what > >they like/dislike, what they would add/remove or > >anything else you think about the tool. > > > >I'd like to see this tool evolve into "the" struts GUI > >app and be part of the standard struts distribution. > > > >Thanks, > > > >James Holmes > >[EMAIL PROTECTED] > > > >__ > >Do You Yahoo!? > >Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger > >http://im.yahoo.com > > > >. > > -- Steven Valin [EMAIL PROTECTED]
Implementation of Synchronizer Token
The Struts documentation doesn't seem to indicate that Struts provides an implementation of the Synchronizer Token described on p.77 of Core J2EE Patterns. Can somebody tell me if I have overlooked something in the documentation? If I haven't, does anybody have any suggestions for a custom Synchronizer Token implementation for use within a Struts-based web app? TIA, Steve -- Steven Valin [EMAIL PROTECTED]
Re: ActionMessages throwing NullPointer and message is in properties??
First idea... ensure that neither messages nor aTimesheetDO is null On Thu, 20 September 2001, Matt Raible wrote: > > I am getting a NullPointerException on the following code: > > messages.add(new ActionMessage("timesheetManage.reset.success", > aTimesheetDO.getEmployeeName())); > > And in my ApplicationResources.properties file, I have the following entry: > > timesheetManage.reset.success=Timesheet for \"{0}\" re-generated successfully > from holidays and work profile (if applicable). > > Any ideas? > > Thanks, > > Matt > > __ > Terrorist Attacks on U.S. - How can you help? > Donate cash, emergency relief information > http://dailynews.yahoo.com/fc/US/Emergency_Information/ -- Steven Valin [EMAIL PROTECTED]
ActionMessages throwing NullPointer and message is in properties??
I am getting a NullPointerException on the following code: messages.add(new ActionMessage("timesheetManage.reset.success", aTimesheetDO.getEmployeeName())); And in my ApplicationResources.properties file, I have the following entry: timesheetManage.reset.success=Timesheet for \"{0}\" re-generated successfully from holidays and work profile (if applicable). Any ideas? Thanks, Matt __ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/
Re: Navigation history
One implementation has been to subclass the Action object with another object (named something like OurGeneralAction). All of your other Action objects, such as LogonAction, LogoffAction, DoSomethingAction then subclass OurGeneralAction. Just prior to returning an ActionForward from your specific Actions (Logon, Logoff, etc.) you call a doBreadCrumb(String actionFwdName, HttpSession session) method that is contained in OurGeneralAction. doBreadCrumb() looks in the session object for another class (perhaps called BreadCrumbs) that push or pop the actionFwdName from a stack. That stack can then be used from a JSP using logic:iterate and bean:write to display the list of "bread crumbs". There are a variety of details and complexities that are left out of this description, such as how you determine whether to push to, or pop from the stack, the exact text to display for each bread crumb, etc. However, the general idea is represented. On Thu, 20 September 2001, "Thinh Doan" wrote: > > Would you please give me some ideas on how to implement a bread crumb scheme > to keep track of where the user has been navigated around the application? > Each menu has been implemented with a html:link with a forward name in the > global-forwards definitions in struts-config.xml. > > I'm planning to have a designate area on the template for this. It'd nice > to retrieve the navigation history w/o resorting to scriptlets. > > Thank you very much for your suggestions. > > Thinh -- Steven Valin [EMAIL PROTECTED]
Navigation history
Would you please give me some ideas on how to implement a bread crumb scheme to keep track of where the user has been navigated around the application? Each menu has been implemented with a html:link with a forward name in the global-forwards definitions in struts-config.xml. I'm planning to have a designate area on the template for this. It'd nice to retrieve the navigation history w/o resorting to scriptlets. Thank you very much for your suggestions. Thinh
Mixing indexed displays and forms
I am running into a road block in my development and I would appreciate any feedback on the approach and decisions that I have made thus far in my design. I briefly looked through the struts-catalog on Husted.com and through the mail archives but I have not seen anything that addresses these issues. I am using indexed struts HTML tags to fill in my form values. I need to create a Form that has Collection of Products displayed. The Collection size is dependant on values from the database and I am creating a Bean for Read-Only to hold that data. I have created an ActionForm to hold the data that I am going to write back to the system. The problem I am having is lining up the iterations so that I can read from the Read Bean and write to the Form Bean at the same time. 1) Should I be doing it this way or is there some other design approach I should take? Do I want to be mixing the Read Bean and the Write Bean? 2) Has anyone else done this and do they have code that I can look at? Thanks in advance, Heidi
Re: Validator going into infinite loop
I didn't pay attention that you had your input set to the action. Since you had valdiate="true", it would try to validate before the Action's perform method was called, but if validation failed it would try to go to the action again. So it would validate, fail, go to the action, etc. David --- Mike Bridge <[EMAIL PROTECTED]> wrote: > Hi David, > > I'm using Struts_Validator-2001100702.jar with > Struts 1.0. > > I am confused about how to make this work, so I > turned the > automatic validation off and validated it manually > in my Action > class, the same way as in the multipage form > example. > > I'm not sure where I went wrong, but I had troubles > setting it > up with input="/survey.do". Validation worked when > I set > input="/survey.jsp". > > -Mike > > > On Thu, Sep 20, 2001 at 08:08:05AM -0700, David > Winterfeldt wrote: > > What version of Struts are you using and what > version > > of the Validator? > > > > David > > > > > > > > 5) copied the tld and the > > > Struts_Validator-20010702.jar > > -- > Mike Bridge > <[EMAIL PROTECTED]> __ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/
RE: Several Data-Sources in struts-config.xml
Look at struts-config.dtd. It documents the required attributes. The one you are looking for seems to be 'key'. Mark -Original Message- From: David Corbin [mailto:[EMAIL PROTECTED]] Sent: 20 September 2001 15:36 To: [EMAIL PROTECTED] Subject: Re: Several Data-Sources in struts-config.xml I would have guessed, that instead of " To: <[EMAIL PROTECTED]> Sent: Thursday, September 20, 2001 9:15 AM Subject: Several Data-Sources in struts-config.xml Hi All, how can I define more than one data-source for one struts-application? I want to read data from two separate databases in one application. I tried it this way: the Java-Coding to find the data-source was: dataSource1 = servlet.findDataSource( "ds1" ); dataSource2 = servlet.findDataSource( "ds2" ); But it did not work. Do you have an idea? Thanks Arkadiusz *** This email message contains confidential information for the above addressee only. If you are not the intended addressee you must not disclose or use the information in any manner whatsoever. Any opinion or views contained in this email message are those of the sender, do not represent those of the Company in any way and reliance should not be placed upon its contents. Unless otherwise stated this email message is not intended to be contractually binding. Where an Agreement exists between our respective companies and there is conflict between the contents of this email message and the Agreement then the terms of that Agreement shall prevail. Abbey National Treasury Services plc. Registered in England. Registered Office: Abbey House, Baker Street, London NW1 6XL. Company Registration No: 2338548. Regulated by the SFA ***
Re: Several Data-Sources in struts-config.xml
I would have guessed, that instead of " To: <[EMAIL PROTECTED]> Sent: Thursday, September 20, 2001 9:15 AM Subject: Several Data-Sources in struts-config.xml Hi All, how can I define more than one data-source for one struts-application? I want to read data from two separate databases in one application. I tried it this way: the Java-Coding to find the data-source was: dataSource1 = servlet.findDataSource( "ds1" ); dataSource2 = servlet.findDataSource( "ds2" ); But it did not work. Do you have an idea? Thanks Arkadiusz
Re: Validator going into infinite loop
Hi David, I'm using Struts_Validator-2001100702.jar with Struts 1.0. I am confused about how to make this work, so I turned the automatic validation off and validated it manually in my Action class, the same way as in the multipage form example. I'm not sure where I went wrong, but I had troubles setting it up with input="/survey.do". Validation worked when I set input="/survey.jsp". -Mike On Thu, Sep 20, 2001 at 08:08:05AM -0700, David Winterfeldt wrote: > What version of Struts are you using and what version > of the Validator? > > David > > > > > 5) copied the tld and the > > Struts_Validator-20010702.jar -- Mike Bridge <[EMAIL PROTECTED]>
Re: Validator going into infinite loop
What version of Struts are you using and what version of the Validator? David --- Mike Bridge <[EMAIL PROTECTED]> wrote: > Hi- > > When I submit (or access) a ValidatorForm, it goes > into an infinite > loop. I had this working with 0.5, but after > upgrading, it doesn't > seem to function any more. I've done the following > to set it up: > > 1) set up a validator.xml from the example, removing > the existing bean > definition and adding: > > > > depends="required"> > > > depends="required"> > > > depends="required,email"> > > > > > > 2) Added the following to my struts-config.xml > > > > type="ca.oldring.forms.SurveyForm"/> > > > > path="/survey1.jsp?language=en"/> > path="/survey1.jsp?language=fr"/> > > > > > > > type="ca.oldring.actions.SurveyAction" >name="surveyForm" > scope="request" >validate="true" > input="/survey.do"> > > > > > 3) Made a bean "SurveyForm" with generic get and set > methods > > 4) Set up web.xml: > > > > validator > > com.wintecinc.struts.action.ValidatorServlet > > >config > > /WEB-INF/validation.xml > > >debug >2 > > 3 > > > 5) copied the tld and the > Struts_Validator-20010702.jar > > > When I access the "survey.do" file, the tomcat > servlet log gives > me this until java segfaults: > > 2001-09-17 16:53:40 - path="/survey" :action: > Processing a GET for /survey > 2001-09-17 16:53:40 - path="/survey" :action: > Setting locale 'en' > 2001-09-17 16:53:40 - path="/survey" :action: > Looking for ActionForm bean under attribute > 'surveyForm' > 2001-09-17 16:53:40 - path="/survey" :action: > Creating new ActionForm instance of class > 'ca.oldring.forms.SurveyForm' > 2001-09-17 16:53:40 - path="/survey" :action: > Storing instance under attribute 'surveyForm' in > scope 'request' > 2001-09-17 16:53:40 - path="/survey" :action: > Populating bean properties from this request > 2001-09-17 16:53:40 - path="/survey" :action: > Validating input form properties > 2001-09-17 16:53:40 - path="/survey" :action: > Validation error(s), redirecting to: /survey.do > 2001-09-17 16:53:40 - path="/survey" :action: > Processing a GET for /survey > ... > > Any ideas on why this is looping? It doesn't appear > to be reaching my > Action class. > > Thanks, > > -Mike > > > -- > Mike Bridge > <[EMAIL PROTECTED]> __ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/
AW: AW: AW: Digister
What is wrong mith those classes ? If I debug Digister in "startElement"-Methode the "localName" is rss? Thanks - package de.tecmath.cms.util.ejb.valueobjectholder.conf; import java.util.*; import org.apache.commons.digester.Digester; import java.net.*; import java.io.*; /** * Insert the type's description here. * Creation date: (20.09.2001 13:06:05) * @author: */ public class ConfigurationReader extends ValueObjectEntry { private java.io.InputStream config; public Digester parser; public final static java.lang.String configClass = "de.tecmath.cms.util.ejb.valueobjectholder.conf.ValueObjectHolderConf"; public final static java.lang.String valueObjectEntryClass = "de.tecmath.cms.util.ejb.valueobjectholder.conf.ValueObjectEntry"; private ValueObjectHolderConf vos; private ValueObjectEntry voe; /** * ConfigurationReader constructor comment. */ public ConfigurationReader() { super(); this.parser = new Digester(); this.vos = new ValueObjectHolderConf(); this.init(); } /** * Insert the method's description here. * Creation date: (20.09.2001 15:53:36) * @param vo de.tecmath.cms.util.ejb.valueobjectholder.conf.ValueObjectEntry */ public void addValueObjectEntry(ValueObjectEntry vo) { //this.vos.addValueObjectEntry(vo); this.voe = vo; } /** * Insert the method's description here. * Creation date: (20.09.2001 13:17:03) */ private void init() { parser.push(this); parser.setDebug(3); parser.setValidating(false); parser.addObjectCreate("configuration/valueobject", valueObjectEntryClass); parser.addSetProperties("configuration/valueobject"); parser.addSetNext("configuration/valueobject", "addValueObjectEntry"); } /** * Insert the method's description here. * Creation date: (20.09.2001 13:08:42) */ public Object parseConfig() throws IOException, org.xml.sax.SAXException, Exception{ if(this.config != null) return parser.parse( new BufferedInputStream(this.config)); else throw new Exception("No configuration-file readed"); } /** * Insert the method's description here. * Creation date: (20.09.2001 13:08:42) */ public Object parseConfig(String path) throws FileNotFoundException , IOException, org.xml.sax.SAXException, Exception { this.readConfiguration(path); return this.parseConfig(); } /** * Insert the method's description here. * Creation date: (20.09.2001 13:07:14) * @param path java.lang.String */ public void readConfiguration(String path) throws FileNotFoundException { config = new java.io.FileInputStream("d:\\rss-example.xml"); } } package de.tecmath.cms.util.ejb.valueobjectholder.conf; /** * Insert the type's description here. * Creation date: (20.09.2001 12:59:02) * @author: */ public class ValueObjectEntry { private java.lang.String name; private java.lang.String pkgName; /** * ValueObjectEntry constructor comment. */ public ValueObjectEntry() { super(); } /** * Insert the method's description here. * Creation date: (20.09.2001 13:02:39) * @return java.lang.String */ public java.lang.String getName() { return name; } /** * Insert the method's description here. * Creation date: (20.09.2001 13:02:48) * @return java.lang.String */ public java.lang.String getPkgName() { return pkgName; } /** * Insert the method's description here. * Creation date: (20.09.2001 13:02:39) * @param newName java.lang.String */ public void setName(java.lang.String newName) { name = newName; } /** * Insert the method's description here. * Creation date: (20.09.2001 13:02:48) * @param newPkgName java.lang.String */ public void setPkgName(java.lang.String newPkgName) { pkgName = newPkgName; } } - -Ursprungliche Nachricht- Von: Ted Husted [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 20. September 2001 16:03 An: [EMAIL PROTECTED] Betreff: Re: AW: AW: Digister The only documentation I know about is the package.html file in the SOURCE distribution (repeat SOURCE distribution). Like all of Craig's Javadocs, it does tell you most of you what you need to know to get started. storck wrote: > > Thanks > That has helped a litle, but doesnt their exists a documentation where it is > explained when to use wich methodes of digister ? (maybe a stupid question, > but it is very new for me)
RE: Links versus forms and Struts
Actually I just tried it with no problems. Here is what the HTML looked like: Tes t Link The data went through the ActionForm.validate and through the Action.perform and ended up on my result page. No problem! Erich -Original Message- From: Kilmer, Erich [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 20, 2001 9:33 AM To: [EMAIL PROTECTED] Subject: Links versus forms and Struts In our current application which is Model 1 architecture, many screen transitions are initiated by links instead of forms. These links many times are appended with query strings with name/value pairs of parameters that give context to the next page. These links could be used with Struts right? I mean, the ActionForm wouldn't probably be used since the query string was hard coded from a previous JSP (although I guess it wouldn't hurt to check). The part that would obviously be good would be the Action class to call the business logic for the next screen down the line. So how would the struts-config.xml action mapping look? There would still be a path, a type, a scope, an input (the page the link was located), and a success/failure forwards. >From my server log i see: "GET /struts-test/input.jsp HTTP/1.1" but no query string. What would the query string look like? Next Page Can I connect to Struts from links with query strings instead of forms? Thanks for your help! Erich Kilmer Bell+Howell
Re: AW: AW: Digister
The only documentation I know about is the package.html file in the SOURCE distribution (repeat SOURCE distribution). Like all of Craig's Javadocs, it does tell you most of you what you need to know to get started. storck wrote: > > Thanks > That has helped a litle, but doesnt their exists a documentation where it is > explained when to use wich methodes of digister ? (maybe a stupid question, > but it is very new for me)
AW: AW: Digister
Thanks That has helped a litle, but doesnt their exists a documentation where it is explained when to use wich methodes of digister ? (maybe a stupid question, but it is very new for me) -Ursprungliche Nachricht- Von: Ted Husted [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 20. September 2001 15:32 An: [EMAIL PROTECTED] Betreff: Re: AW: Digister I've used the RSS package to parse a RSS file, but haven't written any of my own rules. To parse a RSS file, it goes like this: /** * Read and parse RSS file found at a given * path, save the Channel bean in request scope, * and forward to "continue". * @expects path={uri} on command line or as parameter property to ActionMapping. * @expects an input page or error forwarding if exception digesting RSS * @author Ted Husted * @version $Revision:1.1 $ $Date: 2000/09/05 $ */ public final class Fetch extends Action { // - Instances Variables // - Public Methods /** * Request attribute key for saving Channel bean */ public static final String CHANNEL_KEY = "CHANNEL"; /** * Main process of class. Reads, parses */ public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionErrors errors = new ActionErrors(); Channel channel = null; String path = request.getParameter("path"); if (path==null) path = mapping.getParameter(); try { RSSDigester digester = new RSSDigester(); channel = (Channel) digester.parse(path); } catch (Throwable t) { errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("rss.access.error")); servlet.log(t.toString()); } // -- Handle Errors --- if (!errors.empty()) { saveErrors(request, errors); if (mapping.getInput()!=null) return (new ActionForward(mapping.getInput())); // If no input page, use error forwarding return (mapping.findForward("error")); } // -- Save Bean, and Continue --- request.setAttribute(CHANNEL_KEY,channel); return (mapping.findForward("continue")); } // End perform } // End Fetch storck wrote: > > Do you have used digister by your own? > > -Ursprungliche Nachricht- > Von: Ted Husted [mailto:archive@jab.org] > Gesendet: Donnerstag, 20. September 2001 14:32 > An: [EMAIL PROTECTED] > Betreff: Re: Digister > > Look for the package.html file in the SOURCE distribution, or in the > digester package in the 1.0 Struts source distribution. > > For an example, look at the RSS package (and, well, Struts). > > -- Ted Husted, Husted dot Com, Fairport NY USA. > -- Custom Software ~ Technical Services. > -- Tel +1 716 737-3463 > -- http://www.husted.com/about/struts/ > > storck wrote: > > > > HI, > > > > I try to use use digister from org.apache.commons.digester by my own but > > without luck. > > Does any doc exist to digister or any "How To" ? > > > > Thanks! -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/
Links versus forms and Struts
In our current application which is Model 1 architecture, many screen transitions are initiated by links instead of forms. These links many times are appended with query strings with name/value pairs of parameters that give context to the next page. These links could be used with Struts right? I mean, the ActionForm wouldn't probably be used since the query string was hard coded from a previous JSP (although I guess it wouldn't hurt to check). The part that would obviously be good would be the Action class to call the business logic for the next screen down the line. So how would the struts-config.xml action mapping look? There would still be a path, a type, a scope, an input (the page the link was located), and a success/failure forwards. >From my server log i see: "GET /struts-test/input.jsp HTTP/1.1" but no query string. What would the query string look like? Next Page Can I connect to Struts from links with query strings instead of forms? Thanks for your help! Erich Kilmer Bell+Howell
Re: AW: Digister
I've used the RSS package to parse a RSS file, but haven't written any of my own rules. To parse a RSS file, it goes like this: /** * Read and parse RSS file found at a given * path, save the Channel bean in request scope, * and forward to "continue". * @expects path={uri} on command line or as parameter property to ActionMapping. * @expects an input page or error forwarding if exception digesting RSS * @author Ted Husted * @version $Revision:1.1 $ $Date: 2000/09/05 $ */ public final class Fetch extends Action { // - Instances Variables // - Public Methods /** * Request attribute key for saving Channel bean */ public static final String CHANNEL_KEY = "CHANNEL"; /** * Main process of class. Reads, parses */ public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionErrors errors = new ActionErrors(); Channel channel = null; String path = request.getParameter("path"); if (path==null) path = mapping.getParameter(); try { RSSDigester digester = new RSSDigester(); channel = (Channel) digester.parse(path); } catch (Throwable t) { errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("rss.access.error")); servlet.log(t.toString()); } // -- Handle Errors --- if (!errors.empty()) { saveErrors(request, errors); if (mapping.getInput()!=null) return (new ActionForward(mapping.getInput())); // If no input page, use error forwarding return (mapping.findForward("error")); } // -- Save Bean, and Continue --- request.setAttribute(CHANNEL_KEY,channel); return (mapping.findForward("continue")); } // End perform } // End Fetch storck wrote: > > Do you have used digister by your own? > > -Ursprungliche Nachricht- > Von: Ted Husted [mailto:archive@jab.org] > Gesendet: Donnerstag, 20. September 2001 14:32 > An: [EMAIL PROTECTED] > Betreff: Re: Digister > > Look for the package.html file in the SOURCE distribution, or in the > digester package in the 1.0 Struts source distribution. > > For an example, look at the RSS package (and, well, Struts). > > -- Ted Husted, Husted dot Com, Fairport NY USA. > -- Custom Software ~ Technical Services. > -- Tel +1 716 737-3463 > -- http://www.husted.com/about/struts/ > > storck wrote: > > > > HI, > > > > I try to use use digister from org.apache.commons.digester by my own but > > without luck. > > Does any doc exist to digister or any "How To" ? > > > > Thanks! -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/
RE: Digister
Here is a sample use of the digester. //== ConfigMaker.java package isMan.util; import java.io.Serializable; import java.io.InputStream; import java.io.FileInputStream; import java.io.BufferedInputStream; import org.apache.struts.digester.Digester; public class ConfigMaker { public ConfigMaker() throws Exception { loadConf(); } public ConfigMaker(String path) throws Exception { this.configPath = path; loadConf(); } //-- -- /** * The resource path of our persistent database storage file. */ private String configPath = null; /** * The debugging detail level for the XML digester. */ private int debug = 0; /** * The resource path of our persistent database storage file. */ private Config config = null; public Config giveConfig(){ return this.config; } public void makeConfig(Config config){ this.config = config; } //+ private void loadConf() throws Exception { // Acquire an input stream to our config file InputStream is = new FileInputStream(configPath); if (is == null) { System.out.println("No such resource available - loading empty database"); return; } BufferedInputStream bis = new BufferedInputStream(is); // Construct a digester to use for parsing Digester digester = new Digester(); digester.push(this); digester.setDebug(debug); digester.setValidating(false); digester.addObjectCreate("isMan/database", "isMan.util.Config"); digester.addSetProperties("isMan/database"); digester.addSetNext("isMan/database", "makeConfig"); digester.parse(bis); bis.close(); } } //== End: ConfigMaker.java the xml file this is parsin looks like this: the Config bean: //== Begin: Config.java package isMan.util; import java.io.Serializable; public class Config implements Serializable { private String databaseName=null; private String userTableName=null; private String userTableIDName=null; private String jdbcPoolName=null; private String daoPrefix= "isMan.dao"; private String daoSuffix= "DAO"; //+ public Config() { } public String getDatabaseName(){ return(databaseName); } public void setDatabaseName(String name){ this.databaseName = name; } public String getUserTableName(){ return(userTableName); } public void setUserTableName(String name){ this.userTableName = name; } public String getUserTableIDName(){ return(userTableIDName); } public void setUserTableIDName(String name) { this.userTableIDName = name; } public String getJdbcPoolName(){ return(jdbcPoolName); } public void setJdbcPoolName(String name){ this.jdbcPoolName = name; } public String getDaoPrefix(){ return(daoPrefix); } public void setDaoPrefix(String prefix){ this.daoPrefix = prefix; } public String getDaoSuffix(){ return(daoSuffix); } public void setDaoSuffix(String suffix){ this.daoSuffix = suffix; } } //== End: Config.java Hope that helped. cioa. -Original Message- From: storck [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 20, 2001 8:51 AM To: [EMAIL PROTECTED] Subject: AW: Digister Do you have used digister by your own? -Ursprungliche Nachricht- Von: Ted Husted [mailto:archive@jab.org] Gesendet: Donnerstag, 20. September 2001 14:32 An: [EMAIL PROTECTED] Betreff: Re: Digister Look for the package.html file in the SOURCE distribution, or in the digester package in the 1.0 Struts source distribution. For an example, look at the RSS package (and, well, Struts). -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ storck wrote: > > HI, > > I try to use use digister from org.apache.commons.digester by my own but > without luck. > Does any doc exist to digister or any "How To" ? > > Thanks!
Re: dealing with HashMaps instead of beans
For HashMaps, would a property reference look like the following? My understanding is that this would translate to product.get("productName"). That would be fine for extracting data, which is the primary issue. paul Erik Hatcher wrote: > Check out BeanUtils: > > http://cvs.apache.org/viewcvs/jakarta-commons/beanutils/src/java/org/apache/ > commons/beanutils/BeanUtils.java?annotate=1.6 > > around line 330 I think this is what you'd need, and its something that > the Struts tags would need to start using. It might even be sort of already > in the works by others. Anyone?? > > Erik > > - Original Message - > From: "Paul King" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, September 19, 2001 11:29 PM > Subject: Re: dealing with HashMaps instead of beans > > > Thanks Erik. I'm looking for a general solution, so possible changes to > the > > Commons code could give me some hope. This would be similar to behavior > NeXT > > used to implement to allow generic data bearing objects like HashMaps to > work > > interchangeably within their frameworks that managed bean-like objects. > > > > In addition to bean:write, I want to be able to use other std tags that > expect > > beans (e.g., html:options). Also, there are lots of tables loaded into > HashMaps > > in these apps. So... I don't think custom taglibs would be a good fit. > > > > paul > > > > Erik Hatcher wrote: > > > > > It'd only be a few line custom Taglib to write a tag that does a HashMap > key > > > lookup. It's not possible with in its current form, > although > > > I believe the Commons BeanUtils code has recently been updated to > include > > > this kind of lookup, but its not necessary in order to write a simple > custom > > > tag. > > > > > > Erik > > > > > > - Original Message - > > > From: "Paul King" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Wednesday, September 19, 2001 4:45 PM > > > Subject: dealing with HashMaps instead of beans > > > > > > > I've encountered 2 jsp apps recently that are passing data around in > > > > HashMaps instead of java classes with getters and setters. Without > > > > re-writing everything, I'm trying to use struts to re-write the > display > > > > and controller code of these apps, but I haven't found a good way to > > > > deal with these non-bean HashMaps. I really want to avoid changing > all > > > > the model code that deals with HashMaps, but I'd like to use the > > > > bean-oriented taglibs that struts offers. > > > > > > > > Here's an example. The model api provides a getProducts method, which > > > > returns a List of HashMaps that contain product-related keys > (productID, > > > > productName, productDescription, ...). Ideally, I could do something > > > > like this: > > > > > > > > > > > > productID is > > > > productName is > > > > productDescription is > > > property="productDescription"/> > > > > > > > > > > > > So, is there some trick or workaround to get HashMaps to work in this > > > > and other cases where beans are expected? I've seen previous threads > > > > that demonstrate how individual map entries can be accessed as valid > > > > beans, but that's not the issue here. > > > > > > > > Thanks, > > > > > > > > paul > > > > > > > > > > > > > > > >
Several Data-Sources in struts-config.xml
Hi All, how can I define more than one data-source for one struts-application? I want to read data from two separate databases in one application. I tried it this way: description="Data Source Description" driverClass="org.gjt.mm.mysql.Driver" password="*" url="jdbc:mysql://localhost:3306/develop" user="*" /> the Java-Coding to find the data-source was: dataSource1 = servlet.findDataSource( "ds1" ); dataSource2 = servlet.findDataSource( "ds2" ); But it did not work. Do you have an idea? Thanks Arkadiusz
AW: Digister
Do you have used digister by your own? -Ursprungliche Nachricht- Von: Ted Husted [mailto:archive@jab.org] Gesendet: Donnerstag, 20. September 2001 14:32 An: [EMAIL PROTECTED] Betreff: Re: Digister Look for the package.html file in the SOURCE distribution, or in the digester package in the 1.0 Struts source distribution. For an example, look at the RSS package (and, well, Struts). -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ storck wrote: > > HI, > > I try to use use digister from org.apache.commons.digester by my own but > without luck. > Does any doc exist to digister or any "How To" ? > > Thanks!
Re: ActionForm
the user guide and java docs are always a good place to start: http://jakarta.apache.org/struts/userGuide/building_model.html#actionform http://jakarta.apache.org/struts/api/index.html "Eydelman, Andriy" wrote: > > > Hi,All > sorry for stupid question, I'm just a novice in Struts > > What is a purpose of org.apache.struts.action.ActionForm > and its' subclasses and their using with Actions? > Where can I find documentation about it? > > Eydelman Andrey
ActionForm
Title: ActionForm Hi,All sorry for stupid question, I'm just a novice in Struts What is a purpose of org.apache.struts.action.ActionForm and its' subclasses and their using with Actions? Where can I find documentation about it? Eydelman Andrey
Re: Digister
Look for the package.html file in the SOURCE distribution, or in the digester package in the 1.0 Struts source distribution. For an example, look at the RSS package (and, well, Struts). -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ storck wrote: > > HI, > > I try to use use digister from org.apache.commons.digester by my own but > without luck. > Does any doc exist to digister or any "How To" ? > > Thanks!
RE: logic:equal and dynamic value
Nope: 2001-09-20 06:25:57 - error-the file '\WEB-INF\pages\resourceWorkProfileManage.jsp' generated the following parse exception: org.apache.jasper.compiler.CompileException: C:\iPlanet\iPM6\ias\APPS\timetracker\timetracker\WEB-INF\pages\resourceWorkProfileManage.jsp(255,12) According to the TLD attribute value is mandatory for tag equal --- Sean Gollschewsky <[EMAIL PROTECTED]> wrote: > Can't you use > > property="workSchedule$WorkScheduleEid" parameter="wsId"> > > to save having to use a scriptlet in the value attribute? > > Cheers, > > Gollo > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > > The compiler is probably getting confused by the two sets of double > quotes > in your value specification. Try using single quotes around the overall > expression, like this: > > property="workSchedule$WorkScheduleEid" > value='<%=request.getParameter("wsId")%>'> > > -- > Martin Cooper > > > - Original Message - > From: "Matt Raible" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, September 19, 2001 2:28 PM > Subject: logic:equal and dynamic value > > > > I am trying to compare a value in my bean with a value from the > request, > using > > the following > > > > > property="workSchedule$WorkScheduleEid" > > value="<%=request.getParameter("wsId")%>"> > > > > However, I am getting the following error: > > > > 2001-09-19 03:31:07 - error-the file > > '\WEB-INF\pages\resourceWorkProfileManage.jsp' generated the following > parse > > exception: org.apache.jasper.compiler.ParseException: > > > D:\iPlanet\iPM6ias\APPS\timetracker\timetracker\WEB-INF\pages\resourceWo > rkPr > ofileManage.jsp(248,131) > > Attribute wsId has no value > > > > > > I have tried putting <%=request.getParameter("wsId")%> outside of the > equal > > tags and the value is there - and it is the one I've expected. > > > > Thanks, > > > > Matt > > > > > > __ > > Terrorist Attacks on U.S. - How can you help? > > Donate cash, emergency relief information > > http://dailynews.yahoo.com/fc/US/Emergency_Information/ > > > __ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/
Digister
HI, I try to use use digister from org.apache.commons.digester by my own but without luck. Does any doc exist to digister or any "How To" ? Thanks!
Re: Newbie : More than one propertyfile?
The usual advice is to have Ant concaternate them into a single file when the application is built. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ "David A. D. Konrad" wrote: > > Hi, > Im new to struts and servlets, so maybe is this a question answered many times >before. > > How can i have more than one .properties file? For instance, i would like to have a >property-file for errors, for buttons, for labels and so on...? > > regards,
Re: Suggestion: Enhance Struts perfrommance.....
Personally, I've yet to see any actual benchmarks whatsoever on this issue. I have seen postings from people with access to unpublished benchmarks that say the idea that there is a performance hit for introspection is obsolete with late mode JVM's. (We've come a long way, baby;-) My personal opinion is that removing introspection as a performance tweak is like unrolling loops. You can trade space for time, but it's not a difference that makes a difference in commercial applications. If we were going to look for performance tweaks, the place to start would be with a profiler that can pinpoint bottlenecks. Often, an application will spend 90% of its time processing 10% of the code, and it's usually not the code you would expect [Fowler, Refactoring (Addison Wesley 2001), pg 69-70]. If the introspection calls are not in that 10%, then no amount of performance tuning will make a visible difference. It's been my observation that my own Struts applications perform surprisingly well, as does every Struts application I've seen. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ David Corbin wrote: > > The collection thing was only an analogy. You missed the general point that > struts has fine performance for many applications as is, and it allows you > to create great/powerful/flexible/maintainable code. No one would deny that > there are cases where introspection might destroy performance, but in many > cases it is non-issue. > > Furthermore, there have been articles and discussions on introspection > performance that indicate it is not nearly as bad performance wise as some > believe, though personally I remain a little skeptical about that. > > David Corbin
Re: CVS or 1.0
I would use the 1.0 production release. The Website is being updated to clarify that we recommend that production sites use the production release. All the changes proposed for 1.1 at this point are really add-ins, and the bug fixes have been minimal. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ Jake Thompson wrote: > > Hi All, > > I am using struts for an internal, almost production system. I can handle > quirks, but it obviously still must perform correctly and be easily updated > in the future. > > Is my best option to use 1.0 as the foundation, or should I use the CVS > devel version? > > I will be developing for 2 months, so if a new version is planned by then I > should probably use the devel version. However, I have used 1.0 so far and > it has done the trick. > > Any comments are very welcome. > > Thanks, > Jake T.
CVS or 1.0
Hi All, I am using struts for an internal, almost production system. I can handle quirks, but it obviously still must perform correctly and be easily updated in the future. Is my best option to use 1.0 as the foundation, or should I use the CVS devel version? I will be developing for 2 months, so if a new version is planned by then I should probably use the devel version. However, I have used 1.0 so far and it has done the trick. Any comments are very welcome. Thanks, Jake T.
Re: Suggestion: Enhance Struts perfrommance.....
The collection thing was only an analogy. You missed the general point that struts has fine performance for many applications as is, and it allows you to create great/powerful/flexible/maintainable code. No one would deny that there are cases where introspection might destroy performance, but in many cases it is non-issue. Furthermore, there have been articles and discussions on introspection performance that indicate it is not nearly as bad performance wise as some believe, though personally I remain a little skeptical about that. David Corbin - Original Message - From: "Trieu, Danny" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 20, 2001 4:42 AM Subject: RE: Suggestion: Enhance Struts perfrommance. > Craig, > > Thanks for you reply. I agree with all the points you said. My only 2cents > was in the use of introspection that Struts used, and not the big spectrum > of the Collection. Notice, The BeanInfo and the introspector hardly use any > Collection at all. May this is because of the late adoption of Collection > that I am now aware of, but this is how I've got the idea from. Yes, these > issues became irrelavent when compare it to network latency and database > response time. > > danny > > -Original Message- > From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, September 19, 2001 11:43 PM > To: [EMAIL PROTECTED] > Subject: Re: Suggestion: Enhance Struts perfrommance. > > > On Sun, 9 Sep 2001, Trieu, Danny wrote: > > > Date: Sun, 9 Sep 2001 14:46:17 -0700 > > From: "Trieu, Danny" <[EMAIL PROTECTED]> > > Reply-To: [EMAIL PROTECTED] > > To: [EMAIL PROTECTED] > > Subject: Suggestion: Enhance Struts perfrommance. > > > > All, > > > > I am new to extending Struts. I alway know that Struts used introspection > > heavily to lookup bean info matching and calling bean properties. I was > > extend some Struts' custom tags and attempted to look at the > > Struts code and its utilities to learn how these tag being implemented. I > > found out that the author use Iterator a lot to iterate to a collection. > My > > only suggestion is that: If we know we have to iterate to the entire > > Collection, wouldn't it be better if we just use array(..[]) to do just > this > > purpose instead of Iterator? We can alway convert a Collection to array( > > SomeType[] someTypeArray = someCollection.toArray(new SomeType[0]) ; ) > and > > just loop through it. I think this would reduce a lot function call over > > head and improve perfrommance. > > > > My 2cents, > > > > --danny > > > > ps. Thanks > > > > > > Performance is always an interesting issue, because what works great in > one application does not always work well in others. And, the relative > cost of operations like object creation, garbage collection, and > reflection depend *very* much on which JVM you are using. > > Struts follows the general programming principles laid down by the Java > collections API. In particular, the size of a particular collection is > unknowable (in the general case), and might even exceed your memory > capacity (think of a List implementation that is backed by a > ten-million-row database table :-). > > Let's consider the proposed case a little more carefully. We are really > comparing these two approaches: > > Object items[] = findItems(); > for (i = 0; i < items.length; i++) > doSomething(items[i]); > > Iterator items = findItemsIterator(); > while (items.hasNext()) > doSomething(items.next()); > > Although the iterator based approach does involve more method calls > (because of the hasNext() and next() methods), it has some crucial > advantages: > > * You never need to create enough space to store the entire collection > contiguously in memory in an array (if this is even feasible). > > * The iterator approach generates only one small piece of garbage > when it is done (the Iterator instance itself). The array-based > approach creates a large item (with lots of internal object references) > which takes longer to garbage collect. > > * If you find out that you don't need the entire collection, you can > stop processing an iterator. With an array, you have to generate > the entire list no matter what. > > In practical terms, however, these issues are not usually relevant to the > perceived response time in a web application -- response time is dominated > by database and network latency. You should strive for clarity in your > programming, because debugging and code maintenence is, in nearly every > case, *much* more expensive than buying a little more CPU and memory. > > Craig > > >
org.apache.commons.beanutils.PropertyUtil
Hi, I would like to use the PropertyUtil-class from "org.apache.commons.beanutils" to copy the properties from one bean to another. For Example I have a bean bVO from type BBDetailVO and I have a bean bForm from type ShowBlackBoardDetailsForm If I do something like PropertyUtil.copyProperties(bVO, bForm); I get an IllegalArgumentException and if I do something like PropertyUtil.copyProperties(bForm, bVO); I get "NoSuchMethodException: Property 'pk' has no getter method" Could you please HELP me !!! If I use two normal beans mit 3 or 4 propeties and use the PropertyUtil-class everything workes fine.. THANKS package de.tecmath.cms.ejb.BlackBoard.valueobjects; import de.tecmath.cms.ejb.BlackBoard.entity.bean.BlackBoardBean; import de.tecmath.cms.util.ejb.valueobjectfactory.exception.*; import javax.ejb.*; import de.tecmath.cms.ejb.BlackBoard.entity.interfaces.*; import de.tecmath.cms.util.ejb.valueobjectfactory.*; import java.io.*; import de.tecmath.cms.util.ejb.valueobject.*; /** * Insert the type's description here. * Creation date: (30.08.2001 14:54:56) * @author: */ public class BBDetailVO extends ValueObjectAdapter implements BlackBoardBusiness, Serializable { private java.lang.String name = null; private java.lang.String content = null; private java.lang.Integer pk = null; /** * BBDetailVO constructor comment. */ public BBDetailVO() { super(); super.setOverWriteable(false); } /** * BBDetailVO constructor comment. */ public BBDetailVO(Integer pk, String name, String content) { super(); this.pk = pk; this.name = name; this.content = content; super.setOverWriteable(false); } /** * Insert the method's description here. * Creation date: (30.08.2001 14:54:56) * @param source java.lang.Object * @exception de.tecmath.cms.util.ejb.valueobjectfactory.VOFillingError The exception description. */ public void fill(Object source) throws de.tecmath.cms.util.ejb.valueobjectfactory.exception.VOFillingError { try { if (source instanceof BlackBoardBean) { BlackBoardBean bb = (BlackBoardBean) source; this.pk = bb.getPk(); this.name = bb.getName(); this.content = bb.getContent(); this.setModCounter(bb.getModCounter()); } else throw new VOFillingError(); } catch (java.rmi.RemoteException re) { throw new VOFillingError( "RemoteException occured in fill(). Reason: " + re.getMessage()); } } /** * Insert the method's description here. * Creation date: (30.08.2001 14:55:38) * @return java.lang.String */ public java.lang.String getContent() { return content; } /** * Insert the method's description here. * Creation date: (30.08.2001 14:55:23) * @return java.lang.String */ public java.lang.String getName() { return name; } /** * Insert the method's description here. * Creation date: (30.08.2001 14:55:56) * @return java.lang.Integer */ public java.lang.Integer getPk() { return pk; } /** * Insert the method's description here. * Creation date: (31.08.2001 14:23:43) * @return java.lang.String */ public String getValueObjectName() { return "BBDetailVO"; } /** * Insert the method's description here. * Creation date: (30.08.2001 14:55:38) * @param newContent java.lang.String */ public void setContent(java.lang.String newContent) { content = newContent; } /** * Insert the method's description here. * Creation date: (30.08.2001 14:55:23) * @param newName java.lang.String */ public void setName(java.lang.String newName) { name = newName; } /** * Insert the method's description here. * Creation date: (30.08.2001 14:55:56) * @param newPk java.lang.Integer */ public void setPk(java.lang.Integer newPk) { pk = newPk; } /** * Insert the method's description here. * Creation date: (30.08.2001 14:55:56) * @param newPk java.lang.Integer */ public void setPk(String newPk) { if(newPk != null && newPk.length() >0) { pk = new Integer(newPk); } } /** * Insert the method's description here. * Creation date: (31.08.2001 14:41:16) * @return java.lang.String */ public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("PK: "+this.getPk()); buffer.append("\n"); buffer.append("Name: "+this.getName()); buffer.append("\n"); buffer.append("Content: "+this.getContent()); buffer.append("\n"); buffer.append("ModCounter: "+this.getModCounter()); buffer.append("\n"); return buffer.toString(); } } ___ package de.tecmath.cms.ejb.BlackBoard.struts; import de.tecmath.cms.ejb.BlackBoard.valueobjects.*; /** * Insert the type's description
Newbie : More than one propertyfile?
Hi, Im new to struts and servlets, so maybe is this a question answered many times before. How can i have more than one .properties file? For instance, i would like to have a property-file for errors, for buttons, for labels and so on...? regards,
RE: Suggestion: Enhance Struts perfrommance.....
Craig, Thanks for you reply. I agree with all the points you said. My only 2cents was in the use of introspection that Struts used, and not the big spectrum of the Collection. Notice, The BeanInfo and the introspector hardly use any Collection at all. May this is because of the late adoption of Collection that I am now aware of, but this is how I've got the idea from. Yes, these issues became irrelavent when compare it to network latency and database response time. danny -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 19, 2001 11:43 PM To: [EMAIL PROTECTED] Subject: Re: Suggestion: Enhance Struts perfrommance. On Sun, 9 Sep 2001, Trieu, Danny wrote: > Date: Sun, 9 Sep 2001 14:46:17 -0700 > From: "Trieu, Danny" <[EMAIL PROTECTED]> > Reply-To: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > Subject: Suggestion: Enhance Struts perfrommance. > > All, > > I am new to extending Struts. I alway know that Struts used introspection > heavily to lookup bean info matching and calling bean properties. I was > extend some Struts' custom tags and attempted to look at the > Struts code and its utilities to learn how these tag being implemented. I > found out that the author use Iterator a lot to iterate to a collection. My > only suggestion is that: If we know we have to iterate to the entire > Collection, wouldn't it be better if we just use array(..[]) to do just this > purpose instead of Iterator? We can alway convert a Collection to array( > SomeType[] someTypeArray = someCollection.toArray(new SomeType[0]) ; ) and > just loop through it. I think this would reduce a lot function call over > head and improve perfrommance. > > My 2cents, > > --danny > > ps. Thanks > > Performance is always an interesting issue, because what works great in one application does not always work well in others. And, the relative cost of operations like object creation, garbage collection, and reflection depend *very* much on which JVM you are using. Struts follows the general programming principles laid down by the Java collections API. In particular, the size of a particular collection is unknowable (in the general case), and might even exceed your memory capacity (think of a List implementation that is backed by a ten-million-row database table :-). Let's consider the proposed case a little more carefully. We are really comparing these two approaches: Object items[] = findItems(); for (i = 0; i < items.length; i++) doSomething(items[i]); Iterator items = findItemsIterator(); while (items.hasNext()) doSomething(items.next()); Although the iterator based approach does involve more method calls (because of the hasNext() and next() methods), it has some crucial advantages: * You never need to create enough space to store the entire collection contiguously in memory in an array (if this is even feasible). * The iterator approach generates only one small piece of garbage when it is done (the Iterator instance itself). The array-based approach creates a large item (with lots of internal object references) which takes longer to garbage collect. * If you find out that you don't need the entire collection, you can stop processing an iterator. With an array, you have to generate the entire list no matter what. In practical terms, however, these issues are not usually relevant to the perceived response time in a web application -- response time is dominated by database and network latency. You should strive for clarity in your programming, because debugging and code maintenence is, in nearly every case, *much* more expensive than buying a little more CPU and memory. Craig
Re: Broadvision 6.0 and context-relative path in form mappings
Rohan Oberoi wrote: > This issue raises the issue of whether Struts can work properly on > Broadvision ( and whether BV6 is servlet 2.2 compliant). Perhaps > there should be a BV section on the Struts installation instructions > (http://jakarta.apache.org/struts/installation.html) ? Nearly all the installation instructions were provided by individual developers based on their own experience. If you do manage to get this to run somehow, and provided a HOWTO, I'd be happy to add it to the documentation, with links to any patches. Rohan Oberoi wrote: > This means that, to get things like the HTML taglibs working, I'd have > to go in and edit the Struts source. In this case, it would be the > getActionMappingURL() method in org.apache.struts.taglib.html.FormTag. A third possibility would be to provide your own version of the Struts taglibs that correct Broadvision's misbehaviour. You could then link these into your application instead of the standard Struts tags. So, you would 1. Copy the taglib package, and modify it to use another package name. 2. Make the changes you need 3. Put the tags into their own JAR, and place the JAR in your lib folder along with the Struts JAR. 4. Modify the tld's to refer to your classes instead of the Struts classes. Just be sure to retain the license statements and existing author credits in all source code. If the source code is not in the JAR, then the license statement (apache.org/LICENSE) must be included as a separate file. For extra credit, send us a BV installatin page, with links to your patched JAR. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/
Re: wrong behavior of checkboxes in forms?
Try to use multibox Regards, Rakesh - Original Message - From: "Brad Reneer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, September 19, 2001 10:40 PM Subject: RE: wrong behavior of checkboxes in forms? > I'm having the same problem. Did you ever get this to work? > > Thanks, > Bradley Reneer > > -Original Message- > From: Hartmut Bernecker [mailto:[EMAIL PROTECTED]] > Sent: Mon, August 13, 2001 5:17 AM > To: [EMAIL PROTECTED] > Subject: Re: wrong behavior of checkboxes in forms? > > > Gregor Rayman schrieb: > > > > "Hartmut Bernecker" <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > > > > I have a checkbox in a form. If I check it and then submit the form, > > > then I receive the value "true" in the action when calling the method > > > form.getMyCheckbox(); > > > > > > But if I uncheck the checkbox and submit the form again, then I receive > > > **again** the value true in the action when calling the method > > > form.getMyCheckbox(); > > > > > > Who can help??? > > > > > > Hartmut > > > > Hi, there are two possible solutions: > > > > 1) use request scope forms > > 2) implement the reset() method. (Which you should do anyway always, when > > you use checkboxes) > > > > -- > > gR > > > I had implemented the reset() method: > > public void reset(ActionMapping mapping, ServletRequest request) > { > myCheckbox = false; > [...] > } > > But anyway: the problem persists. > >
RE: logic:iterator Class cast exception
Sorry for late answer I was sick for a couple of days. Yes, I have imported in my JSP page all relevant classes. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 16, 2001 5:14 AM To: [EMAIL PROTECTED] Subject: Re: logic:iterator Class cast exception Since the error is a JSP compilation error, it's not related to the code in your action. Are you importing all the relevant classes at the top of your JSP page? -- Martin Cooper - Original Message - From: "Claudio Parnenzini" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 14, 2001 8:37 AM Subject: logic:iterator Class cast exception Hi all, I'm trying to iterate a Vector into a JSP page and I have an Class cast exception. My vector contains an Hashtable that contains String object. Here my ActionBean code for the iteration: while(rs.next()) { Hashtable table = new Hashtable(); table.put(SQLConstants.FieldName.BSP.BSP_ID,rs.getString(SQLConstants.Fi eldName.BSP.BSP_ID)); table.put(SQLConstants.FieldName.BSP.BSP_FULLNAME,rs.getString(SQLConsta nts.FieldName.BSP.BSP_FULLNAME)); vectorBsp.add(table); request.getSession().setAttribute(Constants.BSP_LIST,loadBsp(errors)); } Into my jsp, I iterate in this way. <%= (String)((java.util.Hashtable)bspList).get(SQLConstants.FieldName.BSP.BS P_ID)%> <%= (String)((java.util.Hashtable)bspList).get(SQLConstants.FieldName.BSP.BS P_FULLNAME)%> Here the error message. Location: /struts-iata/bsp.jspInternal Servlet Error: org.apache.jasper.JasperException: Unable to compile class for JSP at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:630) at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146 ) at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:542) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(J spServlet.java:258) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle t.java:268) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at org.apache.tomcat.core.Handler.service(Handler.java:287) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.jav a:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(H ttpConnectionHandler.java:213) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416 ) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:50 1) at java.lang.Thread.run(Thread.java:484) Root cause: java.lang.ClassCastException: java.lang.Object at javax.servlet.jsp.tagext.TagData.getAttributeString(TagData.java:163) at org.apache.struts.taglib.logic.IterateTei.getVariableInfo(IterateTei.jav a:90 ) at javax.servlet.jsp.tagext.TagInfo.getVariableInfo(TagInfo.java:149) at org.apache.jasper.compiler.TagBeginGenerator.generateServiceMethodStatem ents(TagBeginGenerator.java:290) at org.apache.jasper.compiler.TagBeginGenerator.generate(TagBeginGenerator. java:357) at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.genera te(JspParseEventListener.java:771) at org.apache.jasper.compiler.JspParseEventListener.generateAll(JspParseEve ntListener.java:220) at org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspPa rseEventListener.java:175) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:210) at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:612) at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146 ) at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:542) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(J spServlet.java:258) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle t.java:268) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at org.apache.tomcat.core.Handler.service(Handler.java:287) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.interna
RE: logic:equal and dynamic value
Can't you use to save having to use a scriptlet in the value attribute? Cheers, Gollo -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] The compiler is probably getting confused by the two sets of double quotes in your value specification. Try using single quotes around the overall expression, like this: -- Martin Cooper - Original Message - From: "Matt Raible" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, September 19, 2001 2:28 PM Subject: logic:equal and dynamic value > I am trying to compare a value in my bean with a value from the request, using > the following > > property="workSchedule$WorkScheduleEid" > value="<%=request.getParameter("wsId")%>"> > > However, I am getting the following error: > > 2001-09-19 03:31:07 - error-the file > '\WEB-INF\pages\resourceWorkProfileManage.jsp' generated the following parse > exception: org.apache.jasper.compiler.ParseException: > D:\iPlanet\iPM6ias\APPS\timetracker\timetracker\WEB-INF\pages\resourceWo rkPr ofileManage.jsp(248,131) > Attribute wsId has no value > > > I have tried putting <%=request.getParameter("wsId")%> outside of the equal > tags and the value is there - and it is the one I've expected. > > Thanks, > > Matt > > > __ > Terrorist Attacks on U.S. - How can you help? > Donate cash, emergency relief information > http://dailynews.yahoo.com/fc/US/Emergency_Information/