Sturts1.0 Vs Struts2.0:
1. Servlet Dependency:
Actions in Struts1 have dependencies on the servlet API since the HttpServletRequest and HttpServletResponse objects are passed to the execute method when an Action is invoked but in case of Struts 2, Actions are not container dependent because they are made simple POJOs. In struts 2, the servlet contexts are represented as simple Maps which allows actions to be tested in isolation. Struts 2 Actions can access the original request and response, if required.However, other architectural elements reduce or eliminate the need to access the HttpServetRequest or HttpServletResponse directly.
2. Action classes
Programming the abstract classes instead of interfaces is one of design issues of struts1 framework that has been resolved in the struts 2 framework. Struts1 Action classes needs to extend framework dependent abstract base class. But in case of Struts 2 Action class may or may not implement interfaces to enable optional and custom services. In case of Struts 2 , Actions are not container dependent because they are made simple POJOs. Struts 2 provides a base ActionSupport class to implement commonly used interfaces. Albeit, the Action interface is not required. Any POJO object with an execute signature can be used as an Struts 2 Action object.
3. Validation
Struts1 and Struts 2 both supports the manual validation via a validate method.Struts1 uses validate method on the ActionForm, or validates through an extension to the Commons Validator. However, Struts 2 supports manual validation via the validate method and the XWork Validation framework. The Xwork Validation Framework supports chaining validation into sub-properties using the validations defined for the properties class type and the validation context.
4. Threading Model
In Struts1, Action resources must be thread-safe or synchronized. So Actions are ingletons and thread-safe, there should only be one instance of a class to handle all requests for that Action. The singleton strategy places restrictions on what can be done with Struts1 Actions and requires extra care to develop. However in case of Struts 2, Action objects are instantiated for each request, so there are no thread-safety issues. (In practice, servlet containers generate many throw-away objects per request, and one more object does not impose a performance penalty or impact garbage collection.)
5. Testability
Testing Struts1 applications are a bit complex. A major hurdle to test Struts1 Actions is that the execute method because it exposes the Servlet API. A third-party extension, Struts TestCase, offers a set of mock object for Struts1. But the Struts 2 Actions can be tested by instantiating the Action, setting properties and invoking methods. Dependency Injection support also makes testing simpler. Actions in struts2 are simple POJOs and are
framework independent, hence testability is quite easy in struts2. 6. Harvesting Input
Struts1 uses an ActionForm object to capture input. And all ActionForms needs to extend a framework dependent base class. JavaBeans cannot be used as ActionForms, so the developers have to create redundant classes to capture input. However Struts 2 uses Action properties (as input properties independent of underlying framework) that eliminates the need for a second input object, hence reduces redundancy. Additionally in struts2, Action properties can be accessed from the web page via the taglibs. Struts 2 also supports the ActionForm pattern, as well as POJO form objects and POJO Actions. Even rich object types, including business or domain objects, can be used as input/output objects.
7. Expression Language
Struts1 integrates with JSTL, so it uses the JSTL-EL. The struts1 EL has basic object graph traversal, but relatively weak collection and indexed property support. Struts 2 can also use JSTL, however it supports a more powerful and flexible expression language called "Object Graph Notation Language" (OGNL).
8. Binding values into views
In the view section, Struts1 uses the standard JSP mechanism to bind objects (processed from the model section) into the page context to access. However Struts 2 uses a "ValueStack" technology so that the taglibs can access values without coupling your view to the object type it is rendering. The ValueStack strategy allows the reuse of views across a range of types which may have the same property name but different property types. 9. Type Conversion
Usually, Struts1 ActionForm properties are all Strings. Struts1 uses Commons-Beanutils for type conversion. These type converters are per-class and not configurable per instance. However Struts 2 uses OGNL for type conversion. The framework includes converters for basic and common object types and primitives.
10. Control Of Action Execution
Struts1 supports separate Request Processor (lifecycles) for each module, but all the Actions in a module must share the same lifecycle. However Struts 2 supports creating different lifecycles on a per Action basis via Interceptor Stacks. Custom stacks can be created and used with different Actions as needed.
Let me know anyone have any queries on above
Thanks,Cheekuri
Monday, February 2, 2009
Differences between Struts 1.0 & Struts 2.0 :
Posted by
RAM
at
10:50 AM
0
comments
Saturday, January 31, 2009
Approaches to load jar files
There are two approaches to load jar files not from (web-inf/lib)
Step1: Create lib folder inside DAMS-Ear/Ear Content. Place the required jar files inside the lib. JBoss will by default add all these jars to classpath of the application and make them available.
Step2: Add dependent or component jars in application.xml file in Ear and deploy the web-app
<?xml
version="1.0"
encoding="UTF-8"?>
<application
id="Application_ID"
version="1.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
<display-name>DAMS-Ear</display-name>
<module
id="WebModule_1233318064937">
<web>
<web-uri>DAMS-Web.war</web-uri>
<context-root>DAMS-Web</context-root>
</web>
</module>
<module
>
<java>DAMS-xxx.jar</java>
</module>
</application>
We add each module as shown above
Note: In eclipse Ear shows errors but application is deployed
Let me know if you have any queries…..
Posted by
RAM
at
3:54 PM
0
comments
Labels: approaches to load jar files, jar fiels loading, jar files
Wednesday, January 21, 2009
JAVAFX
Article 1: JavaFX Script is a highly productive scripting language that enables content developers to create rich media and content for deployment on Java environments. JavaFX Script is a declarative, statically typed programming language. It has first-class functions, declarative syntax, list comprehensions, and incremental dependency-based evaluation. It can make direct calls to Java platform APIs. that are on the platform. Although JavaFX Script makes it very easy to create simple GUIs, it is designed to be capable of supporting GUIs of any size or complexity. JavaFX Script is statically typed, so it has the same code structuring, reuse, and encapsulation features (such as packages, classes, inheritance, and separate compilation and deployment units) that make it possible to create and maintain very large programs using Java technology.In addition, JavaFX Script is intended to have the same level of IDE/tool support that Swing programmers are familiar within Java technology: an editor with code completion, refactoring, a Javadoc-like documentation tool, a source-level debugger, a profiler, and ultimately a visual builder.JavaFX Script will work with all major IDEs, including NetBeans, which is the reference implementation IDE for Java development.JavaFX Script is specifically designed to optimize the creative process of building rich and compelling UIs, leveraging Java Swing, Java 2D, and Java 3D for developers and content authors. These RIAs and next-generation services that can be proliferated across virtually any device — from phonetop or desktop browsers and mobile devices, to set-top boxes and Blu-ray Discs — securely and without local installation.JavaFX Script applications will run on JavaFX Mobile software, making these types of applications a reality for the mobile wo Article 2: What is JavaFX?JavaFX is a new family of Sun products based on Java technology and targeted at the high impact, rich content market. What is being announced at the 2007 JavaOne Conference around JavaFX?At the Conference, Sun Microsystems is announcing two products in the JavaFX family: JavaFX Script and JavaFX Mobile. JavaFX Script is a a highly productive scripting language for content developers to create rich media and content for deployment on Java technology. JavaFX Mobile is a complete mobile operating and application environment built around Java and Linux open source technologies. How does JavaFX Script compare with other tools for creating rich internet applications (RIAs)?Today's Internet offers a world of possibility for those who can quickly develop and deploy rich internet applications (RIAs). But only the Java platform is pervasive enough on mobile devices and browsers to effectively marry client- and browser-based technologies with RIAs enabling applications to run on multiple platforms virtually unchanged. JavaFX is Sun's new product family that addresses this market. JavaFX Script will enable developers to more quickly and easily develop RIAs and next-generation services that can be proliferated across virtually any device -- from desktop browsers and mobile devices, to set-top boxes and Blu-ray Disc DVDs – securely and without local installation. JavaFX Mobile software makes these type of applications a reality for the mobile world. Will there be other products in the JavaFX family?Sun is planning several products in this family. More details will follow as they become available. Where can I obtain JavaFX Script or more information?More information on JavaFX Script is available at www.sun.com/javafx. The alpha code that Sun is demoing at the JavaOne Conference is available at Project OpenJFX (openjfx.dev.java.net). Sun will be expanding this scripting language and is inviting developers to join the OpenJFX community and participate with their feedback. Tell me more about JavaFX Script.JavaFX Script is a highly productive scripting language that enables content developers to create rich media and content for deployment on Java environments.JavaFX Script is a declarative, statically typed programming language. It has First-class functions, declarative syntax, list-comprehensions, and incremental dependency-based evaluation. It can make direct calls to JavaAPIs that are on the platform. Since JavaFX Script is statically typed, it has the same code structuring, reuse, and encapsulation features (such as packages, classes, inheritance, and separate compilation and deployment units) that make it possible to create and maintain very large programs using Java technology. Why is the JavaFX Script name so long?Although the official name of the scripting language is JavaFX Script, we expect many programmers to just call it JavaFX as it is the core of the JavaFX family. Why did you create another scripting language?JavaFX Script is specifically designed to optimize the creative process of building rich and compelling UIs leveraging Java Swing, Java 2D and Java 3D for developers and content authors. Will JavaFX be open sourced?Yes, JavaFX Script will be open sourced. The governance, licensing, and community models will be worked out as product release draws closer. Can I contribute to JavaFX?Absolutely. Join the OpenJFX community on Java.net. Currently, Sun is looking for your feedback and the directions in which you would like to see JavaFX Script evolve. Once the basic prototype phase is completed, Sun will provide additional details on how you can contribute to the technology itself. Will development tools support JavaFX Script?JavaFX Script will initially work with the NetBeans IDE, but it is expected to work with other IDEs as well. Why do I need the JavaFX Script? Isn't Swing good enough?There's nothing wrong with Swing. Swing is one of the best GUI development toolkits of its kind. Swing makes it very easy to create standard GUI components, buttons, listboxes, trees, and tables. Together with Java 2D, Swing makes it easy to customize existing components or to create new custom components to achieve virtually any desired visual effect. Sun is not replacing Swing with JavaFX; instead, JavaFX Script makes Swing much easier to use.With the new JavaFX Script language, the structure of the programmer's code closely matches the actual layout of the GUI, making it tangibly easier to understand and maintain. Why isn't Groovy enough?Groovy and other languages have two specific traits which don't precisely meet these needs, namely that they are generic in nature and don't provide the appropriate abstractions necessary to optimize the UI design process and similarly are designed specifically for programmers other than content authors. What about performance? Isn't using a scripting language going to be a problem?Performance is obviously an important issue. The architecture of JavaFX Script is meant to be highly performant. For example, the GUI components and back-end application objects are implemented in Java; JavaFX Script code is used only to create such components, configure them, and wire them together. In addition, since the JavaFX Script implementation handles event generation and dispatching, it can be optimized and all Swing applications built with JavaFX Script will benefit. Without JavaFX Script, programmers must effectively handcraft their own incremental evaluator for each new application -- adding property change listeners to and firing events from Java Beans, adding listeners to GUI components, and then determining what events need to fired and/or handled by each bean or component. These steps tend to be very error prone and difficult for programmers to optimize. Is JavaFX Script only for simple GUIs?Although JavaFX Script makes it very easy to create simple GUIs, it is designed to be capable of supporting GUIs of any size or complexity. Unlike many other Java scripting languages, JavaFX Script is statically typed and has the same code structuring, reuse, and encapsulation features (such as packages, classes, inheritance, and separate compilation and deployment units) that make it possible to create and maintain very large programs in Java. In addition, JavaFX Script is intended to have the same level of IDE/tool support that Swing programmers are familiar with in Java: an editor with code completion, refactoring, a Javadoc-like documentation tool, a source-level debugger, a profiler, and ultimately a visual builder. Will JavaFX Script applications run on Java on the desktop?JavaFX Script applications run on the Java Runtime Enviroment (JRE) on the desktop. Will JavaFX Script applications run on JavaFX Mobile?Yes, that is why JavaFX Mobile is being announced simultaneously. Weitere Informationen: www.sun.com/ software/ javafx
Posted by
RAM
at
9:00 PM
0
comments
Labels: java javafx, javafx, javafx ram, sun