October 2nd, 2002, 11:55 AM
How to start with java on the web
I am totaly new to java. My first web language is PHP and I think, that I am good at it
But ... now that I have finished some PHP projects I am getting sick of it.
It was fun on the start, but when my web's grow, then it isn't fun anymore. I have to write some things over and over again. It is very hard to find errors in such php webs ... If you look at .php files with all those echoes and stuff, you cant figure anything out. PHP is good for small pages (OK, you can also write big ones, but you risk a headache).
So what I am looking for is a language that is capable of separating code from design, possibly object oriented and open source.
I think that java fits here. Where should I start ?
If I got it correctly then JSP-s are almost the same as PHP ...
What should I use then ? I hear a lot about EJB an servlets. Do they give me what I want ? Do I need JBOSS ?
What is the difference between EJB and servlets ?
Do servlets use JSP ?
What are JDO, and OJB ?
October 2nd, 2002, 03:52 PM
Well, for starters, you can do OOP with PHP
Now for some definitions:
Servlet: Basic java web component. Functionally similar to a cgi script (think PERL).
JSP: An easier way to write servlets. Syntactically similar to PHP, JSP pages are first transformed into servlets, then compiled into byte code.
EJB: An alternative way to utilize a data source. An EJB provides an OO wrapper for data access. It handles its own storage and retrieval from a data source.
JDO: Don't know much about it. It appears to be an alternative to JDBC (SQL), and to compliment EJB's.
OJB: No clue
I think you'll need JBoss if you plan to work with EJBs, but you don't have to use EJBs for data access. They might even be a bit much depending on your application.
October 3rd, 2002, 04:12 AM
Still without an answer ;(
I am using it allready, but it is practically the same. I need some objects that are outside "the page", so they don't mess with my design and so the code and design aren't in the same file..
The various template stuff is also only a shortcut to my goal.
I don't like that eather, because it is only the other way - you dont stuff code in the design page, you stuf the design in the code page. You do those writeln's instead of echoes.
I need an object that lives in the server, without to be caled from the link (something.php) ...
I don't get what I want here .... it's basicaly the same as PHP in the concept ...
I don't get this
Is this what am I looking for ?
October 3rd, 2002, 03:47 PM
EJBs would probably do what you're looking for. It sounds to me like what you're needing is more of a JavaBean or taglib.
JavaBeans usually contain business logic. You can use tags to get and set properties, or use code to call methods directly. The can be scoped to the page, the request, the session, or the application.
Taglibs are (basically) a way to encapsulate the passing of parameters to an include. Kind of like function calls that don't return values.
You could also just use plain old java objects. The disadvantages of these over javabeans is that you can't get and set properties through tags, and if you want to scope them to the session or application you have to do it explicity.
You can duplicate the last option in php, though. Put your class definition in a seperate file, say "UserClass.php", the in your page you just include( "UserClass.php" );, the instantiate an object: user = new User();
Keeps your objects seperate from your design (at least for file structure).
October 4th, 2002, 04:33 PM
I wasn't sure where to start and if it is worth the learning ...
I'll download JBOSS and start learning ...