Can Struts 1 (which is EOL) work with Java EE7? - java

I understand that Struts 1 is EOL but I would like to know if a project that uses Struts 1 can work with Java EE7 or do I have to stop using Struts or start using Struts 2
I don't seem to find any documentation of that matter.

Struts only uses Servlet API from the EE implementation. As far as I know it's designed to be backward compatible with other servlet specifications. But you can try it on your own risk, because it might not be built or tested under the new specs. The best approach is to build the framework yourself to see if you have any problems with it. On the docs site (which included with the distro and no longer available online) and on Maven site you can find which Servlet API was supported, this information is also in release notes.
You can use old Struts as I already said on your own risk, means this framework is no longer supported. If you need a support from the community then you should upgrade to Struts 2.

Related

Status of JSTL in Java EE 6

It seems JSTL is no longer even mentioned in the Java EE 6 Tutorial, Oracle instead favouring the JSF libraries heavily over the older jstl core libraries. Does this indicate that it is now unmaintained and will be scrapped in future version of the platform?
edit:
Apparently the documentation for the JSF tags includes documentation for the core tags. I'm not sure whether that means they are considered to be of core function any more though, since they aren't even any examples in the tutorial.
I downloaded the PDF, it's mentioned.

Help with Liferay portlets,igoogle like portals

