Is making simple website in "java spring hibernate" is overkilling - java

Initially i was php programmer and was using joomla to build websites .
I could easily build good websites in joomla in few days.
I was learning java spring hibernate for last three months and now i have build simple user registration logins and members area using spring MVC , hibernate annotation etc.
Now i want to ask that whether from now onwards should i use spring MVC to build site just because i have learned it or its good for me in future. Because i still feel that the same site can be build in few days in php
Is it the case that in future i can also come on same level as php that i can build simple site in java in few days as well or no matter what experience i have java still is going to take longer than php always
Can any java CMS make my life easier because i want to say good bye to php.
i mean if i want to make just 5 page portfolio website can build in java cms in 1-2 days

If by "simple website" you mean a normal page with categories, articles and some navigation (i.e. not a web-application), then yes: Building that from the grounds up with Java + Spring + Hibernate is probably overkill (i.e. those are low-level tools, you'd have to build a lot yourself). I'd stick with the tools built for this specific task, namely some kind of CMS system.
If you want to bring "some Java" into your day-to-day job, then you might want to try looking into a Java CMS system.

You should, of course, use the appropriate tools for the job. Spring MVC is not appropriate if you are re-implementing functionality that has already been robustly provided by an existing tool (eg. Joomla etc.).
Given that much of the 'interactive' part of many websites can now be hosted elsewhere (eg. Disqus for comments and so on), you may not need a dynamic website at all and could host the site on one of the many cloud services for static content. This has the advantage that your performance is elastic, and 'cost per user' can be vanishingly low.

Related

REST API general questions

I'm new to REST API's in general and I have the following questions:
I want to make a website, and an App that share the same users, and data from database in general. For the website I plan to make it with spring for the backend, and for the app I plan to make it in kotlin, as well as an IOS version, to which I havent decided what language I will use. I also want an API the public can use. Is this when I would make a rest API, for the data, and the public API?
The website and app would both contain login, registration, and more
How do I make the website/app retrieve data from the REST API?
Also, what do I make the API in? Is this something I could use spring for?
Sorry if this is a really stupid question.
I am not sure why you want to use kotlin. You can use Angular for UI and Spring Boot for Rest API. I have some POC for user registration. Please have a look.
https://github.com/numery009/springmvc-security-aop-hibernate-user-registration
https://github.com/numery009/numery009.github.io
For UI with Angular -- https://numery009.github.io/
Unlike your question supposes, which is declared as "general", you are mentioning Spring MVC as backend for REST-Endpoint API as well as Angular as independent frontend solution, altogether handling user, groups and their special rights on objects.
There are some dozen if not hundreds of possibilities to build an API, but I suppose you look at jhipster.tech, which is a code generator serving you the basic fundament for Spring backend and Angular frontend (you can choose other frontends, but I recommend to use Angular for generation as it is similar to Java in Spring framework).
As you can generate from easy first monolithic constructs for testing and learning all the modules and technics as well as high-level company-driving microservices for ERP including process-management and accounting, API for field workers, partner companies and clients, one or more Webstores, connecting mobile devices and everything else "in minutes", it is not only a splendid tool, that shows you best practice in development including good documentation, but it is also used as generator for professionals to start a project.
With jhipster and its community you'll learn from pro's and get some steps further - at least for me the work of those guys was and is an eye-opener - after years of reading books about programming and turning left and right, often enough to nowhere.
Of course, it is opinionated like Spring and Angular themselves. But the technics which are used are reliable, well combinated and do build the daily software-stack in many companies since and for years.
You'll code in Java or Kotlin in Spring and ECMAScript (Typescript as Javascript Transpiler) in Angular framework. The structure and ideas behind these programming languages are comparable - "Typescript is easy to understand for Java-guys". And you'll stay independent from support companies, platforms or library changes. Besides you'll learn how to update your own software, which is often forgotten in business software, too.

Is there any online ecommerce project architecture available in java

i am new to java design patterns and i am building the ecommerce sit with spring mvc. but i am confused how to write various classes according to patterns.
i don't know where to put authenticate , confirmEmailAddress , addProdctCart , shoppingHistory like functions ,
so is there example of any site where i can find how divide the functions in classes
Java web frameworks tends to be more bare-bones than other web frameworks.
Rails give you convention-over-configuration and it's pretty easy to get up a data-driven/dynamic website up and running.
PHP offers several frameworks. Drupal, Wordpress, CodeIgniter, just to name a few.
I've used each of these, and each has their strength. To boil it down, I would say that in Java, you are cursed by too many options and flexibility and I would say the opposite of the other platforms.
The other platforms (non-Java) may offer methods like authenticate, confirmEmailAddress, addProdctCart, shoppingHistory that you could just fill in. You will not find this in Java.
If you read through the Spring Security tutorial, it gives you a lot of what you're looking for: Spring MVC, security, Hibernate, etc. You can checkout the PetClinic sample app from their SVN repo.

Which Java technology should I use, if I want to build a website with thousands of users?

Sorry for asking this question, but I searched all Java-related questions, but I got more confused. I am still not clear what should I start with.
My main thing is building websites in Java, because someone told me that there are some machine learning or AI libraries available in Java which I can use in Java. So I decided to use that as it can reduce my work.
Now I don't know Java at all. Some people say the following are used to build websites, like:
Servlets alone can build a website
JSP alone can also build a website
Struts
Spring Framework with Hibernate
Seam
Java EE also for websites
I am confused. Where should I start from? Where does core Java fits in here?
I was thinking of perhaps learning Python as I know I have to learn Python only, not its variations.
So please guide me to one thing which can solve my basic purpose of using ready-made libraries of AI.
If I can do that with JSP then I will start with that.
But if I need to learn all of them, then it’s better if can start learning Python.
I have five months to finish the website.
I really don't know why there are many branches of Java for doing one thing.
To correct some misconceptions of yours:
servlets and JSP are Java EE
Seam and Struts can be used together with Hibernate as well
Spring MVC is a web framework. Spring as a dependency injection framework can be used together with any other framework.
there are many more options, like JSF, Tapestry, Click, Play, etc.
It depends on what will the site will be doing, but you can choose any.
Experience has shown that building complex HTML forms (especially validation) and Ajax functionality is hard to get right. You will most likely appreciate having a library to assist you with that. The same thing with database access.
Everything builds on servlets. Learn those in order to understand the libraries you will use.
I would suggest learning JavaServer Faces (JSF) with facelets. The easiest, while being powerful, is JSF 2 in Java EE 6. The easiest way to get started is to use NetBeans with GlassFish 3.
For static web pages, HTML alone is enough and if you want to make it more user-friendly and interactive, use JavaScript.
There are lot of frameworks you can use directly in JavaScript, like jQuery. Now if you want to make some more functionalities, like database interaction, then you will need either PHP, Java (JSP and Servlets) or .NET (there exist some more, but I’m aware of three only). Each of them have their library to interact with database.
Since you are interested in Java, go through Servlets, HTML, JavaScript, and JSP. Once this is done, you can look into JSF and EJB beans. So if you have knowledge of Java this will not take too much time, because the syntax is the same; the only difference is the concept.
So you will have a frontend (HTML, JS, and JSP) which will interact with the backend (Servlets and the database) which will be deployed in a Web container. To deploy, you can use an one of the available application servers, like Apache Tomcat, GlassFish, or WebSphere. To develop your application, you can use Eclipse as the IDE, which is one of the best IDEs I have used.
So decide your architecture and design, break it into components and start writing small applications first. Once you are experienced in small application, start writing an application where there are more things you have to care of, like load on database, availability, security, etc. For that, you can refer a very famous question on Stack Overflow, What technical details should a programmer of a web application consider before making the site public?.
The closest to core Java is servlets. No extra syntax, very minimal library, but no included functionality.
For building websites, the main thing is HTML and HTTP.
All technologies (including Enterprise Java or Server side Java) do the same—to understand an HTTP request and respond back with HTML. All that you mentioned do the same thing with a different level of sophistication.
Start with Wikipedia.org to know what technologies do what. If you are completely new to Java, go through the Sun tutorials, do sample programs, and get comfortable with Java packages, JVM and classes. (This might take a week or two).
To build websites using Java, you'll have to learn Java Servlets—everything else (JSP, Struts, JSF, and Spring(!)) are built on it. Get Head First books on Java and Servlets; they will be useful.
You can always build the page in Ruby or something that will give you a website very fast. For the AI stuff that analyzes the bought items for the recommendations, use something unrelated to the page that only takes the database to work with.
I would not mix the whole web page stuff with the AI computing. You can do the AI things that will take a long time and maybe should done on a different machine to have your webpage also responsive with C++ or Java in normal applications.
Choosing your front end technique because of later usage is a very dangerous thing. Using the whole Java EE concept and learning it from scratch will take you much longer than have a quick start with your page if you do it in Ruby or PHP.
You can then build the first version of the page and generate a user base. Start working on the AI stuff once you got some data with other technologies.
If your page has performance problems because your technology does not scale, you can always begin switching parts of the stuff out with a faster technology or maybe simply a bigger machine. Get your page running before you build it bulletproof for the thousand users you are expecting.
If you’re trying to build a website from scratch, with no prior knowledge, your best bet is to go with frameworks that provide a complete stack for web development.
If you aren't dead set on Java, you could probably start learning Ruby on Rails, which would be easier to start with (if so, go buy a Ruby on Rails tutorial which goes through all the necessary things for modern web development, from MVC to version control).
For Java, try:
Play Framework is very similar to Ruby on Rails. It will get you started very quickly, and hopefully (if you follow conventions) handle all of your peripheral needs.
Spring Roo is a very-fast-to-work-with framework, but it might get hard to maintain and extend later on.
These two are full web frameworks, that is, they handle database, MVC (presentation layer), configuration setting, etc... (I'll explain shortly). And could even ease your deployment process.
If you're going to go through any other route (using several frameworks together), you are probably not going to finish what you are doing in five months.
To understand why, and to clear some things you wrote in your question, you need to understand that modern web development (and enterprise development as a whole) is comprised of several different technologies:
Presentation: the term web frameworks has been more or less taken to mean frameworks that deal with this side of web development, i.e., how to create a web page (an HTML page). Most of the frameworks offer an MVC like approach (which you can read about elsewhere), and this is what most of the frameworks/technologies you gave sit in—JSP and Struts (which uses JSP) are examples of web frameworks. Servlets is a lower-level API that standardizes how to answer HTTP requests (which JSP and Struts sit on top of).
Persistence: being able to show a webpage doesn't mean squat these days if you can't save data to a database, and that is what the persistence frameworks do (they ease the way you can save data to the database). Hibernate is a persistence framework.
For Java there are also dependency injection (DI), which is what Spring DI is. It's tough to explain DI to people not familiar with the troubles of Java, so I won't try to explain it, but it's a very important part of modern Java development.
apart from these core technologies, there are also many items that you'll need to learn to actually deploy the application (unless your using services like Heroku or Google App Engine, which should simplify things), and troubleshoot it later (understanding how concurrency and HTTP works).
To address the other technologies you brought up:
I've never really touched Seam, so I'm not sure, but it looks like a collection of other frameworks (mainly EJB 3, which itself is a collection of APIs, and JSF).
Spring denotes a popular open source group (the SpringSource group) that provides various technologies, but most likely when you hear about it they refer to two things Spring's dependency injection (DI) and Spring's MVC (which is a web framework).
Java EE is merely a collection of high level APIs which other technologies implement (Hibernate implements JPA which is part of Java EE for instance).

Please discuss what are and why use portlets

Why would I want to use java portlets above tomcat and gwt?
Would portlets make it less- or un- necessary for me to use jsp and jsf?
Has Jboss been part of the portlet evolution culture? Does Jboss satisfy the portlet jsrs?
What portlet implementation/brand would run on gae java and gae python?
Are portlet specs due to peer pressure from php cms culture?
What are the equivalent of portlet and portlet jsr in .net?
Portlets were a well-meaning but mis-guided attempt at a reusable widget API for web applications. Think of the personalised google home page, with the portlets like weather, news, mail, etc.
Unfortunately, they made a bit of a mess of it. The Portlet API is a bit of a pig, a real barrel of not-fun, and there are very few implementations of it. The only one I've ever used is JBoss Portal, but it's a bit of a brute, and rather buggy. Liferay may also be a portlet server, but the home page is heavy on fluff and light on information, so I can't tell.
Spring provides an MVC framework for the portlet API which tries to reduce the pain, but frankly I wish they hadn't bothered, it just clutters up the documentation.
Essentially, the whole shebang looks like a solution in search of a problem.
If you happen to have a framework that you need to use, and it supports portlets, you may find then that portlets are going to be useful, since the application is built with the idea, but, as others have mentioned, if you are starting on a project, there are many other technologies that will do what you want with less effort, in a more stable environment.
For example, when I worked at the University of South Florida, the learning management system was (and is) Blackboard, and they now support portlets: http://www.ja-sig.org/wiki/display/JSG/Blackboard+Portlet. So, if the application provides an API, and expects people to use portlets, then it may make sense to look at them.
UPDATE:
After looking at the question there were a couple of things I missed.
Portlets were an attempt, it seems, to try to do as Google did on their homepage, where you could have multiple unrelated blocks of information on the webpage, so you could track your stack portfolio and your favorite hockey team, for example. I don't think it was influenced by PHP CMS as it was just an idea that was ready to come about, and if you need the server code to help pull the information, and to tie it into an application, this was one approach.
The closest thing in ASP.NET that I can think of to portlets are controls. I could have a stock portfolio control and when I include it on my page, you can set the options and it will show you your stocks and hockey team scores.
Not everyone uses JSF, for example, so controls would need to be written by hand as JSPs and servlets, with javascript.
Why would I want to use java portlets above tomcat and gwt?
These technologies are not directly comparable. Coming from regular web page development, Portlets seem like a very restrictive technology. But then the value of Portal servers is largely the control they give to administrators and users - the fact that this makes your life more difficult is irrelevant.
Would portlets make it less- or un- necessary for me to use jsp and jsf?
You can write directly to the output, just like you would in a Servlet. You probably still want a view technology (that will have to support portlets).

Best server-side framework for heavy AJAX Java application

There are zillions of Java web application frameworks.
95% were designed before the modern era of AJAX/DHTML-based development, and that means these new methods are grafted on rather than designed in.
Has any framework been built from the ground up with e.g. GWT + Extjs in mind?
If not, which framework has adapted best to the world of forms with dynamic numbers of fields and pages that morph client-side?
Echo2 / Echo3 by Nextapp (www.nextapp.com) is totally awesome.
Advantages over GWT:
1) It is not limited to a sub-set of java like GWT
2) It is easier (in my estimation) to learn
3) Has extremely robust design studio for almost drag and drop designing.
4) It is very fast, and works very well on all platforms browsers
5) You can write your application using either java script or java
6) It has great and straight forward methods for handling events and actions.
Personally I think that for any web-application in which you are trying to integrate java and speedy delivery I wouldn't hesitate to pick Echo3 or Echo2.
If you're starting from scratch. I'd have to say Google Web Toolkit. I have to say it is incredibly powerful. You get keep using most of your Java tools. Plus, you don't have to duplicate code that exists on both the server and the client, it just gets compiled differently for each area.
I'd consider REST-style frameworks as well as the other recommendations here- Restlet or Jersey may be good choices for the backend, while you use something like JQuery or GWT on the front end. Both frameworks can easily produce JSON, and the REST style provides a nice clean line of demarcation between your client application and your server source; I find that JSF can make that demarcation pretty muddy.
I use JSF and IceFaces. Although JSF has a few limitations, IceFaces seems to work pretty well and has ironed out a few of the problems with JSF.
I haven't used a really good AJAX Java framework as yet, although Echo2 looks interesting.
I like the stripes framework. It lets you use whatever javascript toolkit you want.
Here is their documentation on AJAX
GWT is quite powerful and easy to use (all Java, no Javascript/HTML/CSS coding). If Google has their way it will be a dominant framework/tool in web applications development, and for good reason. It already works with Google Gears (which allows offline access to web apps) - and more than likely will be optimized to work within Google Chrome.
DWR
I use this to dynamically populate drop downs, and even filter them on the fly based on user input in other places on the form.
I like the combination of JBoss Seam and Richfaces, especially with the JBoss tools that are extentions to Eclipse - makes building these sort of RIA's incredibly easy.
Wikipedia contains some useful comparisons:
Comparison of JavaScript frameworks
List of AJAX Frameworks
Your choice depends on several different factors including whether you want the "work" done client-side (most javascript frameworks) or server-side (echo2 etc.). Other things worth looking at are tools like OpenLaszlo that provide Flash (I think) out of the box, but drop back to DHTML if there is no Flash player present.
Unfortunately I think the decision comes down to balancing several competing cocerns. Check out the comparisons and try them out - most come with online demo's for you to try.
Aptana has a server side frame work called Jaxer. This is from their site:
Jaxer's core engine is based on the same Mozilla engine that you'll find in the popular Mozilla Firefox browser. This means that the execution environment you use on both the client and the server are the same. It's Ajax all the way through and through. That means you only need one set of languages -- the languages that are native to the browser -- to create entire applications.
This framework is open source and has a very nice IDE based on Eclipse. Aptana is also working on a Javascript implementation for ActiveRecord called ActiveRecordJS. Potentially you could use this both client and server side with their framework.
GWT is one of the best AJAX framework that I used ever. Most important thing about this framework is that its maintained by Google. And Everyone know "Who is Google ?"
GWT is used by many products at Google, including Google AdWords and Google
Wallet. It's open source, completely free, and used by thousands of
enthusiastic developers around the world.
GWT provide rich widgets that can be used to built any application. Almost all the widgets they have.
Another important point is GWT is continuously developing and its also have stable release which is very good thing. Another thing Google has also released GWT-Material which is again a very good thing because everyone is moving toward material.
I hope this will help you!!!

Categories