Taking a step forward in JAVA programming

R

ruds

Hi,
I'm currently working inJSP along witj Tomcat as my server and
Editplus as my editor.
I have to rebuild / redesign an existing web application.It is small
application showging records from database( MS-Access is my database),
and few functionalities like uploading documents, etc.
For this I'm thinking of using a framework(JSF, Spring, Hibernate)
(just for my intellectual growth, as I'm working alone and not in a
team but would like to).
please advice on what should I opt for?
Other suggestions are welcome as well.

Thanks
 
L

Lew

ruds said:
I'm currently working inJSP along witj Tomcat as my server and
Editplus as my editor.
I have to rebuild / redesign an existing web application.It is small
application showging records from database( MS-Access is my database),
and few functionalities like uploading documents, etc.
For this I'm thinking of using a framework(JSF, Spring, Hibernate)
(just for my intellectual growth, as I'm working alone and not in a
team but would like to).

I am not adept at Spring, and so far I don't like it much, but I've
used JSF and Hibernate extensively. I've also used OpenJPA and
EclipseLink as JPA layers (in lieu of Hibernate). I've done projects
with Struts, and also "raw" JSP/servlet applications (like Struts
where you reinvent the wheel).

I love Tomcat as an application server, particularly for one-person
projects such as you describe. You can set up data sources in the
deployment descriptors as explained in
<http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html>
and
<http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-
howto.html>
which also leverages the built-in version of Apache DBCP (Database
connection pooling).

It ties in well with Apache Web Server (httpd) or runs nicely
standalone.

JSF can be a little tricky. For me the insight was to think of it as
a component framework sort of like Swing, rather than a classic JSP
Web model. Facelets, which is JSF plus XHTML rather than JSP, is very
powerful. I always use Tomahawk with my JSF, apparently a widespread
practice.

The key to effective JPA (Hibernate, EclipseLink, OpenJPA) is to
expose an object model to the application, not a data model. There's
little point to an object-to-relational mapping (ORM) tool if you use
it for relational-to-relational mapping.

I spent a lot of time practicing on my own with JSF and JPA before
finding jobs that paid me to use them. All that practice was
extremely useful.
 
A

Arne Vajhøj

I'm currently working inJSP along witj Tomcat as my server and
Editplus as my editor.

There are probably a million developers working in similar
environment.
I have to rebuild / redesign an existing web application.It is small
application showging records from database( MS-Access is my database),
and few functionalities like uploading documents, etc.

Change database.

MS Access means the JDBC ODBC bridge and that is not good.

There are plenty of good embedded database for Java:
Derby/Java DB
HSQLDB
H2
etc.
For this I'm thinking of using a framework(JSF, Spring, Hibernate)
(just for my intellectual growth, as I'm working alone and not in a
team but would like to).

JSF, Hibernate (possible using JPA API) and just a tiny sprinkle of
Spring is both a common stack and do make some sense.

Arne
 
R

Roedy Green

please advice on what should I opt for?

Use as few tools as possible to get the job done, then later once you
have things working, add them one at a time. You will better
understand what you need. Having too many tools creates too many
haystacks for the needles to hide in.

You also avoid intellectually overwhelming yourself.
--
Roedy Green Canadian Mind Products
http://mindprod.com

There is no harm in being sometimes wrong especially if one is promptly found out.
~ John Maynard Keynes (born: 1883-06-05 died: 1946-04-21 at age: 62)
 
A

Arved Sandstrom

Roedy said:
Use as few tools as possible to get the job done, then later once you
have things working, add them one at a time. You will better
understand what you need. Having too many tools creates too many
haystacks for the needles to hide in.

You also avoid intellectually overwhelming yourself.

Your advice is generally good, but the OP is already at the point where
he's using JSP (one would assume that he's therefore got a grasp of
servlets) on Tomcat, and is using MS Access (so therefore JDBC). The
next logical abstractions are web frameworks and persistence frameworks,
and those are independent - if he gets an error related to one I don't
think he's going to waste too much time thinking it's the other.

I would second the advice given to switch from MS Access to something
like Derby or HSQLDB. It won't really slow down his education if he gets
a web framework in there at that point, makes sure things are working,
and only then switches to JPA. I say JPA because I would recommend
against using ORM native APIs unless you're stuck and there's no other
way around a problem.

I'm not going to recommend a web framework. I've used JSF and Struts a
lot, Spring quite a lot, and given Wickets a fair shake. I believe a
person can make any of them work, and of the two major players (JSF and
Spring MVC) I don't really see that one is better than the other. In
particular I don't buy any SpringSource claims that their approach is
easier than JSF...I don't think it's more difficult but it sure isn't
easier. For somebody with educational time to burn I'd say try
both...Spring MVC does have the advantage of being part of a whole
constellation of technologies.

