Nick Larson

Greenhorn
+ Follow
since Apr 21, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nick Larson

Like Paul said. Spring doesn't "replace" hibernate. Hibernate is a great tool, but Spring + Hibernate can make things a lot easier to do.

As far as disadvantages to Spring. I'm sure there are some somewhere. (Can't think of any right off the top of my head.) But Spring as a tool, isn't really a replacement for everything, but a way to make things easy and simple. Things like the JdbcTemplate, HibernateTemplate, JmsTemplate, DI (IoP), Quartz, Spring Security (Acegi), Spring Web Services...really do make things simpler. A lot of times these things are just wrappers on top of other technologies, but these wrappers make it possible to code with very little setup and boiler plate code. Again, back to the HibernateTemplate, this doens't replace Hibernate, as all the work is done by Hibernate, but by using Spring + Hibernate, you can write DAO's and functional code very quickly.

Try working with it for a bit. Do a couple of tutorials that can be found online. (Google Spring tutorial) Check out the example projects that are bundled with the Jars and Source. There are quite a few different ways to do things, and the Spring team does a good job of including example projects.

Nick
Vassili...


Check this out.

Spring is really great with all the documentation it provides. And not to take away from this forum (as it is a very good site, and contains a lot of information.), but check out this site as well. It is a forum dedicated to Spring. A lot of great people there to help you out with whatever you need.

Nick
Hello...

Spring can be used in all parts of your project. Should it be used? That is really up to you. I think that is the nice part about Spring, you don't have to use it for every layer. I think the most difficult part to learn is the DI aspect of Spring. It is really a simple concept, but can take a while to make sense. Once you "get" it though, you sometimes wonder how you ever worked without it. By being able to inject your beans into your classes, you can code very quickly and switch out implementations quickly.

You can replace Struts with Spring MVC. Spring MVC is a bit different than Struts, but by no means any less effective or usable. I have done projects using both. I am really hooked on the Spring MVC right now, and would probably use it as my MVC framework of choice. (Still need to work with Struts 2 though...that could change my mind.) One of the main advantages I see with Spring MVC over Struts is that your web forms are bound directly to your backing object. So in your Controller (Action in Struts), you don't have to build your object from the form parameters. It will automatically do that, and do any validation that you have written up.

Your EJBs could also be replaced. By using Spring you can just make POJOs and use them. You can apply transactions and security through AOP, and you don't need to have an EJB container. So you could do everything in your web container.

The Hibernate side. We still use Hibernate, but the way Spring can help you here is by using the HibernateTemplate. It has all your connection logic built into it. You just grab your template, and execute your commands. You no longer need to worry about getting a connection, running your command and closing the connection. It is all done for you. And if you want to get away from Hibernate, there are also Templates for other ORMs or just JDBC calls.

Hope this helps...

Nick
Bala...

I'm not sure why you are forwarding to another controller to display your page. Your page is rendered and submitted. The controller runs, then just displays the next page (With all your loaded data, no need to forward to another controller). If there needs to be a submit done from that (2nd) page, it can hit another controller on the submit.

This two controller thing seems to come from a Struts background. I have had to help a couple other people with this as well.

Try something like this...

xxx-servlet.xml



Your LogonFormController.....



Then in your account.jsp you should be able to reference your values by the ${customer.yourAttribute}.

Give that a try...let us know what you find.

Nick
Ok...5 more minutes, had it figured out....

I was close with my last try....

Here is what I did...

<tiles:useAttribute className="String" id="lMenuTitle" name="menuTitle" />
<mt:menu title="<%=lMenuTitle%>" />
18 years ago
I have tried something like this in baseLayout.jsp as well. I thought this would work, but I must be missing something.

<tiles:useAttribute id="lMenuTitle" name="menuTitle" />
<mt:menu title="<%lMenuTitle%>" />
18 years ago
Hello All..

I am trying to use on of my tiles as dynamic content. I guess the custom tag doesn't like the brackets, but am I am more interested if there is a "trick" to get this to work.

tiles-def.xml
===============
<definition name="myPage" path="/tiles/baseLayout.jsp" >
<put name="title" value="Main Title" />
<put name="menuTitle" value="Menu Title" />
</definition>


baseLayout.jsp
===============
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
<%@ taglib uri="/MenuTag" prefix="mt" %>

<html>
<head>
<title><tiles:getAsString name="title"/></title>
</head>

<body>
<mt:menu title=<tiles:getAsString name="menuTitle"/> />
</body>
</html>
18 years ago