Hi i am completely new to portlets and portals. I have had a brief(very brief) look at the jsr for portlets, installed liferay played around with its default portlets and set myself up an eclipse working environment in the hope of developing my own little portlet module.
I have to create a portal similar to igoogle, and the tabs system in chrome I am not sure where to start with and I am reasonably comfortable with Java and have done some other J2EE apps, but dont really know how everything fits together in portal/portlet architecture (what files where etc) so any assistance you guys could lend would be greatly appreciated.
You will first need to decide which technologies to use for the portlet.
The portlet specification assume usage of vanilla JSP / Servlet. You can however use other frameworks such as JSF, Struts, Spring, etc. using the corresponding "glue". There are examples for the various technologies in the sample portlets.
For JSF, this glue is the JSR-301 Portlet Bridge for JSF, then you can use other JSF component suites.
I'm currently working on a portlet for Liferay based on JSF and RichFaces, and that seems to works more or less. No major glitches so far.
I don't know if the other component suites are well supported in Liferay portlet environment. Also, I don't think JSF 2.0 and Portlet spec 2.0 are mature enough. So we decided to stick to JSF 1.x and Portlet 1.0.
If you're committed to Liferay, the place to start is the Liferay SDK. They recently released a set of Eclipse plugins (Liferay IDE) which seem to automate much of the packaging for their toolkits (still ANT based - no good Maven resources that I'm aware of - current work has been proposed, but still seems broken/incomplete)
For some samples of portlets you can look at: https://lportal.svn.sourceforge.net/svnroot/lportal/plugins/trunk
I would warn you, Liferay portlets != JSR-168/286 - they have some extensions, and conventions beyond what's in the spec, and some of the platform's handlings default to different values than you might expect (e.g. preferences are shared across multiple users by default). Having said that, the same is true of most/all portlet containers.
I guess you have come across Liferay Portal Server as an open source free portal server to start experimenting with the portlet stuff.
As of working with portlets, the latest version of the portlets spec is JSR 286 (v2.0). As such, all the portlets which are created using Struts, Spring, JSF, basic portlets would follow this specification as the underlying principle. The new specification provides new features (public render parameters, events for inter-portlet communication) and new portlet lifecycles phases (resource, event) and other functionality than what was provided with portlets based on JSR 168.
However the following are to be observed for the relevant framework:
Struts does support JSR 168 portlets (v1.0) and not JSR 286 as of today. This is accomplished using the Struts portlet bridge.
JSF provides support for both JSR 168 and 286 and this is also accomplished using the JSF Portlet bridge (http://jcp.org/en/jsr/detail?id=301).
Spring portlet framework is based on the spring framework. They are pretty easy to work with. If in case, you have experience with Spring framework already then this one would be very easy to follow and start with. The latest version in Spring is v3.1. This support JSR 286 and backward compatible.
Most of the features that work are basically covered by the frameworks/bridges except for few which are Portal server configuration dependant. For the features that work based on the Portal Server( e.g. Liferay, WebSphere Portal, etc.) you would need to go the server documentation in order to see what needs to be declared in portlet.xml and other configuration files as would be mentioned by and for the server.
I would also recommend the book "Portlets In Action" by Ashish Sarin which explains things from the ground up.
All the best.

What is the single most compelling reason to migrate to Spring 3 from 2.x

Currently working on a Spring 2.5 web application, looks as if the business has at least a 5+ year plan for it's usage.
There isn't anything in terms of a technology roadmap in place for the app.
Spring 2.5.6 is stable, and working smoothly. Staying with it won't be a mistake.
Spring 3 gives additional features and support for newer JavaEE specifications. I wouldn't say it gives something extraordinary.
I agree with #Bozho's answer. One significant new Spring core feature that isn't mentioned in the page linked is the Expression Language feature, which allows you to do a variety of things in XML wiring files that previously had to be implemented as custom code.
SpringSecurity in 3.0 is a mixed bag. On the one hand, there are new features and improvements to existing ones. On the other hand, they have broken source code compatibility in a lot of areas. People who cannot do everything with the SpringSecurity namespaces and the standard classes may be in for some head scratching, recoding, and in some cases pain.
Spring Roo generates spring 3 based applications. Not immediately applicable to existing apps, but it's great to be able to compare roo's best-practice output, and if you were 3.x based then you could copy roo config / code output into your existing application to get functionality for free.

Java EE 6 vs. Spring 3 stack [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm starting a new project now. I have to choose technologies. I need something light, so no EJB or Seam. On the other hand I need JPA (Hibernate or alternative) and JSF with IceFaces.
Do you think that such a stack on Spring 3 deployed on Tomcat is a good choice? Or a Java EE 6 web application could be better? I'm afraid that Java EE 6 is a new technology, not well documented yet. Tomcat seems to be easier to maintain than Glassfish 3.
What's your opinion? Do you have any experiences?
I need something light, so no EJB or Seam.
Would you care to explain what makes EJBs heavy since EJB3? Do you realize that we are not in 2004 anymore? I'd really like to read your definition of light and your arguments (and I will update my answer with pleasure because I'm pretty sure I would have a few solid things to say).
On the other hand I need JPA (Hibernate or alternative) and JSF with IceFaces.
Java EE 6 Web Profile which includes JSF 2.0, JPA 2.0, Bean Validation, EJB 3.1 Lite, CDI,... would be perfect for this and you can use GlassFish v3 Web Profile to run an application built with the Java EE 6 Web Profile.
Do you think that such stack on Spring 3 deployed on Tomcat is a good choice? Or a Java EE 6 web application could be better?
Well, I like the idea to run my code on a non-proprietary platform (Java EE) rather than on a proprietary container (Spring). And I think that Java EE 6 is good enough (and this is an euphemism, EJB 3.1 (Lite), JPA 2.0, JSF 2.0, CDI kick ass). Note that I was a JSF skeptic but I took a second look and JSF 2.0 with CDI is so different that I can't even compare. And if you didn't look at CDI, let me tell you that it rocks.
I'm afraid that Java EE 6 is a new technology, not well documented yet.
Java EE looks pretty well documented to me. This sounds like free claim. And, believe me or not, I start to find Spring getting complicated while Java EE getting easier.
Tomcat seems to be easier to maintain than Glassfish 3.
Did you try something? Did you face any particular problem? Again, this sounds like free claim.
I have not used JavaEE6.
However, I have been beaten up badly enough by all the previous versions of JavaEE and EJB's that I won't trust it until it establishes itself as the de facto standard, not just the de jure standard. Right now, Spring is still the de facto standard.
Fool me once, shame on you. Fool me twice, shame on me. Fool me three times, EJB.
Some will claim that Spring is proprietary. I would argue that the vendor implementations of the JavaEE specs have been just as proprietary, if not more so.
I went through a major conversion recently of moving a bunch of Java Applications from JBoss to Weblogic. All of the Spring/Hibernate apps ported with zero modifications, because they had all the libraries they needed built in. All the apps that used JPA and EJB and JSF were a disaster to port. Subtle differences in interpretations of JPA, EJB, and JSF between appservers caused all kinds of nasty bugs that took forever to fix. Even something as simple as JNDI naming was completely different between AppServers.
Spring is an implementation. JavaEE is a spec. That is a HUGE difference. I would prefer to use a spec IF the spec was 100% air-tight and gave absolutely no wiggle room in the way vendors implement that spec. But the JavaEE spec has never been that. Maybe JavaEE6 is more air-tight? I don't know. The more you can package in your WAR, and the less you depend on AppServer libraries, the more portable your application will be, and that, after all, is the reason I use Java and not Dot-NET.
Even IF the spec was air-tight, it would be nice to be able to upgrade the appserver without having to upgrade all my technology stacks in all my applications along with it. If I want to upgrade from JBoss 4.2 to JBoss 7.0, I have to consider the impact of the newer version of JSF on all of my applications. I don't have to consider the impact on my Spring-MVC (or Struts) applications.
It doesn't matter. Java EE 6 is good enough and because of the profiles there, it is not "heavy" - you'll just be using the web profile.
Personally, I prefer Spring. But I'm running out of rational arguments against Java EE 6 :)
(As I was reminded by a comment - you might want to try RichFaces, as well as ICEfaces and/or PrimeFaces - depending on what components you need).
Recently, one of my client assignments involved evaluating Spring Stack Vs Custom framework stack Vs a Java EE Standards. After a month of evaluation and prototyping, I was not just happy but blown away by the Java EE 6 feature set. For any new "enterprise" project architecture in 2011 and going forward, I would go with Java EE 6 and potential extensions like Seam 3 or the upcoming Apache JSR299 extensions project. Java EE 6 Architecture is streamlined and incorporates best of many open source ideas that have evolved in the last several years.
Consider the following features out of the box: Event Management, Contexts and DI, Interceptors, Decorators, RESTful webservices, integrated testing with embeddable container, Security, and many more.
Most of my results are published in my blog explaining the key concepts of Java EE 6 that you might find useful.
Of course, there is no hard and fast rule for choosing a framework. Java EE 6 could be well bloated for simpler "web sites" that don't require a rich conversational session state. You might as well pick Grails or Play! Framework. But for conversational web applications, I can't see a better argument why Java EE 6 is not a good fit.
Now, after some time, I have experience with stacks :
Java EE 5 + Seam + GraniteDS + Flex
Spring 3 + Vaadin (on GWT)
Spring 3 + JSF 2.0 (PrimeFaces)
My colclusions are:
Spring 3 is much much simpler than Seam (almost Java EE 6) and runs on Tomcat and Jetty! (Jetty for developement with maven plugin is a trasure).
I love Flex (I actually was a Flex developer for long time so I'm biased) and if you need rich interface and can buy FlashBuilder use this, but use this wich Spring + GraniteDS or BlazeDs backend. If you can't buy FlashBuilder don't waste your time.
Vaadin is great!. Developement process is simpler than Flex, but you can create rich application easily without HTML mess. You wont't write a singe JS line. You just need some CSS (in Flex you need it too). So if your application interface is going to behave like desktop application and you can't (or dont want to) use Flex - use Vaadin. Warning! Vaadin has big JS overhead for browser.
If you create simpler website-like application use JSF2.0 (with spring backend as above). You'll need to fight with HTML (I hate it) and creating rich interface will be harder than Vaadin (especially layouts). You will get lightweight HTML for slower browsers/compuetrs. I like PrimeFaces - it's easy and well documented. Second place is IceFaces
If you create a website (NOT a web application) where you need to put life into HTML (instead of create enterprise application that fits into browser) use Wicket (if you prefer component based, pull attitude) or SpringMVC (if you prefer template based, push attitude) or just use Play! framework. Remember that creating rich data-based components will be much much harder but you will have control over each tag of html (your HTML/Graphics designer will love it)
Read Adam Bien's Future Of Enterprise Java ...Is Clear (Java EE with/without Spring and Vice Versa), including comments to get both sides of coin. I will choose Spring for several reasons and following is one of them (reproducing one of the comments from post)
'I am not sure which Java EE 6 server you are talking about. There is Glassfish certified and TMAX JEUS. It will take quite a while (read: years) until Java EE 6 compliant versions of WebSphere, WebLogic, JBoss etc are in production and can be used for real application. Spring 3 just needs Java 1.5 and J2EE 1.4 so can readily be used in almost all environments'
My opinion is based on something not mentioned by others, namely that code at my work tend to live for decades (literaly), and hence that maintenance is very important to us. Maintenance of our own code, and the libraries we use. Our own code we control, but it is in our interest that the libraries we use, are maintained by others in the above mentioned decades or more.
To make a long story short, I have concluded that the best way to achieve this is by using open source implementations of Sun specifications all the way down to the raw JVM.
Of the open source implementations Apache Jakarta has proven to maintain their libraries, and recently Sun has done a lot of work in producing high quality implementations for Glassfish v3. In any case, we also have the source for all modules, so if all else fails, we can maintain them ourselves.
Sun specifications are usually very strict meaning that implementations conforming to the spec can be interchanged easily. Just have a look at servlet containers.
In this particular case, I would suggest having a look at JavaServer Faces simply because it is part of Java EE 6 meaning it will be available and maintained for a very, very long time. Then we have chosen to augment with MyFaces Tomahawk as it gives some useful additions, and it is a jakarta project.
There is nothing wrong with JBoss Seam or others. It is just that their focus is less towards the maintenance issue that is so important to us.
I can see using Spring if you already have it, but for the new project, what's the point? I would go directly with Java EE 6 (ejb3, jsf2.0, etc.)
If the client is fine with Flex, go for it. Use BlazeDS or similar - no mvc. You might spend more time on that part (exchanging data between server and client) but you have full control on both sides.
Don't use Vaadin, unless you want to kill your browser. Plus, you spend more time on getting around the code once your pages become more complex. Also, your mindset will need to be completely changed and anything you know about standard front end development will be waste. The argument that you don't have to use HTML or JS doesn't make much sense. You still have to know it even if you don't use it. It renders to HTML and JS eventually. Then try to debug it - make sure you got few days for simple stuff. Plus, I cannot imagine web developer who doesn't know html/js.
I just don't understand why people are trying all those abstractions instead of using Java EE directly.
Why is there still rumblings about EJB being heavyweight in 2010? It seems people are not being updated in Java EE technologies. Just try it out , you will be pleasantly surprised how things are simplified in Java EE 6.
The answer to your questions depends on your project requirements. If you don't require the Java EE features like message queues, container managed global transactions etc then go with tomcat+spring.
Also from experience I have found that projects that require a lot of web service integration, scheduling, message queues are best best done using some of the Java EE stack.
The good thing is using spring you can still integrate with Java EE modules running in an application server.
Java EE 6 is very different from the previous releases, and it really makes everything lot easier. Java EE 6 combines the best ideas from the diverse Java community - for instance Rod Johnson from Spring framework was actively involved in the making of the Dependency Injection JSR in Java EE 6. A benefit of using Java EE 6 is that you are coding according to a standard, which could be important in some organizations for vendor support etc.
GlassFish v3 supports Java EE 6 and it is quite light-weight and starts up really fast. I have been using glassfish v3 for my developments, and it is really easy to configure. It comes with a very user-friendly admin console that lets you graphically administer your server.
If you are using GlassfishV3 and JSF 2, then you can take advantage of the CDI features of Java EE 6, that lets you easily create conversations (e.g. wizard like pages) in JSF.
Having said that, using Java EE 6 also requires you to learn a new API. Depending on the timeframe available it might not be the best choice for you. Tomcat has been around for ages, and the tomcat+spring combination has been adopted by many web projects, which means lots of documentation/forums are around.
I have worked in both Spring and Java EE 6. What I can say from my experience is that If you are going for the age old JSP or proprietary Flex then you are safe if you stay with Spring.
But if you are to move ahead with JSF then it's time to shift to Java EE 6. With Java EE 6 you are moving to Facelets and standardized script libraries and component libraries. No more script incompatibilities and component library matrices.
Regarding Spring MVC, it's good as long as your project doesn't grow too big. If it's a huge enterprise application stick on to Java EE 6. Because that's the only way you could maintain your own component libraries and resource bundles in an orderly manner.
If you need the Java EE full stack I recommend you GlassFish 3.1. It starts very quickly compared to other Java EE containers which implements some part or all Java EE 6 (JBoss 6, WebLogic 10.3.4), redeployment take seconds and almost all can be done by convention over configuration, it is very friendly.
I you want something "Light" you can customize an Apache Tomcat 7.x with the desired features. I used a lot with the following libraries:
Weld 1.1.0 (CDI)
JPA 2.0 (Hibernate 3.6.x) - only resource local transactions
JSF 2.x (Mojarra)
RichFaces 4.0
BIRT runtime
Been a Java EE developer for the past 10 years (I suffer early EJB, JSF and web technologies), Java EE 6 is very easy, well coupled and current hardware runs smooth so original reasons that motivated Spring are no longer valid.
I'd still prefer Spring.
And I'd pass on JSF. I think it's a dead technology. Spring MVC would be a better alternative. So would Flex. Think in terms of contract first XML services and you can decouple the back end from the UI completely.
I'd recommend Spring + Tomcat unless you can wait the time for glassfish v3 and Weld to become more mature. There are currently a few issues with memory consumption/cpu load when running glassfish with CDI enabled applications.
Didn't read everything but just to tell that you can now use EJB3 inside a war on Java EE 6 so you can use EJB3 on Tomcat (I think).
I recommended to you Tomcat with Spring because:
Spring can create backing beans for JSP
You will use Spring to persist object through JPA
It is good choice to choose Tomcat because you don't need any heavyweight processing

Can I use facelets in a Google App Engine app?

I would like to do some more learning of facelets. Now that Java is a supported Google app engine language, is there anything in the facelets implementation that would prevent use on App Engine?
Edit: This page at google now has a list of various frameworks and their status in regards to App Engine.
The 1.2 version of JSF was not working - because by default it would try to spawn threads. That's not allowed in GAE.
This is fixed in the latest version of JSF 1.2 (build 13), as well as the 2.0 Beta 2 release - and you can download the latest versions from here: http://javaserverfaces.java.net/
You need to add the a context parameter to your web.xml:
com.sun.faces.enableMultiThreadedStartup which defaults to true. This
option must be set to false when deploying to GAE.
I haven't tried it, but I don't imagine it would be any different from using Struts or Spring. As long as you can deploy with all the JARs you need in your WAR it should work.
The only question is whether JPA or JDO are sufficient. If the facelets require any other persistence mechanism you might have a problem.
JMS isn't available either, so features that depend on it can't work.
Isn't the first access limited? First 10,000 get in?

Categories