About the author
Rick Hightower is CTO of Mammatus and is an expert on Java and Cloud Computing
Wednesday, March 03, 2004
Wednesday, January 28, 2004
Big Demo: Okay so I hit some milestones in the project. Today was the day to demo the product (in progress) to the customer. I give a few test runs before the big meeting. Everything works. During the meeting..... I run the demo (the most important part works), then another feature breaks with a problem I have never seen before. I run it again later, and can not reproduce the problem. I showed the customer the feature (working). I hate demos. The chance of something going wrong during a demo is so much higher than when not doing a demo. Why? Oh well. It is a work in progress.
JRoller seems to be down... I am back to using blogger.
JRoller seems to be down... I am back to using blogger.
Sunday, January 18, 2004
Moved to JRoller
JRoller
This blog has moved to JRoller. I am going to keep this blog site for a while. But for the latest and greatest blog stuff go to my JRoller account.
This blog has moved to JRoller. I am going to keep this blog site for a while. But for the latest and greatest blog stuff go to my JRoller account.
Saturday, January 17, 2004
SourceBeat - Open Source Documentation for Eclipse, Tomcat, Struts, Apache, Perl and more...
SourceBeat - Open Source Documentation for Eclipse, Tomcat, Struts, Apache, Perl and more...
Hey... I got mentioned on this site! Free plug for me.
"SourceBeat is the first publisher to create always updated open source technology books, written by expert authors such as James Goodwill, Rick Hightower, Bill Dudney, and many others. Utilizing our patent-pending "OpenBook™” process, you are always sure of getting the best information regarding the open source topic."
Hey... I got mentioned on this site! Free plug for me.
"SourceBeat is the first publisher to create always updated open source technology books, written by expert authors such as James Goodwill, Rick Hightower, Bill Dudney, and many others. Utilizing our patent-pending "OpenBook™” process, you are always sure of getting the best information regarding the open source topic."
Friday, January 16, 2004
I just bought four books:
JUnit in Action written by Ted Husted and Vincent Massol.
XDoclet in Action by Rickard Oberg, Craig Wall, and Norman Richards.
Expert One-on-one J2EE design and Development by Rod Johnson. There are no books on Spring yet, but I heard much of the Stuff that is in Spring is covered in this book.
Patterns of Enterprise Application Architecture by Martin Fowler.
I almost bought Contributing to Eclipse: Principles, Patterns, and Plugins by Erich Gamma, Kent Beck, but I went way passed my monthly book allowance already.
I think I have every book Kent Beck has written. I like his writing style, and his message. It is on my wish list.
I am currently writing a book. I've written several hundred pages so far. In fact, I need to get back to my writing now. L8er
JUnit in Action written by Ted Husted and Vincent Massol.
XDoclet in Action by Rickard Oberg, Craig Wall, and Norman Richards.
Expert One-on-one J2EE design and Development by Rod Johnson. There are no books on Spring yet, but I heard much of the Stuff that is in Spring is covered in this book.
Patterns of Enterprise Application Architecture by Martin Fowler.
I almost bought Contributing to Eclipse: Principles, Patterns, and Plugins by Erich Gamma, Kent Beck, but I went way passed my monthly book allowance already.
I think I have every book Kent Beck has written. I like his writing style, and his message. It is on my wish list.
I am currently writing a book. I've written several hundred pages so far. In fact, I need to get back to my writing now. L8er
between the lines: For whom do those e-bells toll? Ask promoOrder
between the lines: For whom do those e-bells toll? Ask promoOrder: "'The reason I think eBlox will succeed is we're self-funded,' says CEO Brent Buford. 'We don't have those outside investors telling us we have to perform a certain way. In the case of PromoFuel, we hit our stride right when the economy went down the tank.'"
My old boss tells it like it is. Venture Capital stinks. You don't want somebody who made their money seeling coin operated laundry machines how to run your software company.
My old boss tells it like it is. Venture Capital stinks. You don't want somebody who made their money seeling coin operated laundry machines how to run your software company.
Software Development Conference and Expo West 2004
Software Development Conference and Expo West 2004
I'll be speaking at SD West on extending Struts and J2EE development with Ant.
Extending Struts
Description: Okay you think you have mastered Struts, but you wish it could just do this one special thing? This session shows you how to go beyond the Struts basics to extend the framework to fit you needs. Struts was designed to be extensible. Learn how to extend it. Advance Struts topics about extending the framework using Struts plugins, and extending the Action Servlet, Custom Actions, the RequestProcessor, and more. This is an advanced topic that assumes previous knowledge of Struts.
J2EE Development with XDoclet and Ant
Time/Date: Friday (March 19, 2004) 10:30 am - 12:00 pm
Track: Java Programming
Format: Class
Level: Intermediate/Advanced
Description: This class covers developing J2EE components with XDoclet. XDoclet can drastically speed J2EE development by generating component support files by embedding meta data in what looks like JavaDoc tags of the component implementation. This class will also demonstrate developing Custom Tags, Entity Beans, Session Beans, and Struts Actions with the assistance of XDoclet combined with Ant.
I'll be speaking at SD West on extending Struts and J2EE development with Ant.
Extending Struts
Description: Okay you think you have mastered Struts, but you wish it could just do this one special thing? This session shows you how to go beyond the Struts basics to extend the framework to fit you needs. Struts was designed to be extensible. Learn how to extend it. Advance Struts topics about extending the framework using Struts plugins, and extending the Action Servlet, Custom Actions, the RequestProcessor, and more. This is an advanced topic that assumes previous knowledge of Struts.
J2EE Development with XDoclet and Ant
Time/Date: Friday (March 19, 2004) 10:30 am - 12:00 pm
Track: Java Programming
Format: Class
Level: Intermediate/Advanced
Description: This class covers developing J2EE components with XDoclet. XDoclet can drastically speed J2EE development by generating component support files by embedding meta data in what looks like JavaDoc tags of the component implementation. This class will also demonstrate developing Custom Tags, Entity Beans, Session Beans, and Struts Actions with the assistance of XDoclet combined with Ant.
Thursday, January 15, 2004
Erik Hatcher - Blog
Thanks Erik (Erik Hatcher - Blog). Erik is always so way ahead of the curve. I have to check what technology he is working with so I know what technology I will be working with in 6 months. It was fun working with Erik at eBlox.
logic:present and logic:notPresent good for model 2 but use JSTL instead
The and tags check to see if headers, request parameters, cookies, JavaBeans or JavaBean properties are present and not equal to null. You can specify the string which can be a cookie, header, request parameter or bean property by using the attributes cookie, header, parameter, or name & property. Additionally you can check to see if the current users is in a certain role using the roles attribute (this integrates with the J2EE security model).
TIP: both the and fits really well in a Model 2/MVC architecture. You can allow the controller, i.e., your actions, to decide which objects to map into scope based on executing business rules of your application model. The JSP page, which should have very little logic in it, will just check to see if an object is in scope and if it is in scope then it displays the object. This way if the underlying business-rules of the model changes, it does not affect the JSP code. The JSP never knows why it's displaying object just if that object is present then it should display that object. It's up to the controller to decide which objects to map into scope after executing business rules on the model.
You can do the same thing as the logic:present and logic:notPresent tags using JSTL. New projects should use the JSTL equivalent.
EL would be foo!=null
or not empty foo
Best Struts Course, Struts Training, Struts Consulting
TIP: both the
You can do the same thing as the logic:present and logic:notPresent tags using JSTL. New projects should use the JSTL equivalent.
EL would be foo!=null
or not empty foo
Best Struts Course, Struts Training, Struts Consulting
Wednesday, January 14, 2004
A Sleepless Night in Tucson
A Sleepless Night in Tucson
I read my blog entry from last night, and I realize it had a little too much bile in it.
I read my blog entry from last night, and I realize it had a little too much bile in it.
Tuesday, January 13, 2004
Amazon.com: Books: Professional Jakarta Struts
Amazon.com: Books: Professional Jakarta Struts:
Sooyoung Park write a review as follows.....
Any self-respecting Linux/Java developer can translate instructions from Windows/DOS into Linux, if not they should not be using Linux. We also don't have instructions for AIX, Solarix and HP-UX.
Is not! Check out the javadocs from the nightly build for FormFile. It is not deprecated. The book does not cover Jakarta FileUpload directly as it is used under the covers by Struts. Look a little further and you will find CommonsMultipartRequestHandler.CommonsFormFile. This class implements the Struts FormFile interface by wrapping the Commons FileUpload FileItem interface.
So in short.... You don't know what you are talking about. Spend some time on the Jakarta web site before you criticize me for not spending time on the Jakarata web site.
Sooyoung Park write a review as follows.....
"I have two gripes with this book. First, it's really a shame that the authors didn't take the time to include information about Unix/Linux installation and configuation since the vast majority of us will be deploying on those platforms, if not developing on them outright.
Any self-respecting Linux/Java developer can translate instructions from Windows/DOS into Linux, if not they should not be using Linux. We also don't have instructions for AIX, Solarix and HP-UX.
Secondly, the book is a little behind the curve regarding Struts 1.1. For example, the use of Struts tag libraries has been considerably simplified and the file upload example on page 391 uses the deprecated FormFile class instead of Jakarta FileUpload. It's only natural for APIs to change, but if you plan on buying this book, be prepared to spend some additional time on the Jakarta web site. "
Is not! Check out the javadocs from the nightly build for FormFile. It is not deprecated. The book does not cover Jakarta FileUpload directly as it is used under the covers by Struts. Look a little further and you will find CommonsMultipartRequestHandler.CommonsFormFile. This class implements the Struts FormFile interface by wrapping the Commons FileUpload FileItem interface.
So in short.... You don't know what you are talking about. Spend some time on the Jakarta web site before you criticize me for not spending time on the Jakarata web site.
Amazon.com reviews are a farce.
Amazon.com reviews are a farce.
Who says there is no drama in our industry?
I've been reading WSI profile spec. until my brain started bleeding, when I found the above link in an unrelated track of thinking. If you like controversy, and heated debated then you will love the above.
I hardly every buy books based on their Amazon review. I may be old fashioned but I usually go to the book store and read chapters from the book first. I spend at least an hour reading through a book before I buy it. Unless, it is the only book on the topic.
Who says there is no drama in our industry?
I've been reading WSI profile spec. until my brain started bleeding, when I found the above link in an unrelated track of thinking. If you like controversy, and heated debated then you will love the above.
I hardly every buy books based on their Amazon review. I may be old fashioned but I usually go to the book store and read chapters from the book first. I spend at least an hour reading through a book before I buy it. Unless, it is the only book on the topic.
I got my first endorsement on www.linkedin.com
I got my first endorsement on www.linkedin.com
"I worked with Rick at eBlox - he literally saved the company from a sure death and he documented much of our experiences in the fantastic Java Tools for Extreme Programming book. Rick is a jack of all trades, and master of most - I wish he was on my team now!" -- Erik Hatcher
If you are going to get an endorsement..... getting one from Erik Hatcher is a good thing. Erik Hatcher is the Ant, Struts, and WebDevelopment guru.
I dig linkedin.
"I worked with Rick at eBlox - he literally saved the company from a sure death and he documented much of our experiences in the fantastic Java Tools for Extreme Programming book. Rick is a jack of all trades, and master of most - I wish he was on my team now!" -- Erik Hatcher
If you are going to get an endorsement..... getting one from Erik Hatcher is a good thing. Erik Hatcher is the Ant, Struts, and WebDevelopment guru.
I dig linkedin.
Struts book doing well: Professional Struts
For a while the first edition of our Struts book was outselling the second edition. It sure did not help that the first edition was under a Wiley imprint and the second edition was under a Wrox imprint, and they changed the name of the book. My understanding is that Wiley bought the rights to Wrox name and their best selling books when Wrox went out of business. Now the book is third on Amazon (out of all Struts books), which is not too bad considering the Orielly's book and Ted Husted's book are number 1 and 2. For a while, the book was second on bookpool right after the Orielly book, which blows my mind. Now the book is no longer second on book pool, it is has dropped. This could be because bookpool is out of stock! Come on. You may wonder why I care. Mainly, if I am going to spend time writing a book, I want people to read it. Perhaps this is vain. The biggest complaint about the book seems to be that it does not cover Linux installation. Hey, if you can not translate the Windows instructions to Linux instruction in your head, then you probably should not be using Linux. We expect more from Java/Linux developers.
Monday, January 12, 2004
The Artful Blogger: Struts jobs in London... Struts jobs in the US.
The Artful Blogger: Struts jobs in London
Hmmmm.... this made me think.... what about the US?
I checked Dice....
370 Struts jobs in Dice.
1 WebWork job in Dice. (0 for WebWork2)
The momentum still seems to be behind Struts. I think Struts and JSF is the ticket (Struts + JSF). Hmmmm....
Hmmmm.... this made me think.... what about the US?
I checked Dice....
370 Struts jobs in Dice.
1 WebWork job in Dice. (0 for WebWork2)
The momentum still seems to be behind Struts. I think Struts and JSF is the ticket (Struts + JSF). Hmmmm....
Struts vs. WebWork
Jason Carreira
Another WebWork vs. Struts comparison.
Struts has great IDE support. WebWork has some very cool features, but none that cannot be added to Struts. There are parts of WebWork I really like, but everywhere I go, the client is using Struts. Hmmmmm.....
Another WebWork vs. Struts comparison.
Struts has great IDE support. WebWork has some very cool features, but none that cannot be added to Struts. There are parts of WebWork I really like, but everywhere I go, the client is using Struts. Hmmmmm.....
rebelutionary: Open Source FUD - The Verge Framework
rebelutionary: Open Source FUD - The Verge Framework
To rebelutionary (a.k.a. Mike Cannon-Brookes),
I agree.
I don’t know anything about the Verge framework. It might be the greatest thing since sliced bread, but Struts and WebWork are established and does the world need another front controllerish framework?
How many IDE’s support Verge?
How many books are written about Verge?
You probably don’t remember me. But, we met at TheServerSide.com.
I read your book: “Java Open Source Programming”.
I must say I really dig it. I’ve used most of the tools you cover before, except WebWork and XWork (a bit of a Struts guy…pays the bills).
I had a hard time with the XWork chapter, but I did a little research online, and I got it. The second go round made more sense after doing a little research.
Great job. I like the ideas and design of WebWork. Give Joe Walnes.... my regards.
--Rick Hightower
To rebelutionary (a.k.a. Mike Cannon-Brookes),
I agree.
I don’t know anything about the Verge framework. It might be the greatest thing since sliced bread, but Struts and WebWork are established and does the world need another front controllerish framework?
How many IDE’s support Verge?
How many books are written about Verge?
You probably don’t remember me. But, we met at TheServerSide.com.
I read your book: “Java Open Source Programming”.
I must say I really dig it. I’ve used most of the tools you cover before, except WebWork and XWork (a bit of a Struts guy…pays the bills).
I had a hard time with the XWork chapter, but I did a little research online, and I got it. The second go round made more sense after doing a little research.
Great job. I like the ideas and design of WebWork. Give Joe Walnes.... my regards.
--Rick Hightower
Sunday, January 11, 2004
Dragon NaturallySpeaking.
I just got a new toy. I got a new copy of Dragon NaturallySpeaking. Dragon NaturallySpeaking allows me to write faster (hopefully). It's not perfect, but it is pretty darn cool. So far I taught NaturallySpeaking to recognize words like:
ActionForm;
DynaActionForm;
Work is pretty busy lately. For that I am thankful, but it means that the writing assignments that I have are going to take longer. I just got back from the cold weather. My first day back in Tucson was 75°F--quite a change from last week.
I got a lot of consulting work lately. I should be busy for quite a while which is good. Most of the work involves Struts and Hibernate. I have a new assignment that involves maven. I really enjoy working with maven.
It is good to be busy.
By the way, I wrote this blog entry with Dragon NaturallySpeaking. I had to make a few corrections. It did not understand a word blog. It has a training mode. But I have not trained it to understand the word blog yet. You really have to announciate your words, when you're using Dragon NaturallySpeaking. You are supposed to corrected whenever it makes a mistake and train it to listen to the way you speak.
It is supposed to improve as you use it and continue to train it. It'll take a while for it to work the way I want it. Already it is useful.
ActionForm;
DynaActionForm;
Work is pretty busy lately. For that I am thankful, but it means that the writing assignments that I have are going to take longer. I just got back from the cold weather. My first day back in Tucson was 75°F--quite a change from last week.
I got a lot of consulting work lately. I should be busy for quite a while which is good. Most of the work involves Struts and Hibernate. I have a new assignment that involves maven. I really enjoy working with maven.
It is good to be busy.
By the way, I wrote this blog entry with Dragon NaturallySpeaking. I had to make a few corrections. It did not understand a word blog. It has a training mode. But I have not trained it to understand the word blog yet. You really have to announciate your words, when you're using Dragon NaturallySpeaking. You are supposed to corrected whenever it makes a mistake and train it to listen to the way you speak.
It is supposed to improve as you use it and continue to train it. It'll take a while for it to work the way I want it. Already it is useful.
Thursday, January 08, 2004
MVC for Struts Smarties
MVC for Struts Smarties
Mastering MVC and Model 2 with Struts
Struts promotes a Model 2 / MVC architecture. Essentially, Struts architecture is based on the J2EE blue print for Java, which heavily promotes using MVC. It has been said that Struts is the instantiation of the J2EE Blueprint’s view of the Web Tier.
TIP: Read the J2EE Blueprint at http://java.sun.com/blueprints/guidelines/designing_enterprise_applications/index.html.
Many times application can have more than one type of client (e.g., web client, and rich GUI client). For client independence and testability, it is good to develop your applications where the application data and business rules are separated from a particular client implementation. In order to adapt the application to multiple clients and to organize the code into separate areas of concern, you typically implement the systems using a variation of Model-View-Controller Architecture (MVC).
MVC is an open architecture with multiple tiers. The Struts framework uses a variation of MVC that was adapted for web development called Model 2. The following sessions considers MVC/Model 2 and its ramification on Struts usage.
WARNING: Java promotes object-oriented programming, but does not enforce it., i.e., you can create non OO code in Java. Similarly, Struts promotes MVC / Model 2 architecture, but does not enforce it. Making Struts foolproof with regards to MVC is difficult as foolish developers are ingenious. To get the best out of Struts, you need to know MVC / Model 2.
Model Tier
The model is the application data and the business rules of your application. The business rules are the rules for changing your application data. Many types of applications can share your application’s model. The model code should not be dependent on Struts, or the JSP/Servlet API.
The Struts framework provides no model classes per se. All application should have different models.
TIP: The Struts framework does not provide any model objects. Your model is specific to your application. Often developers develop their model with EJB, JDO or Hibernate. The model consists of the persistence layer, and the business rules for modifying the persistence layer.
View Tier
The view tier is what the end-user sees. The view displays parts of the model to the end user. Different types of clients (web client, rich GUI client) have different view. The view should never modify model data directly, nor should it interact with business rules of the model.
The Struts framework does not specify a particular view technology. The Struts framework does provide many JSP custom tags to aid in developing with JSP tags. You can also develop views with other technologies like Velocity (which has Struts tools), JSF and XSLT. Struts is fairly view agnostic.
TIP: Many of the JSP custom tags that ship with Struts are essentially deprecated in favor of their JSTL equivalent (c:forEach vs. logic:iterate). Other Struts custom tags are key to Struts development like html:form.
Controller Tier
A controller acts like the glue between the model and the view. The controller defines the flow of the application. It interprets events from the user (user gestures), and acts like the mediator between the view and the model. It parses the user gestures into actions it performs on the model. Different types of clients require different types of controllers. In Struts, the actions (Action), ActionServlet and config objects (created from struts-config.xml), act as the controller.
The controller accepts user events from the view. In a Web interface, the user events are page loads (HTTP GET) and form submissions (HTTP POST) requests.
To help separate the Model from the View, the controller should convert the request data, scoped beans, and request into business actions. The Struts framework does part of this for you. You do the rest of the conversion as your write action (Action) that act as intermediaries from the web request to the model.
It is the controller job to select the next view to display; this is part of managing the flow of the application. The actions that you write return an ActionForward to the next view. Thus the ActionForward represents the next view in the system. And, it is the job of the actions, you write to return the next view. In the actions you write, you typically interact with the model’s business rules, look up model data, map the model data into scope (request, session, etc.) and then select the next view so the view can display the model data.
Rules for writing proper MVC application with Struts
Rules for the View Tier
The view should never select the next view. This means that the JSP files should never use jsp:forward, logic:forward, logic:redirect, or core:redirect (JSTL) to change the view to a new JSP. Your actions should select the next view by returning the appropriate ActionForward.
Try to only use stupid JSPs. A stupid JSP is a JSP that does not have a lot of logic. Try to limit the logic to looping through collection of data, and displaying objects if they are in scope (logic:present and core:if value=”not empty…). Often times I see JSP errantly sorting data, or checking with a model to see if a part of the page should display. Instead let the Action sort the data before it gives it to the JSP, and let the Action decide if a model object(s) needs to be display by interacting with the business rules of the model. JSP should not know why it is displaying an object if it is there display it. That way if the business rules for displaying the tag changes, the JSP does not change.
A funny thing happened. They added custom tags to simplify JSP development, and remove Java code (Java Scriptlets and Expressions in the JSP) from the JSP. Then people started writing what they use to write in Java in logic custom tags. This helped, but the maintainability problems remained. The key is not only limit the Java code in a JSP, but to limit the logic in the JSP. Keep your JSPs simple and your web application will be a lot more maintainable.
If your JSPs start to have too much logic (Struts logic:* tags, and JSTL core:* tags), move that logic into the action. If your are worried about too much code in your Action, use Action chaining. For example, you could have an Action that sorts the data that another Action put into scope then forward to the JSP.
Rules for the Controller Tier
Actions should be small. Actions should never do JDBC directly. In fact, Action should never talk to EJBs directly, or Hibernate, or etc. Action should instead only talk to façade facets of the model. If you are using Session Facades (EJB), use delegate objects (wrapper object) so that the Action does not talk directly to the EJB. Limiting the Action to only talk to a façade of the model, helps keep the Action testable with unit tests. Conversely, tying the Action to some underlying technology couples the Action to that technology and makes the Action harder to test.
Action should never implement business rules, or perform complex calculations. The Action should delegate those tasks to the model.
Rules for the Model
The model should be completely divorced from the controller. The model should not be dependent on any class in the Struts hierarchy. The individual model objects should be hidden behind a façade.
TIP: A great OO guru once said that the great thing about objects is that they can be replaced. As it turns out, the Controller is more testable if it is divorced from the model implementation. This allows you to substitute stubbed out objects that return hard-coded results needed to test the controller logic in you actions. There are several ways to do this. The controller code (actions), could look up Model facades in a registry, and instantiate them. You could also use an IOC (Inversion of Control) container like Spring, PicoContainer, HiveMind, or XWork. The Spring et al framework is beyond the scope of this discussion, but look for a chapter on using the Spring framework plugin with Struts. The best discussion of IOC, I’ve seen is at http://www.picocontainer.org, which is a type 3 ICO container.
Best Struts Course
New JSF Course
Mastering MVC and Model 2 with Struts
Struts promotes a Model 2 / MVC architecture. Essentially, Struts architecture is based on the J2EE blue print for Java, which heavily promotes using MVC. It has been said that Struts is the instantiation of the J2EE Blueprint’s view of the Web Tier.
TIP: Read the J2EE Blueprint at http://java.sun.com/blueprints/guidelines/designing_enterprise_applications/index.html.
Many times application can have more than one type of client (e.g., web client, and rich GUI client). For client independence and testability, it is good to develop your applications where the application data and business rules are separated from a particular client implementation. In order to adapt the application to multiple clients and to organize the code into separate areas of concern, you typically implement the systems using a variation of Model-View-Controller Architecture (MVC).
MVC is an open architecture with multiple tiers. The Struts framework uses a variation of MVC that was adapted for web development called Model 2. The following sessions considers MVC/Model 2 and its ramification on Struts usage.
WARNING: Java promotes object-oriented programming, but does not enforce it., i.e., you can create non OO code in Java. Similarly, Struts promotes MVC / Model 2 architecture, but does not enforce it. Making Struts foolproof with regards to MVC is difficult as foolish developers are ingenious. To get the best out of Struts, you need to know MVC / Model 2.
Model Tier
The model is the application data and the business rules of your application. The business rules are the rules for changing your application data. Many types of applications can share your application’s model. The model code should not be dependent on Struts, or the JSP/Servlet API.
The Struts framework provides no model classes per se. All application should have different models.
TIP: The Struts framework does not provide any model objects. Your model is specific to your application. Often developers develop their model with EJB, JDO or Hibernate. The model consists of the persistence layer, and the business rules for modifying the persistence layer.
View Tier
The view tier is what the end-user sees. The view displays parts of the model to the end user. Different types of clients (web client, rich GUI client) have different view. The view should never modify model data directly, nor should it interact with business rules of the model.
The Struts framework does not specify a particular view technology. The Struts framework does provide many JSP custom tags to aid in developing with JSP tags. You can also develop views with other technologies like Velocity (which has Struts tools), JSF and XSLT. Struts is fairly view agnostic.
TIP: Many of the JSP custom tags that ship with Struts are essentially deprecated in favor of their JSTL equivalent (c:forEach vs. logic:iterate). Other Struts custom tags are key to Struts development like html:form.
Controller Tier
A controller acts like the glue between the model and the view. The controller defines the flow of the application. It interprets events from the user (user gestures), and acts like the mediator between the view and the model. It parses the user gestures into actions it performs on the model. Different types of clients require different types of controllers. In Struts, the actions (Action), ActionServlet and config objects (created from struts-config.xml), act as the controller.
The controller accepts user events from the view. In a Web interface, the user events are page loads (HTTP GET) and form submissions (HTTP POST) requests.
To help separate the Model from the View, the controller should convert the request data, scoped beans, and request into business actions. The Struts framework does part of this for you. You do the rest of the conversion as your write action (Action) that act as intermediaries from the web request to the model.
It is the controller job to select the next view to display; this is part of managing the flow of the application. The actions that you write return an ActionForward to the next view. Thus the ActionForward represents the next view in the system. And, it is the job of the actions, you write to return the next view. In the actions you write, you typically interact with the model’s business rules, look up model data, map the model data into scope (request, session, etc.) and then select the next view so the view can display the model data.
Rules for writing proper MVC application with Struts
Rules for the View Tier
The view should never select the next view. This means that the JSP files should never use jsp:forward, logic:forward, logic:redirect, or core:redirect (JSTL) to change the view to a new JSP. Your actions should select the next view by returning the appropriate ActionForward.
Try to only use stupid JSPs. A stupid JSP is a JSP that does not have a lot of logic. Try to limit the logic to looping through collection of data, and displaying objects if they are in scope (logic:present and core:if value=”not empty…). Often times I see JSP errantly sorting data, or checking with a model to see if a part of the page should display. Instead let the Action sort the data before it gives it to the JSP, and let the Action decide if a model object(s) needs to be display by interacting with the business rules of the model. JSP should not know why it is displaying an object if it is there display it. That way if the business rules for displaying the tag changes, the JSP does not change.
A funny thing happened. They added custom tags to simplify JSP development, and remove Java code (Java Scriptlets and Expressions in the JSP) from the JSP. Then people started writing what they use to write in Java in logic custom tags. This helped, but the maintainability problems remained. The key is not only limit the Java code in a JSP, but to limit the logic in the JSP. Keep your JSPs simple and your web application will be a lot more maintainable.
If your JSPs start to have too much logic (Struts logic:* tags, and JSTL core:* tags), move that logic into the action. If your are worried about too much code in your Action, use Action chaining. For example, you could have an Action that sorts the data that another Action put into scope then forward to the JSP.
Rules for the Controller Tier
Actions should be small. Actions should never do JDBC directly. In fact, Action should never talk to EJBs directly, or Hibernate, or etc. Action should instead only talk to façade facets of the model. If you are using Session Facades (EJB), use delegate objects (wrapper object) so that the Action does not talk directly to the EJB. Limiting the Action to only talk to a façade of the model, helps keep the Action testable with unit tests. Conversely, tying the Action to some underlying technology couples the Action to that technology and makes the Action harder to test.
Action should never implement business rules, or perform complex calculations. The Action should delegate those tasks to the model.
Rules for the Model
The model should be completely divorced from the controller. The model should not be dependent on any class in the Struts hierarchy. The individual model objects should be hidden behind a façade.
TIP: A great OO guru once said that the great thing about objects is that they can be replaced. As it turns out, the Controller is more testable if it is divorced from the model implementation. This allows you to substitute stubbed out objects that return hard-coded results needed to test the controller logic in you actions. There are several ways to do this. The controller code (actions), could look up Model facades in a registry, and instantiate them. You could also use an IOC (Inversion of Control) container like Spring, PicoContainer, HiveMind, or XWork. The Spring et al framework is beyond the scope of this discussion, but look for a chapter on using the Spring framework plugin with Struts. The best discussion of IOC, I’ve seen is at http://www.picocontainer.org, which is a type 3 ICO container.
Best Struts Course
New JSF Course
Wednesday, January 07, 2004
Kris Thompson's Weblog: Ken's Predictions for 2004
Ken has a list of prediction for 2004.
Kris Thompson's Weblog
His list has inspired mine....
My predictions....
1) Struts will continue to make gains because of the IDE support for Struts.
2) Struts will integrate well with JSF.
3) JSF will be adopted as fast as Struts was.
4) Struts will integrate well with Spring.
5) Projects that use Struts + JSF + Tiles + Spring + Hibernate will be the most common web applications
6) Hibernate will win over EJB CMP/CMR and JDO (continue to win)
7) WebWork style feature will make it into Struts
This will be the year of JSF, Hibernate, and Spring.
JSF is to JSP as ASP.Net is to ASP. JSF will rule supreme.
Hibernate will continue to be the OR mapping tool of choice.
Spring has sprung.
A cottage industry of JSF component development companies will spring up to create GUI Widgets!
GUI Widgets for sale!
Kris Thompson's Weblog
His list has inspired mine....
My predictions....
1) Struts will continue to make gains because of the IDE support for Struts.
2) Struts will integrate well with JSF.
3) JSF will be adopted as fast as Struts was.
4) Struts will integrate well with Spring.
5) Projects that use Struts + JSF + Tiles + Spring + Hibernate will be the most common web applications
6) Hibernate will win over EJB CMP/CMR and JDO (continue to win)
7) WebWork style feature will make it into Struts
This will be the year of JSF, Hibernate, and Spring.
JSF is to JSP as ASP.Net is to ASP. JSF will rule supreme.
Hibernate will continue to be the OR mapping tool of choice.
Spring has sprung.
A cottage industry of JSF component development companies will spring up to create GUI Widgets!
GUI Widgets for sale!
JAVA™ ADVISOR®: Professional Jakarta Struts: Advanced Action Classes - - ADVISOR.com - -
I found my chapter on someone elses blog... thought I would add it to mine....
JAVA™ ADVISOR®: Professional Jakarta Struts: Advanced Action Classes - - ADVISOR.com - -
JAVA™ ADVISOR®: Professional Jakarta Struts: Advanced Action Classes - - ADVISOR.com - -
Cold is too weak an adjective to describe this weather..... Brrrrrrrrrrrrrrrrr.... Maven Guru
I have met the Maven guru! He has done things with Maven that you can only imagine. He has written 6 Maven plugins and created something similar to AntHill, but for Maven. WOW! Cool stuff. We are going to work on the next version of MavenHill together. Cool job.... Cold climate.
Musings, Shock Bloggers on the rise, Good Enough Development, TDD, Loving Software Development again (AOP, IOC, TDD, IF)
I am sitting on a plane flying to the brave, north mid-west.... waiting to get to the 9 degree weather that awaits me. I just saw that new Denzle Washington movie (Out of time... I think). Good movie.
Things have been going really well. I am happy with the progress of work. I've got more work than I can handle, which is a good thing. I am looking forward to speaking at the "No Fluff Just Stuff Software Symposiums" this year.
Mussing...
I've been thinking a lot about JBoss, JMX and JMS as of late (today).
I have a IBM WebShpere project that I need to get started on next week too. IBM WSAD 5.1 is pretty kick butt. Java IDEs are really comming into their own.
A year ago, I was getting kind of sick of Java and J2EE (bored really). Now with JSF, AOP frameworks, IOC containers, great OR mapping tool, advances in TDD (JWebUnit, MOckObjects, etc.), it is all exciting again. Thanks guys... my work is fun again.
I love TDD. I like developing that way. I like writing quality software. I have been test addicted for a while (1996), but have recently taken it to a new level with TDD (thanks Kent Beck for you TDD book; thanks Vincent Massol for explaining the real value of Mock Objects).
I hate pontificating, arrogant developer blogs. I don't like the tone of some developer blogging. I don't like bile(ing) someone. I don't like when other people do it either. I love blogs and even read biles, but don't like it, but am attracted to read them.
I don't like when people take an absured point of view just to get heard. I think I am going to coin a new term for this.... Shock
Bloggers. (kind of like Shock Jocks....)
Hmmmmmmmmmmmmmmm..... How about Shog Bloggers?!
I personally think that everything has a balance, even quality. "No Margin. No Mission." is my mantra! Don't get me wrong. I like writing quality software, and think we ought to be craftsman. But not all projects have to be a work of art... a lot of projects just have to work and provide business value. I am a strong believer of "good enough"; the value of the project has to exceed the development costs (Return on Investment). I feel developers often go overboard with whatever is the newest latest thing or trend. My main focus is to provide value. What can I do to provide business value as soon as possible and as cheap as possible. Don't get me wrong, I am not suggesting shoddy work, but I am suggesting doing easy jobs quickly.
Don't get me wrong....I spend too many hours trying to improve my craft (just look at my bookshelves and ask my wife), but not at the expense of making my clients money.
Yes! It all comes down to money. Business value = money. I want to provide the best solution for the time available. There are other costs like oppurtunity costs. Sometimes it is more important to get it done. If you don't get it done in a timely matter, there will be no second chance. Sometimes you just got to get it done. There is time for improvement later. Keep it simple. The simplest solution that fits the customers needs (sometimes the simplest thing is still complex that is what makes our jobs interesting).
Things have been going really well. I am happy with the progress of work. I've got more work than I can handle, which is a good thing. I am looking forward to speaking at the "No Fluff Just Stuff Software Symposiums" this year.
Mussing...
I've been thinking a lot about JBoss, JMX and JMS as of late (today).
I have a IBM WebShpere project that I need to get started on next week too. IBM WSAD 5.1 is pretty kick butt. Java IDEs are really comming into their own.
A year ago, I was getting kind of sick of Java and J2EE (bored really). Now with JSF, AOP frameworks, IOC containers, great OR mapping tool, advances in TDD (JWebUnit, MOckObjects, etc.), it is all exciting again. Thanks guys... my work is fun again.
I love TDD. I like developing that way. I like writing quality software. I have been test addicted for a while (1996), but have recently taken it to a new level with TDD (thanks Kent Beck for you TDD book; thanks Vincent Massol for explaining the real value of Mock Objects).
I hate pontificating, arrogant developer blogs. I don't like the tone of some developer blogging. I don't like bile(ing) someone. I don't like when other people do it either. I love blogs and even read biles, but don't like it, but am attracted to read them.
I don't like when people take an absured point of view just to get heard. I think I am going to coin a new term for this.... Shock
Bloggers. (kind of like Shock Jocks....)
Hmmmmmmmmmmmmmmm..... How about Shog Bloggers?!
I personally think that everything has a balance, even quality. "No Margin. No Mission." is my mantra! Don't get me wrong. I like writing quality software, and think we ought to be craftsman. But not all projects have to be a work of art... a lot of projects just have to work and provide business value. I am a strong believer of "good enough"; the value of the project has to exceed the development costs (Return on Investment). I feel developers often go overboard with whatever is the newest latest thing or trend. My main focus is to provide value. What can I do to provide business value as soon as possible and as cheap as possible. Don't get me wrong, I am not suggesting shoddy work, but I am suggesting doing easy jobs quickly.
Don't get me wrong....I spend too many hours trying to improve my craft (just look at my bookshelves and ask my wife), but not at the expense of making my clients money.
Yes! It all comes down to money. Business value = money. I want to provide the best solution for the time available. There are other costs like oppurtunity costs. Sometimes it is more important to get it done. If you don't get it done in a timely matter, there will be no second chance. Sometimes you just got to get it done. There is time for improvement later. Keep it simple. The simplest solution that fits the customers needs (sometimes the simplest thing is still complex that is what makes our jobs interesting).
Tuesday, January 06, 2004
Good couple of days.... I like JBoss.... MyEclispe ROCKS!
What a great couple of days..... I just spent the last two days in Phoenix. I was called into do an architectural analysis and provide mentoring for this future, strategic application.
While I was on vacation in Colorado, I got called to go to Phoenix and do some Struts Consulting and some Struts Mentoring .... it turned into being a lot more than that. I only had two days to spare as I had previous commitment doing Maven Consulting and they needed someone ASAP. The engagement ended up being a lot more than Struts Consulting and some Struts Mentoring . We did a lot of of work with JMS. I knew JMS well but it has been a while since I used it--turns out I was not very rusty. (I worked on a JMS implementation in the past for a EJB container company. And, I wrote a JMS course as well as courses that uses MDB. And, I have used JMS on several project... just not recently).
They discussed their application for about 1/2 day. Then they discussed their marketing goals and vision. It was good background. I was very familiar with their domain (too familiar).
They wanted advice about how to use J2EE/Struts/JMS/EJB/MDBs/MOM. With my previous experience in their particular vertical and my knowledge of the technologies, we were off to the races. I convinced them to use Hibernate for their application instead of EJB CMP/CMR. (This is the nth customer who I have convinced to use Hibernate). (BTW I love Hibernate... Gavin King rocks! The funny part of this is that we were an early adopter of EJB CMP/CMR, and I even spoke about EJB CMP/CMR at JavaOne last year as well as wrote about it at IBM developerWorks, but now I prefer Hibernate. I still use EJB CMP/CMR every now and then when customers want me to, but prefer Hibernate.)
The architecture analysis went so well the first day that we decided to write a prototype the second day. We quickly had a prototype up and running, which consisted of Struts based web app uploading files (using FormFile). The web app would send a notice that the file was uploaded using JBoss JMS. We had an MDB listening to the queue which would then submit the job to be processed... (can't say anything more that).
They are a JBoss shop. I have used JBoss before, but usually use WebLogic or WebShpere. It is not that I do not like JBoss, it is just that most of my clients use BEA WebLogic or IBM WebSphere (I use whatever I get paid to use). I am personally partial to Cuacho Resin. However.....
I found working with JBoss JMS a joy after I convinced them to buy the documentation. ;) We were setting up queues in no time. They recently bought copies of MyEclipse, which is a suite of plugins for Eclipse and J2EE (with XDoclet support). It was a little frustrating because they did not know how to use MyEclispe well (they just got it), and I did not know how to use it at all. But after some trial and error, I found MyEclispe (we found) to be awesome. I am a MyEclipse believer; the XDOclet support is awesome and works well with Hibernate. We started implementing the domain in Hibernate.
It seems like a great project. I hope I get to work on it some more (during the implementation phase). They are still in the planning stages. My contact told me that "You guys exceeded our expectations with your knowledge of the technology (JMS, Struts, J2EE, etc.) and our domain." It was a good feeling moment. Now I am sitting in an air port on my way to another client site. Business is good and busy. At this next client, I am accessing creating a build system (with custom plugins) in Hibernate. Seems like a fun project.
I am going to a place that has 0 degree weather. Brrrrrrrrrrrrrrr......
While I was on vacation in Colorado, I got called to go to Phoenix and do some Struts Consulting and some Struts Mentoring .... it turned into being a lot more than that. I only had two days to spare as I had previous commitment doing Maven Consulting and they needed someone ASAP. The engagement ended up being a lot more than Struts Consulting and some Struts Mentoring . We did a lot of of work with JMS. I knew JMS well but it has been a while since I used it--turns out I was not very rusty. (I worked on a JMS implementation in the past for a EJB container company. And, I wrote a JMS course as well as courses that uses MDB. And, I have used JMS on several project... just not recently).
They discussed their application for about 1/2 day. Then they discussed their marketing goals and vision. It was good background. I was very familiar with their domain (too familiar).
They wanted advice about how to use J2EE/Struts/JMS/EJB/MDBs/MOM. With my previous experience in their particular vertical and my knowledge of the technologies, we were off to the races. I convinced them to use Hibernate for their application instead of EJB CMP/CMR. (This is the nth customer who I have convinced to use Hibernate). (BTW I love Hibernate... Gavin King rocks! The funny part of this is that we were an early adopter of EJB CMP/CMR, and I even spoke about EJB CMP/CMR at JavaOne last year as well as wrote about it at IBM developerWorks, but now I prefer Hibernate. I still use EJB CMP/CMR every now and then when customers want me to, but prefer Hibernate.)
The architecture analysis went so well the first day that we decided to write a prototype the second day. We quickly had a prototype up and running, which consisted of Struts based web app uploading files (using FormFile). The web app would send a notice that the file was uploaded using JBoss JMS. We had an MDB listening to the queue which would then submit the job to be processed... (can't say anything more that).
They are a JBoss shop. I have used JBoss before, but usually use WebLogic or WebShpere. It is not that I do not like JBoss, it is just that most of my clients use BEA WebLogic or IBM WebSphere (I use whatever I get paid to use). I am personally partial to Cuacho Resin. However.....
I found working with JBoss JMS a joy after I convinced them to buy the documentation. ;) We were setting up queues in no time. They recently bought copies of MyEclipse, which is a suite of plugins for Eclipse and J2EE (with XDoclet support). It was a little frustrating because they did not know how to use MyEclispe well (they just got it), and I did not know how to use it at all. But after some trial and error, I found MyEclispe (we found) to be awesome. I am a MyEclipse believer; the XDOclet support is awesome and works well with Hibernate. We started implementing the domain in Hibernate.
It seems like a great project. I hope I get to work on it some more (during the implementation phase). They are still in the planning stages. My contact told me that "You guys exceeded our expectations with your knowledge of the technology (JMS, Struts, J2EE, etc.) and our domain." It was a good feeling moment. Now I am sitting in an air port on my way to another client site. Business is good and busy. At this next client, I am accessing creating a build system (with custom plugins) in Hibernate. Seems like a fun project.
I am going to a place that has 0 degree weather. Brrrrrrrrrrrrrrr......
Sunday, January 04, 2004
Feedreader | new.media.tool
I wanted a blog aggregator and Erik suggested Feedreader | new.media.tool.
So far I added Erik's blog and The ServerSide.com....
Pretty cool.... Reading blogs is now like reading email.
So far I added Erik's blog and The ServerSide.com....
Pretty cool.... Reading blogs is now like reading email.
J2EE BluePrints: The Web Tier
I find that many people usnig Struts fail to grasp concepts in the blue print:
J2EE BluePrints: The Web Tier
Before one can grasp Struts, you have to grasp Model 2 and MVC. A good source for this is right from the source:
MVC - Model 2
J2EE BluePrints: The Web Tier
Before one can grasp Struts, you have to grasp Model 2 and MVC. A good source for this is right from the source:
MVC - Model 2
JSF and Struts
Apache Wiki: StrutsMoreAboutJSF:
A great quote from Craig:
A great quote from Craig:
"An additional lesson, though, is for the Struts developers ourselves. We were one of the pioneers in the webapp framework space, and have arguably been the most successful. But we were not alone. Indeed, my spreadsheet of various implementations of UI component and web app framework architectures (just the ones in Java) has roughtly fifty entries in it. That's way too many for tools to support; it's way too many for potential users to evaluate; it's way too confusing to the market; and it's way too weak for Java as a whole
in the face of a determined competitor who feels threatened by the success of Java technologies at every turn. "
About Struts and JavaServer Faces [forward-looking]
About Struts and JavaServer Faces [forward-looking]
"
While things can always change in the future, many JSR-127 expert group members consider high quality integration with Struts to be an important success factor for JavaServer Faces to be accepted. Therefore, I do not expect that JSF will evolve in ways that make this kind of integration difficult or impossible.
"
Regular Expressions
Here is a good reference for using the regular expression library that ships with Java: Regular Expressions
Steve Ramsay's Guide to Regular Expressions
Steve Ramsay's Guide to Regular Expressions is a good reference for regular expression when you need to review.
rick hightower dot com - 2003: Rick's Resume
I had to update my resume. A company just found me through my resume (rick hightower dot com - 2003: Rick's Resume). They found that I worked at ArcMind by looking at my resume and web site, which is funny since my resume did not mention ArcMind--now it does. ArcMind got a new contract out of the deal.
I was just reading in InformationWeek that job oppenings for software developers has gone up 40% in the last few months (mostly in Silicon valley and Washington DC). It seems that the homeland security department has a lot of IT projects going on according to the article. Business has been good for us.
I was just reading in InformationWeek that job oppenings for software developers has gone up 40% in the last few months (mostly in Silicon valley and Washington DC). It seems that the homeland security department has a lot of IT projects going on according to the article. Business has been good for us.
Subscribe to:
Posts (Atom)