Nick Williamson

Ranch Hand
+ Follow
since Jan 06, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Nick Williamson

First off I have no experience with EJB 3.0, I've been using hibernate and spring. I hear it's very similar though.


1. Will it really give a lot of advantage to use the framework namely Struts, Spring, EJB 3.0, Hibernate and Ibatis? Could anybody share what is the greatest advantage that you've received from using the framework?

Yes frameworks wouldn't be frameworks if they didn't give you an advantage. You get a bit of structure (to a point) and you don't have to reinvent the wheel.

After I took the time to learn Hibernate, I haven't really looked elsewhere, it saves me a bunch of code in the persistence layer especially when used with Spring. It's very flexible to use the hql, sql, or query with your java beans and you can do any of those in the same dao, so you're not married to one or the other. A lot of options with this framework, but it's not a one night learn.

Ibatis is a light weight solution that I have seen some weird things (mainly with joins - actually it was only one issue) without any errors or warnings. This one is really easy to learn and easy to pick up in a day.

Struts is a good framework for following the MVC pattern as is Spring MVC, I've used both and like them both. If you're already using spring to tie in a service dao layer and tied into hibernate it may be good to use that in the UI because there is no integration issues, it's all spring.

2. What is the Cons of using such frameworks? Could anybody share what are the major problems when using the framework?

problems with using frameworks in general are using the wrong ones to get to your solution, not all frameworks are meant to be used for every program.

not learning the framework, if you don't take the time to learn it you can put yourself in a bad situation. Most people just use them without knowing what it does, take the magic out of it and learn what's going on with the code. Easy to do especially with open source frameworks

3. Understand that some datacentre are more rigid. i.e. usage of 3rd party framework is not allowed. Will using any of the framework will cause us to not able to implement the application in the data centre? Therefore, we will need to strip apart the framework?

This really isn't a question, if you can't use them, you can't use them.

4. How flexible are those framework? Can the codes still be twisted as flexible as what we want?

frameworks often provide an outline, but there are many different ways you can do it, writing wrapper classes is an example. Choose an extensible framework. I've had no issues extending struts, spring, or hibernate with abnormal things I have had to do to accomplish something. What that really comes back to is knowing the framework and being able to program it the way you need to.
I have no idea what you are talking about anymore. From your original question it makes no sense, the thing I have shown you should work the way you want. The way you get a list from the user is to have them submit the form to your action and then your array would only have the ids that were selected. I can't help you anymore with the information you have given. I see your code and that doesn't make sense to me either, all you are doing is creating an array of ids that are in your original list. That doesn't make sense. you have to have something to compare it to.
17 years ago
what is the scope of the form? if it's request it could be losing some of the values.
17 years ago
STOP POSTING THE SAME QUESTION OVER AND OVER AGAIN
17 years ago
same concept, you need to populate the values of the select with the list, don't set the values on the form. What you are doing, you're setting the values on the form so when the page loads all options will be selected.

1. DO NOT create an array from the list and set it on the form!
2. The array is going to be data filled from the form submit DON'T SET IT
3. Your select tag should use a list in the request or on the form, not the array from the from, that array is only to capture what is sent when the form is submitted.

17 years ago
I decided to post it anyway:

Struts action:



Struts config

17 years ago
To correct the first response: The answer is yes for struts 1 as well, take a look at DispatchAction. Instead of it executing the execute method you pass a parameter to it and it will execute that method as well, which you would define the parameter name in your struts config. So you can do things like myAction.do?parameter=save. When that is executed it will look for a method signature of save(...)

It will throw an error if it cannot find the method, there are ways of taking care of that. It's not the prettiest but it does get the job done if you're stuck with struts 1. I normally used it for CRUD functions and override the unspecified(...) to display the page and list the objects. Then my links on the page will pass parameters in to save, edit, delete, thus calling those methods in my action. If you need an example let me know and I'll copy an example in.
17 years ago
you realize that one post is sufficient, if you post many of the same questions in the same forum people are less likely to help you.
17 years ago
you realize that one post is sufficient, if you post many of the same questions in the same forum people are less likely to help you.
17 years ago
not sure I fully understand what you want to accomplish:

first off to create an array from a list is as simple as this:
list.toArray(); that will create an object array for you... API = your friend.

When the form is submitted it will submit the values checked so your jsp. First before you load the jsp put your complete ArrayList in the request and iterate over that to create your checkboxes in your jsp and give the checkboxes their value.

jsp code


once you submit, your form's array will be populated with all the ids that have been checked and you can do your processing from there.
17 years ago
well frameworks have really come into play because they take out a lot of the code you write over and over again every application. You'll find frameworks centered toward the UI in web applications like Spring MVC, Struts 1 and 2, and many others. Then there are persistence layer frameworks such as Hibernate , IBetas, and many more. It's just a way to get things done faster and have a rough structure to them. Easier to maintain (if you learn the framework).

I too started off using good old textpad with javac to compile my code. Now I'm on eclipse having my getters/setters, for loops and many other things being generated for me, while ant compiles all my code and builds my wars or jars for me. I no longer write sql, but put together queries using java beans and their attributes.

There are a ton of them out there, but if you get the right ones they can really help you get a lot done. It takes time up front, but after you get used to them you can fly through a project setup.

I've been using Struts/SpringMVC, Hibernate, Spring, Log4j, Ant, Junit for most of my projects. so far so good both on large and small projects, personally and professionally.

I hope this helped a little bit. Good luck sifting through all this stuff. Just look out for Grails, it's RoR but in java. interesting stuff.
your error has nothing to do with the location of the file, it the class. java.lang.NoClassDefFoundError: org/springframework/beans/factory/xml/XmlBeanFactory means that it cannot find the class XmlBeanFactory that is located in the package org.springframework.beans.factory.xml, Make sure you have spring.jar file in your classpath when you deploy the application - that class is in that jar file.
your best bet is to read through it on Spring's website then you may even be able to come up with an answer that you know, not one you memorized... it's ok because if they ask you in an interview it's probably going to be something you'll need on the job.
the most popular frameworks for creating web applications right now would probably be struts(1 or 2) or Spring MVC for the front end. Hibernate for the persistence layer, and spring to wire everything together. There are a TON of options out there, it's really picking the right one for the job, if it's 12 users or 1200, you should still build a solid application. it really depends on the type of app you're building too. With the info you gave there's not much to go on, but I've used those for both large and small projects and they've been fine.
As far as pulling out code into a jar what's the point of that in this case? Are you making more than one application? Or are you planning to reuse it in multiple different applications? Just because you have concurrent users does not mean you need 12 applications running. You'll just have to have your application manage the details of the users, otherwise your application server will handle most of that. Most every website has concurrent users, they each have their own session, from their own browser. It's not like after I login to this application you can hit profile and it's mine and not yours, although you could program it to be like that if you wanted to.
Spring works with Inversion of Control IoC and Aspect Oriented Programming (AOP). It also has a web tier, Spring MVC, along with may other aspects of the framework. This is the latest doc from spring, but I would start here and move off to books that show implementations of these ideas. http://static.springframework.org/spring/docs/2.5.x/reference/index.html
I think springs docs are pretty good without the other books.