This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
This week we are giving away 4 copys of the book "Struts in Action: A Practical Guide to the Leading Java Web Framework". And the best part... the Author, Ted Husted, will be online to answer your questions Read Chapter 12 - Validating user input on-line!<br> <br> Thanks to the people at [url=http://www.manning.com/>Manning Publishing[/url] for the Books!
Hi Carl, I would like to thank you. I'm very interested by this book.I'm preparing SCWCD and i directly intend to go to Struts for MVC acchitecture. I already developped with Struts but not enough knowledge about it and EJB. I want to develop EJB with Struts. How much is important to develop whith Struts ? more security ? and about hacking ?Thank you for understanding.
Here is information about an example application I created demonstrating a nice way to deal with validation in Struts. It uses XDoclet to generate the validation.xml file from tagged form bean setters. Below is from a post where I announced this application to the world. Please only contact me about this application using the e-mail address below, do not reply about it in this forum as I am not a frequent visitor here. I'm tuning in this week to check out the Q&A with Ted Husted! ---------- The application I used in my September TriJUG presentation, and thereafter at several symposiums, another JUG (NOVA JUG) and ApacheCon has now been bundled for mass release. It is a trimmed down version of the application Steve and I developed for our Java Development with Ant book. Relevant to Struts folks are these tidbits: - XDoclet is generating struts-config.xml, validation.xml, web.xml, and antbook.tld - LabelTag (currently mysteriously busted for required tagging) is included. This tag styles field labels differently if its in error, and (when its not busted, it works on my production app actually) it shows an asterisk by required fields. - strutsgen: a one-off starter generation for JSP's and ApplicationResources.properties snippets for cutting and pasting into the main application. It uses XDoclet to process a specified form bean and uses the fields it finds for generation. - Use of StrutsTestCase for Cactus testing. - Maybe some other Struts goodies lurking there that I've forgotten to mention. For XDoclet folks, these are of interest: - The strutsgen subproject uses custom templates and a custom tag handler demonstrating some powerful features of XDoclet. - Use of Ant property substitution in XDoclet tags. - Use of XDoclet template tags in merge points, showing how to do some conditional things out-of-the-box with XDoclet (turning Cactus servlet on and off, in this example). The application itself is a document search engine, based on Lucene, and should run out of the box in Tomcat or JBoss. It even has the ability to (at build time) toggle between whether to use a session bean or not (functionality is the same either way). By default, you can simply deploy the WAR that you've built and it will work without EJB, but if you are interested in exploring the session bean piece it can be turned on. I am in the process of creating much more detailed documentation, but I wanted to get this out sooner rather than later. If you find any problems or have any questions, please do not hesitate to let me know so I can refine it and post updates. The one documentation I need to provide now is to note that you'll need j2ee.jar to build (from the J2EE 1.3+ SDK). I include all other API's. To build, unzip the file (link below) and it will expand into JavaDevWithAnt directory. In that directory, run Ant. If you have J2EE_HOME set you shouldn't need to do anything... just "ant". You'll also need to build a site index, so run "ant build-site-index". This is intentionally two separate steps. If you don't have J2EE_HOME set, then you need to provide j2ee.jar to the build. Do it this way: ant -Dj2ee.jar=/path/to/my/j2ee.jar Where "/path/to/my/j2ee.jar" is the actual path to your j2ee.jar Post any questions/problems to me directly. E-mail me at JavaDevWithAnt@ehatchersolutions.com. Download: http://www.ehatchersolutions.com/downloads/ Latest version is 0.3, and its been proven to work on Windows and Mac OS X. You will need Ant 1.5(.1) and JUnit 3.8(.1).
Hello Ted, I would also like to know about validation with Struts. What happens if I want to validate a number to make sure it is greater than 0. For instance if I wanted to check someone's age on a form. Could the user enter -17 and would that be a valid answer since that is a valid integer? When I validate could I validate on a range of numbers? Thanks in advance for your time, Ryan
SCJP 1.4, SCWCD
Java: The power, elegance, and simplicity of a hand grenade
I have also started working on Struts Frame work recently.I am still in the process of getting to understand Struts fully. I wanted to know , what TILES and VELOCITY does . Are they also used along with Struts ?
Hey Ted, I'm working on my second site using Struts and really like it, but some days it can drive me up the f@#$% wall. Others have the same problem and the reason is simple. No CRUD examples w/Struts distribution. All the .war files that come with the distribution are 'taste testers'. I'd love to work on struts-crud.war for the next release. It would contain a CRUD with at least one example of all the struts tags and have ample code documentation. Many developers have to go to your site and download Artimus or Scaffold, which are okay, but are not really suited for learning. We also search the web for struts issues and normally find ourselves in a threaded message boards or some site in japan.... Anyway, I don't mean to offend, as you've obviously given rebirth to JSP open source, but I hope you'll continue to keep up the good with Struts. Thanks, PP Sun Certified Programmer for the Java 2 Platform Sun Certified Web Component Developer for J2EE
Peter, as someone new to struts, I'd like to avoid as many pitfalls as possible. could you please elaborate on the nature of CRUD and why it has made your life difficult when developing with struts? thx.jh
Joined: Jul 11, 2001
Hey John, CRUD - Create Retrieve Update Delete. CRUD is used to describe common application functionality. As for developing a CRUD using Struts, the Framework is very rigid, because it's so new which makes doing simple things complex. For instance, the Struts framework promotes using tags in JSP. However, let say you wanted to display 50 records and change the background color of the odd records. To do this you'll have to 'bend' the framework and use a scriptlet within JSP or create a custom tag... That's a simple example, but in essence providing the purety of MVC (model-view-controller) architecture using Struts is not a simple task. However, Struts is a big-step in the right direction. Hope this helps PP
Originally posted by Roger Garner: Doesn't struts take care of all validation itself. I thought it had built in routines for integer and nulls?
Unfortunately Struts does not take care of all validation. You can careful write `ActionForm' beans to do this. When I developed a professional Struts app for a financial bank, I called the validation code in the action forms from my `Action' classes. This is because the Action hook into the business tier, calling the EJBs via a business delegate or session facade. Struts is a framework for the presentation tier. I am also a core committer to the ``Expresso Framework'', which integrates the Struts 1.0.2 MVC. For more infos http://www.jcorporate.com/ I am also looking for Server Side Java developer job in London, England http://www.xenonsoft.demon.co.uk/curriculum-vitae.html I have also written an article for `TheServerSide.com' Regards Peter Pilgrim
--<br />[bold]Peter Pilgrim[/bold]<br />Java EE Developer, Designer and Architect<br/>Oracle Java Champion<br /><a href="http://jroller.com/peter_pilgrim" target="_blank" rel="nofollow">http://jroller.com/peter_pilgrim</a>
Ted, I'm also new to Struts and I'm very interested hear any tip/examples you might have for the framework as a whole. I'm especially interested in incorporating Tiles in the views I'm working on. Thanks, E
My theory of evolution is that Darwin was adopted. - Steven Wright
Originally posted by Ram Bal: I have also started working on Struts Frame work recently.I am still in the process of getting to understand Struts fully. I wanted to know , what TILES and VELOCITY does . Are they also used along with Struts ?
Can't comment on TILES. Velocity you can think of as being a Perl-like way of writing JSP pages. I worked on a couple of projects where we used it, and we found it to be a pain in the neck. Some people seem to really like it, so I guess it comes down to "your mileage will vary". If your intent is to have a clean MVC implementation, then you really have to think carefully about how you will organize your Velocity code. Struts the breakdown into MVC is already there for you.
Hi Ted, I have some question regarding Struts & its futures : 1. How would you compare Struts to other Java-MVC frameworks like Turbine, Maverick, WebWork ? 2. Where do you see the place (how it can works together) for Struts in regarding with the coming Java Server Faces standard ? 3. Is there any standard about how to integrate Struts with IDE (as J2EE IDE/App generator are coming their way...) ? 4. What are direction that Struts will be evolved into (ie. features...) ? Thanks for you time,
See El<br />SCJP2, SCWCD, IBM XML, SCBCD
Joined: Mar 09, 2001
Originally posted by Gregg Bolinger: Wow, 25 posts, and Ted has yet to respond to any. Hmmmmmmmm.
Ted has responded to a few posts, but not any in this particular thread.
One of the greatest benefits of Struts is the active user community. I've been watching for orphan threads with no replies, but when others are already replying, I like to let the community speak for itself =:0) If there are posts here that haven't been addressed, I'd suggest starting a new thread so it shows up on the BBS. -Ted.
<a href="http://husted.com/struts/book.html" target="_blank" rel="nofollow">Struts in Action</a>
hi Ted and every body, I have been working on some project using the struts frame work. I have never heard of jakarta struts before to be honest but I was forced to work on it since my friend left the job which he has started in struts a while ago. Ever since then, I have been working hard to get to know this framework. This forum has been the biggest help and I want to thank the whole community for that. I am almost done with the project now. I think for a person new to stuts, the best thing will be to provide them with a simple, fully functional example that they can always refer to when they get lost. I did not get a good example that encapsulated most of the concepts of struts. So Ted do you have such an example in your upcoming book? Do you think it is a good idea to have an example like that people can have so that they learn faster? Thank you and have a blessed day to you all. Lee.