AHS
 
A

Arne Vajhøj

I'm not going to recommend a web framework. I've used JSF and Struts a
lot, Spring quite a lot, and given Wickets a fair shake. I believe a
person can make any of them work, and of the two major players (JSF and
Spring MVC) I don't really see that one is better than the other. In
particular I don't buy any SpringSource claims that their approach is
easier than JSF...I don't think it's more difficult but it sure isn't
easier. For somebody with educational time to burn I'd say try
both...Spring MVC does have the advantage of being part of a whole
constellation of technologies.

Is Spring MVC really that popular?

There were a lot of hype some years ago when Spring
was red hot, but I believe the conclusion was that the
first versions of Spring MVC was crap. Later versions
should be better. But my impression is that JSF and Struts 1
are the big ones. And Spring MVC is just one out of many
in next tier (Struts 2, Wicket, Sling, Stripes etc.).

Arne
 
A

Arved Sandstrom

Arne said:
Is Spring MVC really that popular?

There were a lot of hype some years ago when Spring
was red hot, but I believe the conclusion was that the
first versions of Spring MVC was crap. Later versions
should be better. But my impression is that JSF and Struts 1
are the big ones. And Spring MVC is just one out of many
in next tier (Struts 2, Wicket, Sling, Stripes etc.).

Arne

You're right, I dashed that off without thinking that much about it.
Here's a guy who has done some fairly thorough analysis
(http://www.thebuzzmedia.com/which-is-the-hottest-java-web-framework-or-maybe-not-java/),
and he has it that JSF is the clear leader, Spring MVC/Web Flow
considerably less popular than I thought, with Struts 1/2 being 2nd
place, Wickets being 3rd, Spring MVC/WF and Seam trailing in 4th and 5th
place. This article
(http://ozgwei.blogspot.com/2008/06/which-is-hottest-java-web-framework.html)
refines the same Google Trends analysis some.

Note that commentary points out issues with this kind of analysis. But
unless someone has any better surveys it's all we've got. :)

In hindsight I suppose I'm not that surprised about the Struts 1/2
placing, but I am surprised that Wicket is that popular and Seam and
Spring aren't.

As a side note, despite articles like
http://www.thebuzzmedia.com/apache-wicket-powers-mobile-walmart-com/ I
am not enthused by Wicket. I think it's verbose, and I think that anyone
who believes that it's lightweight and clean hasn't built an equivalent
complex enterprise Java EE web app with something else like JSF.

It'll be interesting to see what happens because of JSF 2. I think most
people would concede that JSF 1.0/1.1 weren't great. JSF 1.2 made
significant improvements but still had a fair few problems.

The survey I'd like to see would ask experienced developers, who have
seriously used at least 3 of JSF 1.x, JSF 2, Struts 1, Struts 2, Spring
MVC, and Wickets, to rate what they'd use now in a complex full-stack
Java EE application. If they see something else like Seam being part of
the picture they can mention that too. Without a survey like that you're
lumping in developers who have to code up a serious app, with neophytes
who picked Wicket because it's trendy and are Googling to figure out how
to set up a Hello World app (*).

AHS

* Not to mention neophytes who picked JSF 2 because it's trendy and are
Googling to figure out how to set up a HW app. :)
 
A

Arne Vajhøj

