[ANN] Book: Java Frameworks and Components
Now available from Cambridge University Press: Java Frameworks and Components: Accelerate Your Web Application Development by Michael Nash Struts is covered in Chapter 5 as well as in the Case Study section. This is a book for web-application developers using or considering frameworks and/or component architectures. Provides the necessary information for finding, evaluating and selecting an application framework (both commercial and open source), and explains in plain language the benefits of frameworks and component technologies, specifically in relation to web application development. Uses examples from several different frameworks to explain the underlying principles. Please see http://us.cambridge.org/titles/catalogue.asp?ISBN=0521520592 for a sample chapter and more information or to purchase the book. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Extra Path Info Problem!!! HELP!!!
Ted: I've been experimenting with a way of doing mappings from normal URL's to Action URI's, and wonder if it's the right approach. If so, I'd be happy to drop it in for inclusion in a release when/if appropriate, or set it up as an optional-add on. I took the simple approach, and added a configuration like this: path-mappings path-mapping url-pattern/form/*/url-pattern path/application/Something.do/path fixed-param param-namesomeParamName/param-name param-valuesomeParamValue/param-value /fixed-param param param-number1/param-number param-namefirstParam/param-name /param param param-number2+/param-number !-- the + means take everything from param 2 onwards -- param-namesecondParam/param-name /param /path-mapping /path-mappings Then I have a servlet called PathHandler, which I map to /do/*, and... if you issue a URL like: /application/do/form/message/here/is/a/path it would then simply issue a forward to: /application/Something.do?someParamName=someparamValuefirstParam=messagese condParam=here/is/a/path Comments on whether or not this is the right way to go much appreciated, as I need this functionality myself soon :-) Mike -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 4:10 AM To: Struts Users Mailing List Subject: Re: Extra Path Info Problem!!! HELP!!! Not supported, though I wish it were :o( http://www.mail-archive.com/struts-user@jakarta.apache.org/msg11714.html http://www.mail-archive.com/struts-user@jakarta.apache.org/msg11709.html Problem is, an Action URI is not a path, but a string identifier that is make to look like a path. So, someone has to write the code to simulate a path. Another problem is that the Action form tag assumes that all action URIs either don't have extensions or are using extension mapping. So, if you are using something like this: /do/MailMerge.txt This doesn't work as an ActionMapping, but does work as a ActionForward. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ cool dude wrote: Hi Guyz, I'm having a really strange problem wiht struts ... I looked around in the mailing list found a lot of people had similar problems .. but I couldn't find any solution for it. The problem relates to use of extra path info. I have a URL which looks something like this http://myserver.com/servletname/extrapathinfo/actionname I've defined the url mapping in the web.xml as /servletname/*. I was hoping that struts will try pick up only the last component of the URL as the action name I would be able to use the extra path info in my servlet. But it doesn't work that way, instead struts tries to look for an action with the name /extrapathinfo/actionname ... I would really appreciate any idea/leads in solving this problem ... been stuck-up with this for sometime now .. :-( Thanx in advance, VD. __ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Thanks! - Advice needed on Stuts versus Struts/Expresso
Cody: Any and all ideas on how we can make the Expresso doc better *really* will be listened to! Honest! :-) It always lags the code, I think that's the nature of the beast, but the core group are very serious about making the doc as high-quality as the code. We've just upgraded to allow all the core contribs to be able to online edit and upload new doc, which will start to help soon I hope as well. Let us know what we can do better, please! Mike -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 3:00 PM To: Struts Users Mailing List Subject: Re:Thanks! - Advice needed on Stuts versus Struts/Expresso But good luck working with Expresso right off the bat. Does anyone in this whole open source world know anything about proper, usable, and useful documentation (sorry - it just gets frustrating; truth is -- I'm probably just an idiot and I hate to admit it.) - Cody [EMAIL PROTECTED] on 01/09/2002 12:35:04 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re:Thanks! - Advice needed on Stuts versus Struts/Expresso Thanks everyone for the information on moving to struts. It has been most helpful. Still not sure what I am going to do in the long run, but at the very least I will learn expresso so I can make a more informed decision... I am also going to try to get an answer on if they are planning on keeping pace with struts... Thanks again for a lot of excellent points on this topic. Bill Chmura Ensign-Bickford Industries, Inc. Information Technologies Department -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Advice needed on Stuts versus Struts/Expresso
Stephen: Just to answer your question below, it is definitely the core group's intention with Expresso to upgrade with Struts, and workflow is one of the new features we've very much looking forward to. Mike Which brings up another point, will Expresso upgrade in step with Struts? If the next revision to Struts has wonderful workflow management will your Expresso code be able to take advantage of it? At that point I think we're probably just trying to read tea leaves, you always have to plant a stake in the ground and start coding with what exists. regards, Stephen Owens Corner Software -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 10:59 AM To: [EMAIL PROTECTED] Subject: Advice needed on Stuts versus Struts/Expresso Hi all, I've gotten a full app to work with Struts and have a good understanding of how things are supposed to be done and work. Now I am looking at possibly using Expresso to speed development. In anyone's experience what would I lose by moving to Expresso. I can see how it would speed development, but do I lose anything that struts gives me? Is there anything that I would come across that I could not do with Expresso that I could do with Struts? I've read all the JCorporate docs on the struts integration and such, but would like to draw on the experience of those more, well experienced. I guess I am at the point where I understand Struts so I am hesitant to move on to something else if I will just be coming back to struts later. My needs rotate mostly around rapid development of applications. Thanks much for this information and all the previous help in getting me going with struts. PS. For anyone starting with struts, get Ted Husted's struts-catalog and read it once a day while you are learning struts. In the beginning you may not understand it, but as the days go on, more and more will help you out. (Thanks Ted) Bill Chmura Ensign-Bickford Industries, Inc. Information Technologies Department -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Advice needed on Stuts versus Struts/Expresso
Bill: You shouldn't lose a thing by using Struts/Expresso in combination, as we've incorporated the entire Struts framework into Expresso. On the flip side, you would gain a powerful object/relational mapping layer, background job queuing/scheduling, auto-generated UI's for prototyping, XML UI generation (w/optional XSLT) and a bunch of other good stuff. We've extended the configuration to support a seperate struts-config.xml for each application, and automatically merge them at startup, but basically everything you are doing now in Struts you can do in Expresso, plus what Expresso adds. Of course, I'm a bit biased, I'm lead developer on Expresso. :-) We're currently at release 1.0 of Struts, but upgrades are indeed in the works. Have a look at the doc on the site as well, and don't miss the Expresso Developer's Guide - a lot of good material is in there, but people don't seem to find it sometimes. 200+ pages of doc in total. Regards, Mike -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 10:59 AM To: [EMAIL PROTECTED] Subject: Advice needed on Stuts versus Struts/Expresso Hi all, I've gotten a full app to work with Struts and have a good understanding of how things are supposed to be done and work. Now I am looking at possibly using Expresso to speed development. In anyone's experience what would I lose by moving to Expresso. I can see how it would speed development, but do I lose anything that struts gives me? Is there anything that I would come across that I could not do with Expresso that I could do with Struts? I've read all the JCorporate docs on the struts integration and such, but would like to draw on the experience of those more, well experienced. I guess I am at the point where I understand Struts so I am hesitant to move on to something else if I will just be coming back to struts later. My needs rotate mostly around rapid development of applications. Thanks much for this information and all the previous help in getting me going with struts. PS. For anyone starting with struts, get Ted Husted's struts-catalog and read it once a day while you are learning struts. In the beginning you may not understand it, but as the days go on, more and more will help you out. (Thanks Ted) Bill Chmura Ensign-Bickford Industries, Inc. Information Technologies Department -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Struts Vs Expresso 4
Dave: I see Peter has already replied, but just to add a few quick thoughts to his reply: I am curious and I am starting on Struts. I have a query. Since Expresso v4 is incorporating Struts into its framework, does it nesssarily mean that it is better? Depends on the Job at hand - as Peter says, different is a better word for sure. Struts concentrates on specific areas of the application development process, whereas Expresso adds capabilities for database-stored security, robust relational/object mapping, background job handling and scheduling, self-tests, log4j integration, and so forth. Struts is a perfect project for us to integrate with, as the two frameworks we're parallel in design techniques in the area of UI and presentation, yet with not much overlap. There's also a collection of other OSS projects built with Expresso that might be useful to you right away, including eForum (discussion forums), ePoll (voting/polling), and eSearch (flexible search engine). The UI for each of those is now Struts-based. Expresso has a framework for EJB right? Not *quite* yet - but very close indeed. Work is actively underway for this. Please correct me if I am incorrect. You can find out more at www.jcorporate.com, and the Expresso list serve at [EMAIL PROTECTED] Mike Jcorporate Ltd. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Reusable/composable Struts components?
Gary (and all): This is exactly the kind of issue that led us to integrate Struts with Expresso (our OSS app framework) - we had addressed the issue of packaging components and their interaction with Expresso, so I guess we were coming at the problem from the other direction :-) Expresso's OSS community hascreated a forum component, login/authentication management, polling/voting application, and a bunch of others, and have at least one answer to how to easily be able to plug components together. I'd like to suggest you cross-post your question on the [EMAIL PROTECTED] mailing list - I expect you'd get a lot of input that you might find useful, particularly now that any Expresso component is also effectively a Struts "component" Regards, Mike Jcorporate Ltd. http://www.jcorporate.com -Original Message-From: Gary Johnston [mailto:[EMAIL PROTECTED]]Sent: Wednesday, September 26, 2001 10:49 AMTo: [EMAIL PROTECTED]Subject: Re: Reusable/composable Struts components?Gabe, I absolutely agree. I was mentally coming at it from the bottom up: How do I get a good, general reuse mechanism working at all? If/when that is figured out, immediately all the other issues you mention need to be addressed in order to have a real, usable solution. I'd love to find out if/how folks in the Struts community address this. My fear is that what most folks currently do at this level is mostly ad hoc and/or "cut and paste" reuse.- Gary___Gary JohnstonWebSphere Enterprise RAD DevelopmentApplication Integration Middleware DivisionIBM Software Group, Research Triangle Park, NC919-254-0027, fax 919-254-4914, IBM tieline 444-0027 Gabriel Sidler [EMAIL PROTECTED] 09/26/2001 01:35 AM Please respond to struts-user To: [EMAIL PROTECTED] cc: Subject:Re: Reusable/composable Struts components?Gary, Ted,I have a very similar need. I have Struts application components that I'd like to reuse/share with others (e.g. user profile manager,adminisration tools, login, dynamic toolbar, calendar etc.)A reusable component typically consists of:- several Action classes- several ActionForm classes- several JSPs- other classes- other resources, for example, property files- some configuration code in struts-config.xmlGary, in your post you address the issue of control flow. I see some moreissues:How can I package such a reusable component, transport it and make it easy for others to add it to their application?- What is a suitable file structure?- Upon installation: How is the configuration of the reusable component merged with the configuration of the main application?- How do I document such a reusable component.I think it would be a big plus for Struts to support such a concept of reusablecomponents. Being able to easily exchange application components would give the community a boost.Has anything like this been considered, discussed, implemented? Do others agree that it would be useful? Any ideas on a good way to approach this?Gabe SidlerSoftware Consulting, Eivycom GmbH, Zurich, SwitzerlandGary Johnston wrote: Thanks for your response, Ted. Yes, I see that inheritance can be used to capture the common code to validate the user's login status and branch ("goto") accordingly. But I'm thinking of reuse in terms of components at a higher level than classes and inheritance. I'd like to be able to reuse the whole login *sequence* (which is probably at least 1 JSP, which has the userid/password fields, and a subsequent action, which validates the userid/password). Other subsequences I might like to define and use might be much more extensive. I'd like to be able to invoke a subsequence such that when it completes the application picks up just after where it was when the subsequence was invoked. Semantically, I'd like to be able to "call" a subsequence, rather than simply doing a "goto" to its first element (page, action). The problem is that forwards are, essentially, "goto"s. What I really want is some general mechanism that gives me the ability to "call" a subsequence such that when it completes ("returns") my application continues on from right after where I invoked it. Using your example code, let's say I've built a subclass that displays the user's bank account balance. If the user were already logged on then the subclass would, presumably, retrieve the user's account balance and return a forward to a JSP that would display it. If the user were *not* logged on, however, then a forward to the logon page is returned. But because this is just a "goto", my subclass action has no way to specify that control should return to it after the logon subsequence completes. Put another way, when coding the
RE: How to not use FormBean
Bryan: I'm new to struts and have a couple questions about FormBeans. By way of example of a technique that doesn't require formbeans, but still maintains many of their advantanges, you might want to check out how we've integrated Struts into our OSS framework, Expresso. Expresso uses a component called a Controller to encapsulate states, where all the business logic of the application occurs. When a Controller transitions from state to state it produces a ControllerResponse that has all of the outputs (and inputs and transitions to new states if appropriate). We've enabled the Struts tags to access this response directly, meaning you *can* use a form bean if/where appropriate, but you don't have to if you don't want/need to, while still maintaining many of the advantages. Just one way of doing things, certainly not the only way, but I thought it might be useful as an example to you. Regards, Mike Jcorporate Ltd. http://www.jcorporate.com The application we're developing will have quite a few forms and I wanted to avoid creating a separate form bean for each JSP form. I thought I read that I don't have to use FormBeans, but when I try, I get an exception Cannot retrieve definition for form bean. What is the proper way of not using FormBeans? In my struts-config, I left out the name attribute. Is this correct? Do I have to use FormBeans if I'm using the HTML taglib? Thanks Bryan
RE: Any Struts User uses the Expresso Framework ?
Kent: I think it really depends on your requirements and the skill level of your developers. I personally would be careful about trying to learn and combine two frameworks, even if they serve two different purposes. Actually, the combining is already done - we have Struts 1.0 fully integrated with Expresso, thanks to Strut's clean design it was a pretty painless process. Even though frameworks can be helpful, many times they can frustrate the development process. Even though I am a supporter of Struts, there is a learning curve, and it can be big depending on what you are trying to do. Most of my learning curve with Struts was trying to learn it the right way. Absolutely. The biggest issue we've had with people using Expresso (even before integration) was that it's large - it does a lot, and takes a while to come to grips with - it integrates something like 7 other OSS projects, after all :-) We're trying to answer that with better doc, better examples, etc, but it'd difficult, no question about it. I guess the bottom line is whether after the learning curve the productivity increase makes it worth it. From my POV, that's very much the case. I to agreee with the statement struts is somewhat independent of J2EE. The great thing about Struts is that it is very flexible, and of course it is open source. One word of advice on your data layer, I would highly recommend staying away from entity beans (Most developers that I have talked to do not use them, and for a very good reason). I recommend using JDBC in your session beans for updating, and data access beans for read only access. Interesting... I had indeed heard that before, and it actually works to our advantage in one way: if I can deploy our Controller objects (the business logic) as Session beans, they already use the DBObject layer in Expresso to do their database access (which is, by default JDBC-based). So it's one less object to convert... and probably runs faster. That's good news, thanks! We've already got distributed caching on the way for the DBObject layer, so that issue is covered... That is if performance is important to you. If you take this approach, you will be free to do whatever you want. For whatever its worth, I appreciate the feedback, thanks! Regards, Mike Jcorporate Ltd. http://www.jcorporate.com
Is empty body allowed for logic:present?
Hello all: I just spent an hour chasing down a silly mistake, and was wondering if there were a way to prevent it: logic:present name=something/ pOk, it's here!/p /logic:present and logic:present name=something/ pNo, not here!/p /logic:present Will display: Ok, it's here! No, not here! Of course, the problem is that I fumbled the closing of logic:present (e.g. I shouldn't have that trailing /, just a ), but this only dawned after much head-scratching though, as I was using an extension of the present tag and of course immediately assumed it was a bug in my extension of the tag :-) I'm wondering if the tag can catch the fact that it's bodiless, and should it be allowed to be bodiless? Maybe this has been caught before, or maybe there's no way to go about it, but I didn't see anything on a quick search of the archives... Regards, Mike Jcorporate Ltd.
RE: ServletUnit with Struts
Jim: One of our contributors has just recently integrated Cactus with our framework, and Struts components can be tested that way as well, and we've used Junit for some time too. You may find some useful code for what you're doing that way... I know he did a lot of work getting the initialization to come up clean, so it may save you some time, if I understand what you're looking for correctly. Regards, Mike http://www.jcorporate.com I'm trying to test ActionObjects painlessly with Mock Objects of some kind; I don't want in-container test cases particularly. I'm trying to use ServletUnit, which is part of HttpUnit, as a starting point and am having a difficulty, not surprisinglym with the ActionServlet initialization. Here's a snippet of the test code: WebRequest request = new PostMethodWebRequest (http://test.meterware.com/actionServlet;); request.setParameter etc. set some parms for testing... WebResponse response = sc.getResponse(request); The above line throws an exception when I run the testcase: javax.servlet.UnavailableException: Missing configuration resource for path /WEB-INF/struts-config.xml at org.apache.struts.action.ActionServlet.initMapping(ActionServlet.j ava:1316) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:465) at javax.servlet.GenericServlet.init(GenericServlet.java:258) at com.meterware.servletunit.InvocationContext.getServlet(InvocationC ontext.java:69) I have added the war file for my application, which includes the /WEB-INF/struts-config.xml, at the bottom of my classpath that the testcase runs under junit with. Hmmm, just putting this email together I spotted something. The resource is obtained via getServletContext().getResourceAsStream (/WEB-INF/struts-config.xml). The servlet context must not be such that it is able to find that path in my war. Anybody used ServletUnit with Struts? Or some other Mock Objects solution? tia, Jim Weaver
RE: Security, authentication and authorisation with Struts
Jonathan: Another approach you may want to look at is the way we've done the Struts integration with our own OSS framework, Expresso: We subclass Action in our Controller class, and the Controller class actually does all of the authentication/authorization work for us. There of course more to it than that, but that's the gist - you can read about it at http://www.jcorporate.com/doc/index.html - the Expresso Developer's Guide explains about our Controller objects (basically finite-state machines that contain the application's logic) and there are a couple of write-ups in the index about how Struts and Expresso fit together. We have optional strong encryption for Expresso's entire security layer (and it's object/relational mapping layer), which is also discussed in the doc, making it possible to implement a highly secure application at all levels. Hope it's helpful! Regards, Mike Jcorporate Ltd. http://www.jcorporate.com -Original Message- From: Jonathan M Crater [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 10:45 AM To: [EMAIL PROTECTED] Subject: Re: Security, authentication and authorisation with Struts i would prefer not to put the authentication code in the action because it opens the possibility of having authentication logic in each and every action, which would essentially defeat one of the main purposes of having a controller in the first place--one point of access for security reasons. it seems to me that subclassing ActionServlet and/or adding authentication code to it are preferable to distributing the authentication logic across x number of action classes. [EMAIL PROTECTED] wrote: wouldn't it be better to put this code directly into the action servlet and rebuild struts? That goes against my code-reusability instincts. I strive to use the default struts build and default tag libraries. The other possibility would be to put this in the Action class. Before it checks the authorization, it could verify that it is in the session. If not, put it there. I don't do this because I also put an object in the application scope (for complicated reasons) and it seems silly to put this code in the Action code which is rather far from the application level. i'd also be interested in hearing the rationale behind the desire not to subclass ActionServlet from those of you who prefer to avoid it. Me too. Works fine for me. Devon
RE: User management?
Jon, Tom: You might want to check out what we're doing in Expresso (www.jcorporate.com) for user security. We're in the process of integrating Struts as one of the front-end/UI choices available for Expresso apps, and the models are pretty compatible. Mike Jcorporate Ltd. http://www.jcorporate.com -Original Message- From: Jon.Ridgway [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 11:28 AM To: [EMAIL PROTECTED] Subject: RE: User management? Hi Tom, Struts provides the template tag, one of the options for this tag is 'role'. This uses request.isUserInRole (). User roles are setup by the containers security mechanism. I haven't found a way to programmatically set user roles. So if you want to use the 'role' option of the struts template tag you have to use container based security. See http://jakarta.apache.org/struts/api/org/apache/struts/taglib/temp late/packa ge-summary.html#package_description and http://jakarta.apache.org/struts/struts-template.html for further details. Jon -Original Message- From: Tom Miller [mailto:[EMAIL PROTECTED]] Sent: 11 June 2001 14:51 To: [EMAIL PROTECTED] Subject: Re: User management? Jon What is struts role based templating? Sounds good but I am not familiar with the technique. Thanks Tom Miller Jon.Ridgway wrote: Hi, You seem to facing the same problem that I am. I'm using tomcat to do form based auth. This way I can take advantage of container security features and use the struts role based templating. I invoke the form based auth by invoking an action class within a secured area. This way the user logs in then I collect user data/preferences etc from my db. There doesn't appear to be anything in struts that can help. Does anyone have a better way, i.e. extending tomcat login class, JAAS etc. What I'm really after is a mechanism that will work with all containers. Jon.