[NA] PHP to JSP transition [NA]

CJones

Final Approach
Joined
Mar 14, 2005
Messages
5,812
Location
Jawjuh
Display Name

Display name:
uHaveNoIdea
I know there are some fellow web-coders here, and I usually get better info here than on 'tech' focused boards.

I've been writing a project in PHP and using Codeigniter 2 MVC framework to keep things organized. The company I work for has decided that JSP is to be used for their 'corporate' web applications. Since my project will eventually be handed off to corporate IT to be rewritten into JSP, I would like to get a head start on it and start developing new applications to JSP instead of PHP.

I've been reading up on 'Intro to JSP' type tutorials and I've got my localhost running a full Apache/PHP + Tomcat setup, so I'm ready to roll (I think).

Can anyone recommend any frameworks or tutorials that will help make the transition from PHP to JSP go more smoothly? I had a Java class a few years ago, but haven't done anything with it in a while. I'm using Netbeans 7 as my IDE, which comes with integration with the Spring Framework - anyone with experience with that framework? Would it be an easy transition from CI to Spring?

Thanks for any comments/suggestions.
 
Oldie but goodie is "Core Servlets and Java Server Pages" Google around. Spring Framework encompasses a lot. Dependency Injection and I've used the Spring MVC before, it'll get you by. I'd start with the Core Servlets book that'll give you a good foundation to make decisions on what frameworks you wanna use. Most of my Java time these days is spent developing Web Services and Swing applications so I don't get too much into the web site stuff. I do use JSF/Struts from time to time and wrote a from scratch application using the Swing MVC/Hibernate. Not much experience with net beans, MyEclipse is worth the 30 bucks and I'm mostly in JDeveloper these days. Oracle is doing a real good job of rolling J2EE,Weblogic and Oracle "stuff" all into the JDeveloper package, it get's exponentially better with each release.
 
Last edited:
When I teach this I use Murach's Java Servlets and JSP (2nd Edition) and have pretty good success. We don't get much into frameworks, however. I can't really speak to switching from one framework to another, much less from a PHP framework to a JSP framework. I would generally be doing all the heavy lifting behind the scenes in servlets and the like, though. How complex is the project?

Oh, and I agree with Bart. Core Servlets is a good book.
 
If you're dinking around with Spring, The Spring MVC is about as simple as it gets. We also rolled our own MVC. Next up is Struts, which is more popular but a little bit more cumbersome to get going IMHO. Then figure out JSTL, the J2EE Platform/Servlet Container you want to use, figure out that JSP pages are just Servlets, figure out how to configure it all with a text editor, I've found with Java a little up front understanding and frustration goes a long way as opposed to randomly clicking menus in an IDE until it works.
 
Oracle is doing a real good job of rolling J2EE,Weblogic and Oracle "stuff" all into the JDeveloper package, it get's exponentially better with each release.

Interesting. I'll look into JDeveloper - our IT App Dev group has mentioned that they want to put the app on the Oracle/WebLogic platform, so if they have a demo/dev version, I'll have to give that a hard look.
 
Interesting. I'll look into JDeveloper - our IT App Dev group has mentioned that they want to put the app on the Oracle/WebLogic platform, so if they have a demo/dev version, I'll have to give that a hard look.
Oh man. I hope to never, ever, ever, ever have to deal with WebLogic again. I *do* not miss that.
 
When I teach this I use Murach's Java Servlets and JSP (2nd Edition) and have pretty good success. We don't get much into frameworks, however. I can't really speak to switching from one framework to another, much less from a PHP framework to a JSP framework. I would generally be doing all the heavy lifting behind the scenes in servlets and the like, though. How complex is the project?

Oh, and I agree with Bart. Core Servlets is a good book.

Thanks for the suggestions.

The project isn't overly complicated - the premise is pretty simple - but handling the data is somewhat cumbersome because it doesn't really fit any standard accounting/manufacturing/asset tracking type of data structure, so I'm having to make it up as I go. The most complicated part right now is the fact that I am pulling from Oracle DB, MS SQL Server, and MySQL and having to combine all the data into one legible source (MySQL is being used as my core datacenter right now), so data formating and SQL code structure is annoying.
 
Thanks for the suggestions.

