aspose file tools*
The moose likes Struts and the fly likes struts or JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts or JSF" Watch "struts or JSF" New topic
Author

struts or JSF

hamlin stephen
Ranch Hand

Joined: Dec 11, 2003
Posts: 45
Hi,
We are on discussion of starting one new project on ejb.
We've experience in struts.But for this project it is planning for choosing Java Server Faces.please comment on this suggestion.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

Hamlin,
Do they have a reason for switching or is it just for the sake of trying something new?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
hamlin stephen
Ranch Hand

Joined: Dec 11, 2003
Posts: 45
Hi Jeanne,
Yes, for trying new technology,moreover it is from sun.
Joseph Hatton
Greenhorn

Joined: Dec 12, 2002
Posts: 20
Hamlin,

If you understand Struts really well, then JSF is the next logical step. I noticed that JSF derive some of its attributes from Struts like the config file(faces-config.xml), bean mapping, and page navigation. I noticed that JSF has little more flexiblity and power than Struts. I say this because Struts makes you conform to the Action and Form structure but JSF does not. JSF strongest suite is its UI components. It ties the bean nicely to the form components. JSF has a steeper learning curve, but once I got my head around it, I really liked it.

I would recommend not using Sun Studio creator because it uses proprietary object that is not standard in JSF download. I noticed this because this one developer decided to move from Studio creator to Eclipse. Each bean created by Sun Studio Creator extended AbstractPageBean. The AbstractPageBean is referenced in the jsfcl.jar which is not included in the JSF 1.0 download. I would say be careful of using that IDE.
John Dahlstrom
Greenhorn

Joined: Dec 06, 2004
Posts: 4
Hi Joseph,

Like Hamlin, I am also considering using JSF for an upcoming project. Can you recommend a different IDE for JSF, which do you use?

Thanks,
John
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
I too see a lot of potential in jsf, but it's still to mature ... the current implmentation contains a lot of bugs.
I am currently using in our project and majority of the time is spent in finding the work arounds (even for the simplest of the functionalities like "resetting" a page).
Sun studio and WSAD 5.1.2(my preference) are pretty good IDEs for JSF. But beaware prior to using any of the properiety components provided by these IDEs incase you plan to migrate to another server/IDEs


- Varun
Dan Ludwig
Greenhorn

Joined: Jun 05, 2004
Posts: 18
Just beware of what you're getting into with JSF -- don't dive in just because it's a Sun spec.

I did a long evaluation of jsf, and it has a lot of potential, but the implementations are still in infancy. JSF has a lot more power than struts when it comes to extensibility, but some features just aren't there yet. For example, you can't submit a JSF form using the GET method -- all form submits are POSTs. There are a lot of little nuances like this that surprised me.

The upside to this is that you can create your own tags, components, validators, converters, events, etc, extending JSF to meet your requirements. Just because the features you need might not be in the RI doesn't mean you can't create them. The problem is that you could get so bogged down in JSF details that you could lose track of your application project.

I agree that the power of components is probably the biggest advantage JSF has over struts, but the RI components are basic. You can use the basic components to compose more complex ones, for example using two list-boxes and some action-buttons to create a shuttle component. Oracle is building a lot of components like this into their ADF faces, but it too is relatively new. I chose not to use JSF yet because its DataModel hierarchy didn't have the kind of pagination support I was looking for, although I'm sure that problem will eventually be solved.

So, it depends on your application / project. Just beware that although JSF is a lot like struts, it's not the same, and some things you take for granted in struts might not be available in JSF.

Good Luck,

Dan
Joseph Hatton
Greenhorn

Joined: Dec 12, 2002
Posts: 20
Hi, all.

Of course it is in its early stage but any issues to bugs is because of JSF 1.0. I noticed that JSP imported from another JSP acted kinda weird. I recommend that you update JSF 1.0 to JSF 1.1. I haven't seen a bug in the mid-size project I have completed.

Actually, you can get data from a GET through JSF:
If you have a link http://localhost:8080/jsf/main.jsf?userid=joseph&pwd=test, you can access the parameters this way:
FacesContext ctx = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)ctx.getExternalContext().getRequest();
String userid = request.getParameter("userid");
String pwd = request.getParameter("pwd");

Where you invoke the actionListener or the data binding, the GET values are always available through the FacesContext in JSF.

Actually, I just got finished with moving data from one listbox to another listbox. The functionality occurred where there were able to select multple items from the list and hit the ">>" button to move it to the seletected listbox. The great thing about this is that it did not require one single line of JavaScript. It was all done through JSF.

I think the biggest misunderstanding that I had was comparing Struts to JSF. Or better yet, applying what I know to JSF. While Struts is servlet concentric based, where action is routed to the ActionServlet and then back to JSP for display. The concept is totally different for JSF, where all action or behavior is component based. If you have 4 buttons, you can literally tie 4 DIFFERENT BEAN to these button. Also, you have to understand the behavior of JSF. If you are using the ACTION event and ACTIONLISTENDER, which does it execute first? If you submit a FORM and ACTION is not specified(in JSF, you do not have to specifies where it goes to next), where does it go? If you submit on a form with no ACTION value, JSF will naturally submit back to the page that submiited it. Point being, there is alot more learning curve to JSF than what is being assumed. Although, it has similarites as I mentioned before, trying to compare Struts to JSF can lead you down the wrong path or leveraging it improperly.

I think any IDE is appropriate. I cannot give advice on which IDE is better than another. Currently, I am using Eclipse 3.0 and running Tomcat 5 with a plugin as my app server.

Hope that helps.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You might also want to note that there is a proposal for Struts 2.x (Shale) to use JSF as the view component and be rid of the Struts Taglibs. You can read about it here.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts or JSF