Link to home
Start Free TrialLog in
Avatar of InNoCenT_Ch1ld
InNoCenT_Ch1ld

asked on

What is Struts?

What is Struts???
Avatar of jimmack
jimmack

http://jakarta.apache.org/struts/index.html

Not too much more to say really ;-)
SOLUTION
Avatar of jimmack
jimmack

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Please be reasonable in your comments, I don't want to start a flame war (nor would that be useful to anyone).
Avatar of TimYates
I am firmly of the view that almost *every* professional web-application should be expandable, and maintainable...

Say you have the following case:

--------------------------

A small dev team want an online intranet diary, so they can see what they are working on, and the manager can see how things are going, and book meetings, etc
It is obviously quicker to write this as a bespoke app, with jsp's, a db connection, and some hardcoded usernames/passwords, as that would give you a 2 day (week?) turnaround on the webapp's completion...

Assuming it is good enough, then the marketing team want to use it too...  No need for a rewrite, as it can accomodate these people (as they are on the same network)

Slowly, more and more people want to use the application....when does it need rewriting?  When does it become a large/distributed application?

Say you have more than one office, where people need to book meetings with users in the other office...  

Now it is an internet application...  

Are you sure it's secure enough?

---------------------

Basically, my point is, even when you are told that "this is just going to be used in-house by me and him", assume the worst...  assume it's going to have multiple users, all hammering it at the same time...

That way, you don't have the nightmare of trying to maintain, and update simultaneously a web-app that people have got so used to that they cannot live without...

Otherwise, you end up at work, at night, trying to import all the old data into the new system, and test it all is still working...

Struts gives you a very good foundation for extensibility...  and with modules, and tiles, etc....new things can be added in parallel to your existing application...

Just my 2p :-)

Tim
PS:  As usual, my example is contrived, and rubbish....but I hope it gets my point across :-)

PPS:  Another good reason for using Struts is (as jim says); "there are a *lot* of jobs advertised at the moment that "require" struts experience"

:-)
Thanx Tim.

>> assume the worst

Always ;-)  And never rely on a requirement spec to be complete ;-)

>> Otherwise, you end up at work, at night, trying to import all the old data into the new system, and test it all is still working...

This sounds like hard-won experience ;-)
After seeing Jim's post in the interfaces question, I'll post my experiences with Struts

PRO-------------------------------

1)  It does allow you to separate your web-application's flow from the pages themselves...  This is GOOD, as I had a complete site redesign, and it only meant I had to edit my struts-config file to say where each form goes to on success or faliure (rather than edit every jsp)
2)  It handles i18n for you, I admit that I haven't used this -- I currently have one locale -- and it *does* require more thought than just throwing every bit of text into a properties file, but I know that as soon as French people complain they can't read my site, I can get a French speaking person to translate one file, and it will make my website french too (ish)
3)  It allows you to "modularise" your code -- using tiles.  Say you have a list of users that appears on more than one page, you can make this list a tile, and just put it wherever you want
4)  It handles file uploading -- using ithe commons libraries
5)  It handles tokens, so can stop multiple posts of the same page (like clicking submit loads on EE when asking a question doesn't) ;-)

CON-------------------------------

1)  The documentation is RUBBISH....  The books are RUBBISH...  The best resource is either here, or jguru (search on google with "site:jguru.com" in the search criteria)...  Even then, you end up with occasional days of trial and error...
2)  When you have something wrong, you more often than not get "JasperException: null" which is not very useful in the slightest :-(
3)  When storing your forms in the request, you cannot have userdefined types as form parameters...  This is a bit of a pain some times, as you then have to store the form in the session, which obviously increases the footprint of your application

That's all I can think of at the moment :-(

My best advice, is download struts1.1, and have a look at the examples...  They are probably the best resource out there, as I said, the books just seem to run through two or three contrived web applications, and do not give you lists of tags, parameters and examples (which is what you really want and need)

Tim
> This sounds like hard-won experience ;-)

Oh yes!  My record is a 56 hour stint with 3 other guys going from an oracle db on tape, to a completely (almost) working, multiple device, xml/xsl website...

Wish we had though a bit harder about version 1 -- or done some high load performance testing ;-) hee hee

Tim

> And never rely on a requirement spec to be complete ;-)

Hehehe, true...  And if the spec says "This will NEVER require XXX", then it WILL!  

9 times out of 10 this means that they thought of it, thought it would be cool, but can't afford to pay for it...  So as soon as the budget goes up a bit, it will become a new requirement...  Usually "floated in" during a management meeting :-(

Tim
Hehehe...I think I have wandered a bit off the topic of the question... ;-)

Ranty Tim
>> "floated in"

Like a poo that won't flush away.  Yes.  I've been there too ;-)
hm...i didn't have much expirience with Struts, but i like it very much in a way i separate the view from logic code, it's really easy to maintain .

   What's about heavy-weight ... hm..it depends on what you did you mean :)
If you asked about speed...than Struts is just implement 'Front-Controller' , i've took a look at the sources, there are nothing more than one hashtable lookup+one forward :)

If you've asked about size, so for webapp of 3 pages, you may be don't need ~1Mb of .jar's :))
  but if you have ~10 pages, depending on each other, i think it's not big cost for good structure and clear appliction-flow :)
in a laymans term... i still couldnt figure out what Struts is... what cn it do... where it is used... :P

i think it is used in web development area... and as im on this project now... so ill look into Struts even more after the conversation you people just had.
Avatar of InNoCenT_Ch1ld

ASKER

tim and jim>> so, can i conclude that the structs is something like a template??
Yeah, it lets you template your web-pages, and keep the data (further away) from the design of the website :-)
ok, one last question, if i want to use this "struct", what working environment do i need? i mean like Java we use JDK, JRE....

does it require any sort of compiler?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok, satisfy! ;p

-Child-
InNoCenT,

Just to clarify - Struts is a web application framework which employs the MVC pattern (Model View Controller) to separate the functional areas of the design into logical sections.

The View section will contains JSPs (or some other output format such as XML, XSL) to display data to the user and accept user input.
The Model is your back-end application (which has no concern abut display of info to the user)
The Controller is a Struts ActionController Servlet which maps http requests to Actions which in turn communicate with the model to retrieve data.

JavaBeans are used as ActionForms to contain data which may be passed between the model and view.

So, you'll need Servlets and JSP and JavaBeans which means getting JDK (J2SDK1.4) ensuring that it supports servlets. You'll also need a Servlet Container to run the app in - I suggest Tomcat.
And of course the Struts jar.

Cheers,

Steve
Thanks Stever for your additional information ;)

EE is always the place that full of wisdom, for trade ;p hehe

-Child-
Thanks for the points InNoCenT_Ch1ld ;-)

Sorry to hijack the question there.  I hope that the responses were as useful to you as they were to me.  It was almost exactly what I hoped:  Solid comments, good opinions and no arguments ;-)

Jim.
;)

i hate arguments too!!
This may be very useful for you if any one is looking for struts interview questions.