RE: Netbeans Support of Struts
Not directly-- I have, however, added Tomcat to my struts projects and ran the entire process within NetBeans. -- Levi -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 12:07 PM To: [EMAIL PROTECTED] Subject: Netbeans Support of Struts Does the Netbeans IDE support the creation of Struts applications and running/debugging them inside Netbeans? Dan
RE: newbie - requesting example of working build.xml, build.properties files
I haven't taken time to account for the variation, but walking through this process on a fresh RedHat 7.1 installation required an additional step. Basically, to prevent ant from failing on some jar sealing Security exception that I don't remember the details of, I had to remove $ANT_HOME/lib/parser.jar $ANT_HOME/lib/jaxp.jar. (I think ant 1.3 carries jaxp 1.0 with it, and the presence of Jaxp 1.1 caused the fit) -- Levi -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Friday, June 22, 2001 5:20 PM To: [EMAIL PROTECTED] Subject: Re: newbie - requesting example of working build.xml, build.properties files On Fri, 22 Jun 2001, Michael McCafferty wrote: Hi all, I am trying to build struts from source, and having an unexpectedly difficult time of it. I have downloaded the source code from CVS, and followed the directions listed on http://jakarta.apache.org/struts/installation.html without success. I have copied the $STRUTS/build.properties.sample to build.properties and edited existing entries accordingly. I have also copied $STRUTS/build-webapp.xml to build.xml and edited existing values accordingly. For all prerequesite properties listed in build-webapp.xml (lines 29-86) I am specifying a command line option to ant. I'm probably missing something obvious, but I'm coming to the conclusion that the sample configuration files require a LOT of customization in order to build a vanilla version of struts from source. I'd love to see copies of build.xml and build.properties that someone has used to successfully compile the software. You should not have to modify *anything* in build.xml, build-webapp.xml, or build-webapps.xml in order to build Struts from source. All of the necessary values are inherited from properties you set inside your build.properties file. The minimal set of properties you need to set in your build.properties file are: jdbc20ext.jar - Set this to the full pathname to your jdbc2_0-stdext.jar file (download the JDBC 2.0 Optional Package). servlet.jar - Set this to the full pathname to your servlet.jar file (normally the one you got with your servlet container). For the rest of my setup, here's what I did: * Downloaded Ant 1.3 and installed it (and placed $ANT_HOME/bin on my PATH) * From the same place, grab Ant's optional.jar file and place it in $ANT_HOME/lib. * Download JAXP/1.1 and put all three JAR files on my CLASSPATH. * Type ant to compile Struts, or ant dist to create a mirror of the binary distribution. If you are having to change other properties, then we should try to simplify the build scripts so that you don't have to. Thanks in advance, Michael McCafferty [EMAIL PROTECTED] Craig McClanahan
RE: Error compiling 'cannot resolve symbol'
Ant's user manual has lots of useful pointers for you. http://jakarta.apache.org/ant/manual/index.html A quick fix for your junit problem is to place junit.jar in your CLASSPATH or in the $ANT_HOME/lib directory. HTH, Levi Cook FYI, JUnit and Ant both have good mailing lists for further info on this stuff. -Original Message- From: Sylvie Djihanian [mailto:[EMAIL PROTECTED]] Sent: Monday, June 04, 2001 4:47 PM To: [EMAIL PROTECTED] Subject: Error compiling 'cannot resolve symbol' Hi, I am trying to compile the sample application business.zip I found in the Struts, an open-source MVC implementation article http://www-106.ibm.com/developerworks/library/j-struts/?n-j-2151. I get the following error: [javac] E:\jakarta-struts-1.0-b3\samples\business\src\test\test\business\All JUnitTests.java:6: cannot resolve symbol [javac] symbol : class Test [javac] location: package framework [javac] import junit.framework.Test; [javac]^ I downloaded junit.jar and copied it into my E:\jakarta-struts-1.0-b3\samples\business\lib directory. (I thought JUnit should have come with the Ant binaries). I'm somewhat new to the struts and java world... Do you know how I can get the builder to find the junit package? Sylvie
RE: Managing resource life cycle during request
Can you elaborate on your resource cleanup requirements? My view on designing a responsible object is that I must make sure it eventually releases any, non-memory, finite resources it uses. This design strategy, coupled with garbage collection ensures my system doesn't run out of those resources (eg. file handles, sockets, etc.). Given that ActionForms and JSPs should play the view role in Struts, I would question a design that has them acquiring non-memory resources. But, alas, I don't know your system or situation.. Regards, Levi Cook -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Monday, June 04, 2001 10:31 PM To: [EMAIL PROTECTED] Subject: Re: Managing resource life cycle during request I doubt that overriding ActionServlet.process() would work. The controller sends back the response, and it's done. It's then up to HTTP to deliver the view, usually a JSP. Any clean-up routine would have to be the responsibility of the view, which puts you into the scriplet zone. Jeff Trent wrote: Well, it looks to me that short of overriding ActionServlet.process(), there is no way one can clean-up resources after the page has been rendered...
RE: Managing resource life cycle during request
Just a few notes: 1. Struts doesn't dissallow the operations you outline below. If you are using Struts, and you really need to do this, you can make the same calls from your Action implementation. public class SomeAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ServletContext context = servlet.getServletContext(); RequestDispatcher dispatcher = context.getRequestDispatcher(jspFile); rs - dbquery request.setAttribute(rs, rs); dispatcher.include(request, response); rs.close(); // ActionServlet doesn't do any more response processing.. return null; } } I'm not suggesting that coding this way is wrong. I would suggest that this isn't optimal model/view separation, which is one of the main motives for using Struts, right? 2. My use of the term acquiring may have been wrong, or at least ambiguous. More accurately, I would suggest that view components should not have knowledge of, or responsibility for non-memory, finite resources. 3. You must rely on Garbage collection in Java, you may not like its behaviors, but its all you get. Also, I would never suggest that you rely on garbage collection to free, non-memory resources, like db-handles. -- Levi -Original Message- From: Jeff Trent [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 05, 2001 2:05 PM To: [EMAIL PROTECTED] Subject: Re: Managing resource life cycle during request Levi, The view/JSP does not acquire the resource. Here is a sample of how the code use to work pre-struts: Servlet.doGet() { ... rs - dbquery request.setAttribute(rs, rs) requestDispatcher.include(jspFile) rs.close(); } In JSP: ... rs = request.getAttribute(rs) while (rs.next()) { ... } - - - The problem is that there is no appropriate counterpart in the world of struts. Sure, I can copy the row data to a collection and then walk the collection. But for various reasons, this may be inappropriate (especially for large result sets represented by a cursor). Finally, you should not depend on garbage collection. The garbage collector is not always called and its certainly not called as often as you would want it to when you need to free scarce resources like db handles. - jeff - Original Message - From: Cook, Levi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 05, 2001 1:40 PM Subject: RE: Managing resource life cycle during request Can you elaborate on your resource cleanup requirements? My view on designing a responsible object is that I must make sure it eventually releases any, non-memory, finite resources it uses. This design strategy, coupled with garbage collection ensures my system doesn't run out of those resources (eg. file handles, sockets, etc.). Given that ActionForms and JSPs should play the view role in Struts, I would question a design that has them acquiring non-memory resources. But, alas, I don't know your system or situation.. Regards, Levi Cook -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Monday, June 04, 2001 10:31 PM To: [EMAIL PROTECTED] Subject: Re: Managing resource life cycle during request I doubt that overriding ActionServlet.process() would work. The controller sends back the response, and it's done. It's then up to HTTP to deliver the view, usually a JSP. Any clean-up routine would have to be the responsibility of the view, which puts you into the scriplet zone. Jeff Trent wrote: Well, it looks to me that short of overriding ActionServlet.process(), there is no way one can clean-up resources after the page has been rendered...
RE: Grid Support in Struts
Not sure I totally followed your requirement, but I think I do something similar in one of my systems. Basically, its valid to nest iterate tags like this: table logic:iterate name=someBean property=collectionOfRows id=row tr logic:iterate name=row property=collectionOfColumns id=col td bean:write name=col property=whatEver/ /td /logic:iterate /tr /logic:iterate /table Hopefully, that's somewhat useful.. -- Levi - Original Message - From: du Clos, John [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 31, 2001 9:19 AM Subject: Grid Support in Struts We currently have a business requirement to provide a grid type of interface as part of many web pages in our design. I searched the list for Grid examples or support and did not find anything. Has anyone implemented a psudo grid function using Struts... that would support the following: col1 col2 col3 ___ ___ ___ row 1 |__ | |___| |__| ___ ___ ___ row 2 |__ | |___| |__| ___ ___ ___ row 3 |__ | |___| |__| ___ ___ ___ row 4 |__ | |___| |__| . . Essentially, i believe we are looking for a solution that supports a 2-dimensional array so we can reference it as ObjName(row,col). I read the iterate tag documentation, but did not seem to be well suited for multi-dimension. Any suggestions would be greatly appreciated. The additional business requirement is that we allow user to dynamically add rows and columns... i found something on the list to support dynamically adding rows w/iterate and some coding on the jsp, but nothing on dynamic columns Thanks, JD
RE: Suggestion/Idea for iterate tag: Iterate ResultSets
If you are interested in executing SQL from your JSPs, the taglibs project might save you some time. Check into: http://jakarta.apache.org/taglibs/doc/dbtags-doc/intro.html For what its worth, this approach breaks the model-view separation struts may have provided for your project. If that's ok for your project, then the afore-mentioned taglibs should save you time. On the other hand, if your not sure what model-view separation is, I would recommend reviewing the Struts User's Guide - Introduction at: http://jakarta.apache.org/struts/userGuide/introduction.html Regards, Levi Cook -Original Message- From: Mindaugas Idzelis [mailto:[EMAIL PROTECTED]] Sent: Monday, May 07, 2001 9:06 AM To: [EMAIL PROTECTED]; Jonathan Asbell Subject: RE: Suggestion/Idea for iterate tag: Iterate ResultSets I just thought of another option: If resultsets are tied to a connection and a statement, then specify the sql query within the iterator: Hypothetical taglibs: sql:query id=myQuery SELECT col1, col2 FROM table WHERE id 1 !-- even use bean:write in here to dynamically make queries -- /sql:query logic:iterate id=row query=myQuery bean:write name=row property=col1/ bean:write name=row property=col2/ br /logic:iterate Where sql:query would only be evauluated once per iteration. Would this be possible to create? I have never authored a taglib, so any feedback from taglib veterans is greatly appreciated. I think this would be a great addition to the taglibs framework. --min -Original Message- From: Jonathan Asbell [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 06, 2001 11:47 PM To: [EMAIL PROTECTED] Subject: Re: Suggestion/Idea for iterate tag: Iterate ResultSets Result sets ARE tied to the connection in a way. Some DB drivers throw exceptions when you try to manipulate data while you still have a pointer to rows. At work we were trying to manipulate a stream which was pointing to an output parameter in a stored proc while the connection was open. The result was that we had to convert the stream into another object (String in our case) and close the connection just to manipulate the data. - Original Message - From: Mindaugas Idzelis [EMAIL PROTECTED] To: struts [EMAIL PROTECTED] Sent: Sunday, May 06, 2001 9:33 PM Subject: Suggestion/Idea for iterate tag: Iterate ResultSets I just thought up of an excellent idea (although, I wasn't the only one). Use the iterate tag to iterate over the rows of a resultset. The column meta data could be exposed as beans named as the column name. A bean:write operation would display the data in the column. I did a search about this topic in the mailing list archive, and I found this message: http://marc.theaimsgroup.com/?l=struts-userm=98269295229785w=2 It talk about ResultSets being tied to connections. This is not the case. ResultSets are tied to the statements that produced them, and as far as I can tell, statements are not closed when the connection is closed. Other than that, It should be easy to change the iterate tag to support resultsets. If anyone is interested in helping me extend or develop a tag for this purpose, please message me. --min
RE: PropertyUtils.copyProperties
Hi Fred, In its current form, its not locale-sensitive on date conversion (that could be fixed), but it served my needs for converting previously validated strings. It also supports going the other direction, ie., converting a Date object to a formatted String. Support for other types could be easily added too. private StringConverter sc = new StringConverter(); // snippet from populating my Form this.setBirthDate(null == contact.getBirthDate() ? null : sc.formatDate(contact.getBirthDate())); // snippet from getting my domain object from the form contact.setBirthDate(null == getBirthDate() ? null : sc.toDate(getBirthDate())); Hope its useful, Levi -Original Message- From: Fred Lo [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 12, 2001 5:25 AM To: [EMAIL PROTECTED] Subject: PropertyUtils.copyProperties Hi all, I just wonder if anyone have a utility class that is perform something to PropertyUtils.copyProperties() but with type conversion? The reason is that I am coding all my ActionForm with string (for validation concern) but the underlying objects are in their respective type, so there is some tedious coding that copy the properties from the form/object back and forth. Any help will be appreciated. Fred _ Get your FREE download of MSN Explorer at http://explorer.msn.com StringConverter.java StringValidator.java
RE: Use of Mapping in ActionForm's validate() method
I use mapping.getName() as part of my user input validation strategy. Basically its part of the key for retrieving validation rules out from my resources file. For example, my "contactForm" would use the following keys: contactForm.required.fields=firstName,lastName,emailAddress contactForm.email.fields=emailAddress contactForm.date.fields=birthDate If your curious, see the attached ValidatingForm, ValidatingFormAdapter ContactForm Feedback is always welcome.. Levi Cook -Original Message- From: Rajan Gupta [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 11, 2001 2:33 PM To: [EMAIL PROTECTED] Subject: Use of Mapping in ActionForm's validate() method Hi! All Can anybody provide me with a use for mapping parameter in validate() method of ActionForm? If u have used this parameter for something please let me know. Thanks in advance. Rajan __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ ValidatingForm.java ValidatingFormAdapter.java ContactForm.java
RE: How to display the size of an Collection attribute of a bean?
Check bean:size http://jakarta.apache.org/struts/struts-bean.html#size Hope that helps, Levi Cook Consultant Greenbrier Russel, Inc. 8383 Greenway Blvd., Suite 200 Middleton, WI 53562 email: [EMAIL PROTECTED] web : www.gr.com -Original Message- From: Thai Thanh Ha [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 10, 2001 2:43 AM To: [EMAIL PROTECTED] Subject: How to display the size of an Collection attribute of a bean? I want to display the size of an Collection attribute of a Bean using Struts taglibs. I can use scriptlet but are there any other ways to do that? Regards, Thai
RE: ActionForm (DataObject) generator?
You might also check into another apache tool called Torque. I think its officially bundled with Turbine, but it could be a subproject for code generation in its own right. I'm not sure of its current status, but Iacquired a pre-release version from cvs and havehad very good results. Here's a useful starting point: http://jakarta.apache.org/turbine/torque.html Regards, Levi Levi Cook Greenbrier Russel Madison, Wisconsin www.gr.com [EMAIL PROTECTED] -Original Message-From: Kyle Robinson [mailto:[EMAIL PROTECTED]]Sent: Wednesday, March 14, 2001 5:35 PMTo: '[EMAIL PROTECTED]'Subject: ActionForm (DataObject) generator? We are using Struts with an Oracle database as the backend. We don'treally feel like handwriting 100's of java files (one for each table). Does anyone know of a good db table - java object generator? Preferably open source? Thanks Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111
RE: html:img tag cannot find image
Title: RE: html:img tag cannot find image Hi Tom, In your example, you are directing your web browser to request an image file from within the WEB-INF directory. Per the servlet specification your servlet engine treats the WEB-INF directory as a private resource. This means none of the files it contains may be served directly to a client. Try moving your /images directory out to your applications document root and you should have more luck. For more info. on this, check section 9.4, Directory Structure, of the servlet spec at http://java.sun.com. Hope that helps, Levi Cook Greenbrier Russel Madison, Wisconsin www.gr.com [EMAIL PROTECTED] -Original Message- From: Tom Miller [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 2:53 PM To: struts-user Subject: html:img tag cannot find image Hello all, It seems that the html:img tag is able to find images in the context root, but not in subdirectories. When I specify an image with the html:img tag like this: html:img src=green-ball.gif/ the images appear. But when I specify a subdirectory like this: html:img src=WEB-INF/images/orange-ball.gif/ the images are missing when the page renders, i.e. little red X symbol in the browser. Here is a pared down JSP that illustrates the problem. It gives the same results whether I include the html:base/ tag or not. I'm using Struts 1.0b1 and Tomcat 3.2.1. TIA for any help. Tom -- %@ page language=java % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:html html:base/ head /head body Dot Onehtml:img src=green-ball.gif/ % /* image shows in browser */ % p Dot Twohtml:img src=WEB-INF/images/orange-ball.gif/ % /* image missing in browser */ % /body /html:html -- Tom Miller Miller Associates, Inc. [EMAIL PROTECTED] 641.469.3535 Phone 413.581.6326 FAX
RE: Minimizing Action class proliferation
Title: RE: Minimizing Action class proliferation For what its worth, I find Niall Pemberton's StandardAction to be a very elegant solution to the common problem of locating an appropriate action handler. Since it addresses a common problem in building a web app. and follows several other idioms at work within Struts, I believe this would make a very nice standard[/optional?] extension to the Struts framework. How do others feel about this? One possible catch is the contract created between your actions path attribute and your method names. To allow deployers to vary the public URL of an action, would it make sense to add an optional handler attribute to the action element? Default behaviour would then be to use the path attribute, if no handler was specified. Anyway.. that's my 2ยข, regards, Levi Cook Greenbrier Russel Madison, Wisconsin www.gr.com [EMAIL PROTECTED] -Original Message- From: Richard Reich [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 08, 2001 10:27 AM To: [EMAIL PROTECTED] Cc: DONNIE HALE Subject: Re: Minimizing Action class proliferation - Original Message - From: DONNIE HALE [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 08, 2001 06:31 Subject: RE: Minimizing Action class proliferation It would be nice to do a standard implementation of this, with Craig's blessing of course :), and add it to Struts to optionally be used by folks who prefer this approach. Yes, it would be nice. An abstract class that can be used or not. Documented as such. Preferably with the introspection-reducing optimization you mention. -r
RE: A Strange Error when using Forte for Java and Struts ...
Title: RE: A Strange Error when using Forte for Java and Struts ... With out your source, I'm not 100% clear on your problem.. However, it may be beneficial to consider that javax.sql.DataSource is part of Sun's Optional Package package for JDBC 2.0. import javax.sql.DataSouce; To use the preceding import statement in my applications, I took the following steps: 1. Downloaded JDBC Standard Extension Binary 2.0 (see link below) 2. Placed the download file jdbc2_0-stdext.jar in %JAVA_HOME%/jre/lib/ext See http://java.sun.com/products/jdbc/download.html#spec for more information. Hope that helps a little, Levi Cook -Original Message- From: Vardar, Tuna [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 9:25 AM To: '[EMAIL PROTECTED]' Subject: A Strange Error when using Forte for Java and Struts ... Greetings, I tried to use Forte for Java 2.0 with Struts and got this different error: Class javax.sql.DataSource not found in type decleration or import. The reason for this is the line implemented as: import org.apache.struts.action.ActionServlet; any comments? king regards, tuna
RE: VA Java and Struts without Tomcat / WebSphere
Hi Don, I would check out the Tomcat Test Environment that IBM provides for VAJ. Here's the link I have to as of this morning: http://www7.software.ibm.com/vad.nsf/webdlvajava35?OpenViewCount=5TargetFrame=webdlvajava35 You might also want to check outthis posting on struts-user: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg03583.html Regards, Levi Cook -Original Message-From: Johan Compagner [mailto:[EMAIL PROTECTED]]Sent: Monday, March 05, 2001 4:05 AMTo: [EMAIL PROTECTED]; Don ElliottSubject: Re: VA Java and Struts without Tomcat / WebSphere It doesn't work on the Websphere test environment in VAJ yet. Because the websphere inside VAJ doesn't support JSP1.1 yet (only the real websphere does that) you must wait for Fixpack3 that will get the test environment to the same level of Websphere 3.5.3 johan - Original Message - From: Don Elliott To: [EMAIL PROTECTED] Sent: Monday, March 05, 2001 8:06 AM Subject: VA Java and Struts without Tomcat / WebSphere Hi Struts Users, Has anyone been able to install and use Struts within the cut-down servlet engine shipped with VA Java ? ie. without installingTomcat or Websphere? Does this work ? I understand the servlet engine shipped with VA Java is a cut-down version of Websphere, and looking at all the feedback on getting Websphere working I'm wondering if it is worth my while attempting to do this. Regards, Don Elliott