The project isn't overly complicated - the premise is pretty simple - but handling the data is somewhat cumbersome because it doesn't really fit any standard accounting/manufacturing/asset tracking type of data structure, so I'm having to make it up as I go. The most complicated part right now is the fact that I am pulling from Oracle DB, MS SQL Server, and MySQL and having to combine all the data into one legible source (MySQL is being used as my core datacenter right now), so data formating and SQL code structure is annoying.
I trust that you're doing all that data consolidation on the back end and not in PHP.

I use JDeveloper as my primary IDE. It's free, so you don't need to worry about a trial version! http://www.oracle.com/technetwork/developer-tools/jdev/overview/index.html
 
I trust that you're doing all that data consolidation on the back end and not in PHP.

I use JDeveloper as my primary IDE. It's free, so you don't need to worry about a trial version! http://www.oracle.com/technetwork/developer-tools/jdev/overview/index.html

As of right now, I do scheduled datagrabs from Oracle and MSSQL and do a data import into MySQL through PHP. The date formatting, etc. is done on the outbound side of Oracle & MSSQL so that PHP and MySQL don't have to worry about special formatting during import.

All of my front-end reporting is built on the MySQL database.
 
Oh man. I hope to never, ever, ever, ever have to deal with WebLogic again. I *do* not miss that.

Yikes. That gives me something to look forward to.
 
Yes, it is far easier to use some form of SQL on the backend than try and code in what's already available in SQL. Some things can get tricky though, like compensating for differet data types or formats and such.

<---<^>--->
 
So it sounds to me as if you have a lot of business logic in the PHP page. That will make it a lot harder to convert to JSP, as you'll need to reimplement that logic. If it's not too late, I would consider refactoring the design to have a Servlet that handles the database access and business logic, and use PHP to talk to that servlet and display the data. That should result in something where it is much easier to replace the front end.

And Jesse, what is it about WebLogic you don't like? We're an Oracle shop, and are consolidating our app servers on it.
 
So it sounds to me as if you have a lot of business logic in the PHP page. That will make it a lot harder to convert to JSP, as you'll need to reimplement that logic. If it's not too late, I would consider refactoring the design to have a Servlet that handles the database access and business logic, and use PHP to talk to that servlet and display the data. That should result in something where it is much easier to replace the front end.

I'm going to try to make a clean cut rather than trying to rewrite existing PHP to JSP. I'm mostly looking at going to JSP for future new projects.

I like the idea of using JSP as an intermediary between PHP and the database as a fix-gap if anything does get 'converted'. How do you get JSP to talk to PHP? JSON, or ???
 
Yikes. That gives me something to look forward to.


Negative review Jesse has there... I've found WebLogic to be about the easiest J2EE platform to develop for. Really can't think of anything that is difficult to do with it. The console is dead simple to use. If you use JDeveloper, it's all rolled up and ready to go. Biggest issue I've had is remembering the dang password to the console application. When A customer wants to lay out the cash for Weblogic, I do a backflip of joy.
 
Last edited:
I'm going to try to make a clean cut rather than trying to rewrite existing PHP to JSP. I'm mostly looking at going to JSP for future new projects.

I like the idea of using JSP as an intermediary between PHP and the database as a fix-gap if anything does get 'converted'. How do you get JSP to talk to PHP? JSON, or ???

JSP is typically your presentation layer. It's nothing but a file that gets processed into a .java file that pre-defines a couple of objects for you. It's just a nice way for doing out.write("<html>...</html>") In other words, They get converted to servlets then run. That's not really an over-simplification. you'll find a .java file and a .class file laying around after you call up a new/modified jsp.

Sounds like you might want to consider setting up/converting some business logic to web services and all the hassles they provide, I avoid PHP like the plague so I wouldn't know how to go about that. Hibernate is is pretty good for turning loose on a database and letting it setup a DAL and some business objects. Tweaking hibernate to your liking can be interesting.
 
Last edited:
So it sounds to me as if you have a lot of business logic in the PHP page. That will make it a lot harder to convert to JSP, as you'll need to reimplement that logic. If it's not too late, I would consider refactoring the design to have a Servlet that handles the database access and business logic, and use PHP to talk to that servlet and display the data. That should result in something where it is much easier to replace the front end.

And Jesse, what is it about WebLogic you don't like? We're an Oracle shop, and are consolidating our app servers on it.