You're right, I dashed that off without thinking that much about it.
Here's a guy who has done some fairly thorough analysis
(http://www.thebuzzmedia.com/which-is-the-hottest-java-web-framework-or-maybe-not-java/),
and he has it that JSF is the clear leader, Spring MVC/Web Flow
considerably less popular than I thought, with Struts 1/2 being 2nd
place, Wickets being 3rd, Spring MVC/WF and Seam trailing in 4th and 5th
place. This article
(http://ozgwei.blogspot.com/2008/06/which-is-hottest-java-web-framework.html)
refines the same Google Trends analysis some.

That match better with my expectations.
In hindsight I suppose I'm not that surprised about the Struts 1/2
placing, but I am surprised that Wicket is that popular and Seam and
Spring aren't.

As a side note, despite articles like
http://www.thebuzzmedia.com/apache-wicket-powers-mobile-walmart-com/ I
am not enthused by Wicket. I think it's verbose, and I think that anyone
who believes that it's lightweight and clean hasn't built an equivalent
complex enterprise Java EE web app with something else like JSF.

Wicket has been hot for some time.

Maybe it has just been hype and it will go away.

But maybe it will stay around.

I think its existence is justified. It is somewhat different
from the rest of the frameworks that are relative similar.

Arne
 
A

Arne Vajhøj

That match better with my expectations.


Wicket has been hot for some time.

Maybe it has just been hype and it will go away.

But maybe it will stay around.

I think its existence is justified. It is somewhat different
from the rest of the frameworks that are relative similar.

Personally I don't like Wicket either.

But I think other may like it.

Wicket and GWT are more fat client like than the more
traditional MVC frameworks.

Arne
 
K

Ken

That match better with my expectations.



Wicket has been hot for some time.

Maybe it has just been hype and it will go away.

But maybe it will stay around.

I think its existence is justified. It is somewhat different
from the rest of the frameworks that are relative similar.

Arne

Hi!

If we really want to take a step forward in JAVA programming probably
we need to see what is new around. This is not an advertisement,
though I am in fact one of developers of this thing. I see that
participants of this group are really experienced and qualified and
would like to know your opinion about one new framework named
HybridJava.

As to Wicket my impression is pretty negative. Especially after I read
the book "Pro Wicket". I believe I found some intentionally false
statements there. Here is a link to where I tell about it in details:
http://www.theserverside.com/discussions/thread.tss?thread_id=54866
 
L

Lew

Ken said:
If we really want to take a step forward in JAVA [sic] programming probably
we need to see what is new around. This is not an advertisement,

Sure it isn't.
though I am in fact one of developers of this thing. I see that
participants of this group are really experienced and qualified and
would like to know your opinion about one new framework named
HybridJava.

I'm not impressed.

It's like the worst of JSP but dropping the <% %> makes it really hard to read
the code. You claim to have MVC structure, but mingle presentation and logic
willy-nilly. You're not supposed to do that in JSP either, but at least when
you do there's a visual clue.

In the code examples you don't set off tag attributes in quotes. You don't
follow the Java naming conventions, or even consistently spell the name of the
Java language correctly in your site. You leave off the curly braces in code
blocks. That sort of carelessness in your code examples might mean nothing
but it raises red flags.

Your tags are weird - not really HTML-like at all. You also don't follow
modern conventions for HTML.

You place arbitrary rules for page-file directory structures, which JSP does not.

Tag libraries are cleaner than your approach.

You try to sound better than JSP. Aside from the fact that you aren't, the
world is moving to XHTML-based frameworks, such as facelets, putting you ever
farther behind the times.

I recommend folks stick with JSP or facelets for Java web stuff, and use
stricter MVC separation than you show.
 
K

Ken

Hi Lew! Thank you for you comments. Actually you've touched a lot of
issues, so probably I would not be able to address all of them right
now. This time want to tell the following. Your logic is not quite
perfect. It looks like you have a systematic problem with separating
Mandatory from Optional.
You don't follow the Java naming conventions, or even onsistently spell the name of the
Java language correctly in your site. You leave off the curly braces in code
blocks. That sort of carelessness in your code examples might mean nothing
but it raises red flags.

This whole paragraph is about Optional. You MAY follow whatever naming
conventions you like - HybridJava Compiler does not care. Same as Java
Compiler does not care.

You MAY handle blocks as you like. HybridJava Compiler does not care.
Same as Java Compiler does not care.

You MAY make typos in commentaries as well. All this paragraph is
written to discredit the author. It is not relevant to HybridJava at
all.

I would tell you something more regarding the so called Java Coding
Convensions, but this isout of topic.
Your tags are weird - not really HTML-like at all. You also don't follow
modern conventions for HTML.

Never heard about "modern conventions for HTML", but you MAY follow
them with HybridJava unlimited. And what is it HTML-like tags?
HybridJava understands all HTML tags and style of those you yourself
define with widgets - it is OPTIONAL for you to define them in any
style (within the tag paradigm).
You place arbitrary rules for page-file directory structures, which JSP does not.

Well that is a currently popular approach. See Maven or Web4J, Putting
files god kbnows where with subsequent end-less configuration is for
my much uglier. JSP does not? It does not, but many JSP
implementations do, like WebSphere.
Tag libraries are cleaner than your approach.

Not cleaner and with way less functionality. Those crasy .tld files -
are they really necessary?
Aside from the fact that you aren't, the
world is moving to XHTML-based frameworks, such as facelets, putting you ever
farther behind the times.

This is about Optional again. HybridJava does not care if you use HTML
or XHTML. In particular you would notice (if you really read those
about 15 pages of documentations) <br> and <br/> is all the same for
HybridJava. So you note is IRRELEVANT to HybridJava. Would it be in a
different topic I would assure you that XHTML is dead as of July 2,
2009, when the W3C decided to let the XHTML2 Working Group charter
expire. One can find statements like "world is moving to XHTML" on the
WWW. The latest I found is dated 2002.
I recommend folks stick with JSP or facelets for Java web stuff, and use
stricter MVC separation than you show.
You claim to have MVC structure, but mingle presentation and logic
willy-nilly. You're not supposed to do that in JSP either

What a mess! If you really succeed with 100% separation of
presentation and logic you well stay with static HTML. You may be
surprised, but for dynamic presentation layer you NEED a thing called
"presentation logic". If you tweak the syntax and camouflage "if" as
"<if", that does not change a dime.

And, again, that is about Optional. You know that in HTML standard
conditional and repetitive tags, I suggest that satisfies you.
HybridJava is different in that this kind of tags are definable by
user. Address the Sample Application again and see that indeed at the
pages level the "mingle" is nothing heavier than in JSP 2.0.
In the code examples you don't set off tag attributes in quotes.
FYI: HybridJava combines HTML and Java not only in syntax, but in
semantic as well. So <w p="x"
is not the same as <w p=x. You know that in Java x=y is not the same
as x="y".
 
A

Arne Vajhøj

Hi Lew! Thank you for you comments. Actually you've touched a lot of
issues, so probably I would not be able to address all of them right
now. This time want to tell the following. Your logic is not quite
perfect. It looks like you have a systematic problem with separating
Mandatory from Optional.

I think he has the handicap of knowing how professional Java code
looks like.

You don't seem to have that "problem".
This whole paragraph is about Optional. You MAY follow whatever naming
conventions you like - HybridJava Compiler does not care. Same as Java
Compiler does not care.

You MAY handle blocks as you like. HybridJava Compiler does not care.
Same as Java Compiler does not care.

You MAY make typos in commentaries as well. All this paragraph is
written to discredit the author. It is not relevant to HybridJava at
all.

The java compiler does not complain.

But you should expect all experience Java programmers immediately
to recognize beginner code.
Not cleaner and with way less functionality. Those crasy .tld files -
are they really necessary?

Yes, since the information in them is not available elsewhere.
This is about Optional again. HybridJava does not care if you use HTML
or XHTML. In particular you would notice (if you really read those
about 15 pages of documentations)<br> and<br/> is all the same for
HybridJava. So you note is IRRELEVANT to HybridJava. Would it be in a
different topic I would assure you that XHTML is dead as of July 2,
2009, when the W3C decided to let the XHTML2 Working Group charter
expire.

Nonsense.

Yes, XHTML 2.0 was cancelled.

But XHTMl is part of the coming HTML 5 spec, so XHTML is alive and
kicking.

Arne
 
K

Ken

I think he has the handicap of knowing how professional Java code
looks like.

You don't seem to have that "problem".

I do not have that problem. The handicap belongs to people form Sun. I
leaved and programmed for 25 years before Java. Without Java Code
Conventions I was doomed to live in sin for 25 years. And sin is
sweet.
The java compiler does not complain.

But you should expect all experience Java programmers immediately
to recognize beginner code.

Oh, let let them recognize that. I forsee feeling young again because
of that.
Yes, since the information in them is not available elsewhere.

And probably not necessary as well. Why did I do without such thing in
HybridJava?
Nonsense.

I have warned that talking about XHTML is not relevant. Let XHTML
prosper for the next 10 000 years. HybridJava Compiler is agnostic of
HTML/XHTML. Whatever you use at the input that you get at the output.
Jim was dissapointed that examples are written not in XHTML I guess.
Correction: plese instead of "in HTML standard conditional and
repetitive tags, I suggest that satisfies you." read: "in JSP 2.0
standard there are conditional and repetitive tags, I suggest that
those satisfy you."

I did not comment about MVC yet. Looks like I was able to explain that
View is not a result of taking all logic away. And separation of
presentation layer of whatever else is not a separation between Java
and ... HTML? ... JSP? - not sure what those separating folks mean.
Read about 5 principles of MVC Component Model on our site - what
other techology may match that?

K
 
W

Wojtek

Ken wrote :
I do not have that problem.

Well you can make your code look like anything. You can put each
element of Java on a separate line. You can use reverse indenting. Heck
you can make every second or third character a capital character.

And as long as you are the only one looking at your code, that's fine.

However if your code ever gets out into the general Java developer
community then you will get criticism. Conventions exist for a reason.
They make it a lot easier for other developers to read, understand, and
modify your code.

If you post code here (or any other language forum), and if you have
some non-conventional way of writing that code, then you will get
"pointers" from other developers. The vast majority of which DO follow
conventions.

It is not slavery to Sun, but rather ease of maintenance for which
coding conventions were developed.

So if you want to "break" the rules, feel free. But expect people to
correct your usage of the language.

And some will simply ignore you and your code because it is too much
trouble to decipher. Remember, the help you get here is entirely
voluntary, done by people who happen to be good at the language and who
also have enough community spirit to take time away from other pursuits
to try to help total strangers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top