I've done JBOSS development (Approx 3 years) (yeah, it's free and worth every penny)
Tomcat (Just the servlet container since oh I dunno 1999 or so )
WebLogic (Approx 5 years, since the BEA days)
and a little Websphere on AIX development here and there.

I've found WebLogic to be the best. Oracle/Bea have documented the heck out of it and the ODN forums are great for finding quick solutions. If someone else is payin' Weblogic is my first choice. Try out JDeveloper, it comes with a built in Weblogic server and is easy to get goin'. Very "Visual Studio"ish in that everything is now just kinda setup for you and you don't have to worry about the cryptic syntax of config files, setting up a server with the IDE etc... Now that Oracle owns Weblogic and Java too. They're getting a very nice platform together. It used to be pull pieces from here and there and wire it all up together, it comes pre-wired these days.
 
Negative review Jesse has there... I've found WebLogic to be about the easiest J2EE platform to develop for. Really can't think of anything that is difficult to do with it. The console is dead simple to use. If you use JDeveloper, it's all rolled up and ready to go. Biggest issue I've had is remembering the dang password to the console application. When A customer wants to lay out the cash for Weblogic, I do a backflip of joy.
It's been about 3 or 4 years since we we've been a Java shop - we were developing on BEA Web Logic and it was a total cluster back then. If you hit a bug, good luck, their support would take FOREVER.

I'm just more of an open-source guy that doesn't like bloaty java enterprise software. To each their own :)
 
I've done JBOSS development (Approx 3 years) (yeah, it's free and worth every penny)
Tomcat (Just the servlet container since oh I dunno 1999 or so )
WebLogic (Approx 5 years, since the BEA days)
and a little Websphere on AIX development here and there.

I've found WebLogic to be the best. Oracle/Bea have documented the heck out of it and the ODN forums are great for finding quick solutions. If someone else is payin' Weblogic is my first choice. Try out JDeveloper, it comes with a built in Weblogic server and is easy to get goin'. Very "Visual Studio"ish in that everything is now just kinda setup for you and you don't have to worry about the cryptic syntax of config files, setting up a server with the IDE etc... Now that Oracle owns Weblogic and Java too. They're getting a very nice platform together. It used to be pull pieces from here and there and wire it all up together, it comes pre-wired these days.
I've been doing JDeveloper since before they even had Struts built in! Right now, I'm running 10.1.3.5, since we still have some old 10gR1 OC4J app servers I need to support.

Oracle now owns at least 2 IDEs now (JDeveloper and NetBeans) and numerous application servers (OC4J, WebLogic, GlassFish, more?). And their version numbering is infuriating!
 
I've been doing JDeveloper since before they even had Struts built in! Right now, I'm running 10.1.3.5, since we still have some old 10gR1 OC4J app servers I need to support.

Oracle now owns at least 2 IDEs now (JDeveloper and NetBeans) and numerous application servers (OC4J, WebLogic, GlassFish, more?). And their version numbering is infuriating!

I am, as I type, porting an OC4J (OAS) based Web Services over to Weblogic and JAX-WS RI based services... You should see some of the casts to make the serializer happy. With JDeveloper 11, I guess you figured out, they dropped the oc4j support, 11 is much better than 10. 10 had some bad habits that were fixed in the 11 release but the oc4j kept us trapped, Free at last!

Although this gives me a headache

BLOB oraBlob = ((Blob)(cstmt).getObject( 4 )).unwrap(BLOB.class);
 
Last edited:
Holy crap I never knew so many pilots were also programmers/developers.. I stick to PHP/MySQL though. Learning JAVA is on my list of things to do though.

<---<^>--->
 
Holy crap I never knew so many pilots were also programmers/developers.. I stick to PHP/MySQL though. Learning JAVA is on my list of things to do though.

<---<^>--->
What do you mean "pilots?" This is PoA. Programmers of America. :D
 
Another nerd here. JSP, PHP, Whatever pays this week. For me, it's jQuery and Android Engineering. Tomorrow, who knows ;)

Nothing to add to the discussion whatsoever otherwise, just adding to roll call.
 
I'll throw the sysadmin point of view out here...

Tomcat and friends are a great way to take a fully-capable webserver and turn it into a quivering mass of Jell-O with a load average of 50.

Watch out for running java/tomcat out of shared memory too. Garbage collection is a myth. Ha.

I believe the sysadmin conversation goes something like this...

"The memory leak from hell needs another restart." ;) (Referring to tomcat.)
 
I'm just more of an open-source guy that doesn't like bloaty java enterprise software. To each their own :)
But, but, but.... JBoss is totally open source! *puppy eyes*

P.S. We can keep Oracle's feet to the fire as long as we keep CLASSPATH and gcj alive.
 
I'll throw the sysadmin point of view out here...

Tomcat and friends are a great way to take a fully-capable webserver and turn it into a quivering mass of Jell-O with a load average of 50.

Watch out for running java/tomcat out of shared memory too. Garbage collection is a myth. Ha.

I believe the sysadmin conversation goes something like this...

"The memory leak from hell needs another restart." ;) (Referring to tomcat.)

Keep complanin' I'll bring some first semester CS students over with a fresh understanding of malloc()
 
Keep complanin' I'll bring some first semester CS students over with a fresh understanding of malloc()

[/me starts having an epileptic fit trying not to cuss...]

R of K&R died a couple of days ago.

RIP dmr.
 
[/me starts having an epileptic fit trying not to cuss...]

R of K&R died a couple of days ago.

RIP dmr.
Dang, I hadn't heard that! :( I remember trying to learn C from their original book.:hairraise: Hint: it was NOT an easy read!
 
Dang, I hadn't heard that! :( I remember trying to learn C from their original book.:hairraise: Hint: it was NOT an easy read!
I read that he died too. I found the K&R book (both classic and ANSI) to be one of the best to the point books out there, Nice short and sweet. I own both copies. Probably helped that I knew C pretty well before i read it :D
 
Agreed. If you had a good grasp of computers before reading K&R, it was compact, covered everything necessary, and didn't waste your time teaching you how to program like most books. It taught you the language and its rules. Very nice.

Certainly better than "Learn to program X in 24 Hours!". :rofl:
 
Agreed. If you had a good grasp of computers before reading K&R, it was compact, covered everything necessary, and didn't waste your time teaching you how to program like most books. It taught you the language and its rules. Very nice.

Certainly better than "Learn to program X in 24 Hours!". :rofl:

I pointed out that someone had put "HTML For Dummies" on our bookshelf in the office. It was promptly removed.
 
I read that he died too. I found the K&R book (both classic and ANSI) to be one of the best to the point books out there, Nice short and sweet. I own both copies. Probably helped that I knew C pretty well before i read it :D
Yeah, my only programming experience at that point was ZBASIC, IIRC.
 
Necropost...

The situation that I described in my OP has come to fruition - we are officially beginning the rewrite of my PHP/MySQL application(s) into the Oracle ADF platform. I Googled "transition from php to jsp" and this thread was the first one listed (good SEO, Jesse and team!).

What's 'fun' is that nobody on our team has done ADF before, so we're all learning as we go. Yee... frickin... haw... We're trying to round up some 'formal' training to get us over the initial learning curve of the platform so we can focus on the more deep-diving functionality.
 
Last edited:
Necropost...

The situation that I described in my OP has come to fruition - we are officially beginning the rewrite of my PHP/MySQL application(s) into the Oracle ADF platform. I Googled "transition from php to jsp" and this thread was the first one listed (good SEO, Jesse and team!).

What's 'fun' is that nobody on our team has done ADF before, so we're all learning as we go. Yee... frickin... haw... We're trying to round up some 'formal' training to get us over the initial learning curve of the platform so we can focus on the more deep-diving functionality.

This does not sound like management has any idea how to reduce risk of software development failures. Just my $0.02.

It's going to be painful and overly expensive. Congrats on securing your job for at least two years, though. ;)
 
This does not sound like management has any idea how to reduce risk of software development failures. Just my $0.02.

It's going to be painful and overly expensive. Congrats on securing your job for at least two years, though. ;)

Java scales much better than PHP IMHO. I've seen many of battles lost when PHP projects get too big for PHP. Java = Bloated and 80% of the project is getting started but once it's rolling you won't be jumping ship back to PHP.

I do have concerns about the Q/A at oracle these days, the stuff coming out the door in the past couple of years makes Microsoft of the 90's look like the epoch of stability.
 
Back
Top