JSP vs. Struts vs. JSF vs. Swing vs. Tapestry vs. Spring vs. Rails

Discussion in 'Java' started by Sam, Jan 4, 2006.

  1. Sam

    Sam Guest

    I am a JSP developer and am constantly feeling like I am missing the
    boat by not using any of the other frameworks out there.

    However, the couple I have looked at (JSF and Rails) don't impress me.
    In JSP, I keep all of my logic in Servlets/Beans and all of my
    presentation in the JSP file, making custom tags when I need to do some
    HTML that involves some logic. So Servlets and Tags are the glue to the
    JSPs and Beans. I don't see what is wrong with this model. The
    biggest advantage is its flexible.

    An example of my frustation with JSF (which is different than all the
    other complaints) was attempting to popup a JSF page in a new window, I
    had to to some hokey stuff to make it happen. Rails seems to claim how
    easy it is to get something up and running. Well, I don't mind taking
    a day (or a week) to get my foundation right, and then having a
    flexible, high performance base from which to develop from. I don't
    want 80% to be easy and then the last 20% to be practically impossible.

    And, finally, I am confused by all the other choices that I haven't
    even mentioned. However, I'm not looking for a dozen replys that say
    'Go try this or that'.

    I would like to know: What is wrong with a JSP/Custom
    Tags/Servlet/Beans design (Not necessarily the full J2EE model 2)?

    Thanks
    Sam
    Sam, Jan 4, 2006
    #1
    1. Advertising

  2. Re: JSP vs. Struts vs. JSF vs. Swing vs. Tapestry vs. Spring vs.Rails

    Sam wrote:

    >
    > I would like to know: What is wrong with a JSP/Custom
    > Tags/Servlet/Beans design (Not necessarily the full J2EE model 2)?


    In my book, nothing is wrong with that. As a contractor, however, I
    often feel that using Struts (previously, now converting to JSF) is
    safer, easier to maintain and upgrade.
    Malte Christensen, Jan 4, 2006
    #2
    1. Advertising

  3. Sam

    Aquila Deus Guest

    Sam wrote:
    > I am a JSP developer and am constantly feeling like I am missing the
    > boat by not using any of the other frameworks out there.
    >
    > However, the couple I have looked at (JSF and Rails) don't impress me.
    > In JSP, I keep all of my logic in Servlets/Beans and all of my
    > presentation in the JSP file, making custom tags when I need to do some
    > HTML that involves some logic. So Servlets and Tags are the glue to the
    > JSPs and Beans. I don't see what is wrong with this model. The
    > biggest advantage is its flexible.
    >
    > An example of my frustation with JSF (which is different than all the
    > other complaints) was attempting to popup a JSF page in a new window, I
    > had to to some hokey stuff to make it happen. Rails seems to claim how
    > easy it is to get something up and running. Well, I don't mind taking
    > a day (or a week) to get my foundation right, and then having a
    > flexible, high performance base from which to develop from. I don't
    > want 80% to be easy and then the last 20% to be practically impossible.
    >
    > And, finally, I am confused by all the other choices that I haven't
    > even mentioned. However, I'm not looking for a dozen replys that say
    > 'Go try this or that'.
    >
    > I would like to know: What is wrong with a JSP/Custom
    > Tags/Servlet/Beans design (Not necessarily the full J2EE model 2)?


    It's too inconvenient to use for me. Take a look at tapestry 4, the
    page is just plain html with extra attribute for components, so web
    designers can co-work with you at the same time. And it supports IoC,
    annotations, and better state management, etc.
    Aquila Deus, Jan 4, 2006
    #3
  4. Sam

    Sanjay Guest

    I also happen to read the JSF specification lately, I guess by using
    JSF framework , i think we are looking at a framework that
    doesnt restrict to HTML, HTTP and some other constraints that we are
    used to.
    May be I can quote the introduction here for you to understand what is
    JSF and its punch line.

    "JSF's core architecture is designed to be independent of specific
    protocols and
    markup. However it is also aimed directly at solving many of the common
    problems
    encountered when writing applications for HTML clients that communicate
    via
    1-8 JavaServer Faces Specification · February 2004
    HTTP to a Java application server that supports servlets and JavaServer
    Pages (JSP)
    based applications.
    JSF tackles the following challenges associated with these
    applications:
     Managing UI component state across requests
     Supporting encapsulation of the differences in markup across
    different browsers
    and clients
     Supporting form processing (multi-page, more than one per page, and
    so on)
     Providing a strongly typed event model that allows the application to
    write
    server-side handlers (independent of HTTP) for client generated events
     Validating request data and providing appropriate error reporting
     Enabling type conversion when migrating markup values (Strings) to
    and from
    application data objects (which are often not Strings)
     Handling error and exceptions, and reporting errors in human-readable
    form
    back to the application user
     Handling page-to-page navigation in response to UI events and model
    interactions."

    Guess the gist is more than this.

    Rgds
    Sanjay
    Sanjay, Jan 4, 2006
    #4
  5. Re: JSP vs. Struts vs. JSF vs. Swing vs. Tapestry vs. Spring vs.Rails

    Sam wrote:
    ....
    > An example of my frustation with JSF (which is different than all the
    > other complaints) was attempting to popup a JSF page in a new window, I
    > had to to some hokey stuff to make it happen.


    <zen question>
    What 'hokey stuff' does the end user need to do/install to
    avert that (often irritating, and uninvited) pop-up/new window?
    </zen question>

    --
    Andrew Thompson
    physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
    Andrew Thompson, Jan 4, 2006
    #5
  6. Sam

    Andy Dingley Guest

    On 4 Jan 2006 07:23:21 -0800, "Sam" <> wrote:

    >I am a JSP developer and am constantly feeling like I am missing the
    >boat by not using any of the other frameworks out there.


    You'd probably find that Struts is a very lightweight add-on to whatever
    it is you're currently doing. It's just a lightweight framework for
    structuring things in the way you're already doing them, but taking some
    of the logic out of the code and putting it into config files.

    If it isn't (and I think it probably is) then go read "Bitter Java". If
    that _still_ doesn't make you re-think your application structures at
    the design pattern level, then you're probably missing the boat
    completely - the code probably sucks and looks more like ASP than decent
    JSP/Servlets. (or, &deity; forbid, it looks like PHP).
    Andy Dingley, Jan 4, 2006
    #6
  7. Sam

    isamura Guest

    "Sam" <> wrote ...
    : I am a JSP developer and am constantly feeling like I am missing the
    : boat by not using any of the other frameworks out there.
    :
    : However, the couple I have looked at (JSF and Rails) don't impress me.
    : In JSP, I keep all of my logic in Servlets/Beans and all of my
    : presentation in the JSP file, making custom tags when I need to do some
    : HTML that involves some logic. So Servlets and Tags are the glue to the
    : JSPs and Beans. I don't see what is wrong with this model. The
    : biggest advantage is its flexible.
    :
    : <snip>

    I also come from a similar view point. Regardless of the framework in use, having a clean separation
    between presentation and logic is a design I strive for. I have seen examples of JSF (also EL in JSP
    2.0) and it feels wrong, to me. In terms of what JSF "tackles", they can all be done with the
    JSP/Servlet model. In fact JSF is just a higher level of abstraction build on top of JSP/Servlet.

    I think JSF is more useful for page designers as they can "add" logic to their application without
    learning Java, servlets or custom tags. The trade-off is they have to maintain spaghetti code.

    ..k
    isamura, Jan 4, 2006
    #7
  8. Sam

    Sam Guest

    Thanks for all the replys.

    All I am trying to say is what is so wrong with a "well architected"
    JSP/Custom Tags and Servlets/Beans? Is it really that much more
    complicated? Too slow to develop in? Hard to maintain? I just don't
    see any of these as problems.

    I admit there are some things that each Framework does better (Rails -
    gets you up and running quickly, JSF - handling page to page navigation
    and UI control stuff like maintaining state) but they also have their
    drawbacks.

    With so many frameworks it just confuses developers and makes all of
    the frameworks "less than they could be" by creating FUD (as to which
    one to use, am I using the right one) and spreading the expertise too
    thin.

    It's really a shame...

    Sam
    Sam, Jan 4, 2006
    #8
  9. Sam

    JScoobyCed Guest

    Re: JSP vs. Struts vs. JSF vs. Swing vs. Tapestry vs. Spring vs.Rails

    Sam wrote:
    > Thanks for all the replys.
    >
    > All I am trying to say is what is so wrong with a "well architected"
    > JSP/Custom Tags and Servlets/Beans? Is it really that much more
    > complicated? Too slow to develop in? Hard to maintain? I just don't
    > see any of these as problems.
    >
    > I admit there are some things that each Framework does better (Rails -
    > gets you up and running quickly, JSF - handling page to page navigation
    > and UI control stuff like maintaining state) but they also have their
    > drawbacks.
    >
    > With so many frameworks it just confuses developers and makes all of
    > the frameworks "less than they could be" by creating FUD (as to which
    > one to use, am I using the right one) and spreading the expertise too
    > thin.
    >
    > It's really a shame...
    >
    > Sam
    >


    I am really glad you started this thread. I had similar questions a few
    months ago in this group and I guess I didn't expose my idea clearly
    enough: I got only two answers telling something like "framework sucks"
    with no real explanation.
    I am currently working on a new web application, which today is basic
    ASP, i.e. presentation, business logic and UI control are all mixed in a
    indigestable (does that word exist ? :) ) messy soup of M$ code.
    We are moving to J2EE, and we are exploring the differenct frameworks.
    We came to similar conclusions: frameworks are great stuff to help you
    do basic or "not-too" advanced web-app. But as soon as you have specific
    need, or you want something the meets only your needs (i.e. not a
    generic reusable multipurpose code) to optimize the application, then
    the only way we found is to design our own framework.
    The task is not too complex, as we got our inspiration from those
    existing framework, but we take only the things that are usefull to us
    and rebuild it the way we need it.
    It has however a drawback: if you have an important turn-over in your
    staff (here in Thailand this is crazily important), then the new staff
    has to learn your framework. The learning curve is a little bit slower.
    If you use struts for ex., then in your job description you can filter
    easily.
    Also, the framework you design might need some time to be "bullet-proof"
    and stable.
    One good point is that it is interesting to design and create.

    But we really think it is better this way and we are actually quite
    confident in what we have done so far. We are not done yet, but I would
    say we are about 40% from a nice (small) framework.

    Good luck

    --
    JSC
    JScoobyCed, Jan 5, 2006
    #9
  10. Re: JSP vs. Struts vs. JSF vs. Swing vs. Tapestry vs. Spring vs.Rails

    JScoobyCed wrote:
    >
    > I am really glad you started this thread. I had similar questions a few
    > months ago in this group and I guess I didn't expose my idea clearly
    > enough: I got only two answers telling something like "framework sucks"
    > with no real explanation.
    > I am currently working on a new web application, which today is basic
    > ASP, i.e. presentation, business logic and UI control are all mixed in a
    > indigestable (does that word exist ? :) ) messy soup of M$ code.
    > We are moving to J2EE, and we are exploring the differenct frameworks.
    > We came to similar conclusions: frameworks are great stuff to help you
    > do basic or "not-too" advanced web-app. But as soon as you have specific
    > need, or you want something the meets only your needs (i.e. not a
    > generic reusable multipurpose code) to optimize the application, then
    > the only way we found is to design our own framework.
    > The task is not too complex, as we got our inspiration from those
    > existing framework, but we take only the things that are usefull to us
    > and rebuild it the way we need it.
    > It has however a drawback: if you have an important turn-over in your
    > staff (here in Thailand this is crazily important), then the new staff
    > has to learn your framework. The learning curve is a little bit slower.
    > If you use struts for ex., then in your job description you can filter
    > easily.
    > Also, the framework you design might need some time to be "bullet-proof"
    > and stable.
    > One good point is that it is interesting to design and create.
    >
    > But we really think it is better this way and we are actually quite
    > confident in what we have done so far. We are not done yet, but I would
    > say we are about 40% from a nice (small) framework.
    >
    > Good luck
    >


    I believe that large, complex web sites can benefit from an MVC
    framework like struts. However, for the benefits to pay off, the site
    must be well designed from the ground up...looking at the flow of
    information, databases, business objects/processes, authentication,
    security, i18n, rapid/dynamic customization, etc.

    From my experience, struts does not lend itself to quick and dirty.
    Just my $0.02.

    -Missaka
    Missaka Wijekoon, Jan 5, 2006
    #10
  11. Re: JSP vs. Struts vs. JSF vs. Swing vs. Tapestry vs. Spring vs.Rails

    Sam wrote:
    > Thanks for all the replys.
    >
    > All I am trying to say is what is so wrong with a "well architected"
    > JSP/Custom Tags and Servlets/Beans? Is it really that much more
    > complicated? Too slow to develop in? Hard to maintain? I just don't
    > see any of these as problems.


    There is nothing wrong with it. After all, these frameworks are also
    built on top of those technologies as well. It sounds as if you already
    have a framework of your own code built up. So unless you find it too
    complicated, too slow to develop in or too difficult to maintain just
    keep on truckin'.

    >
    > I admit there are some things that each Framework does better (Rails -
    > gets you up and running quickly, JSF - handling page to page navigation
    > and UI control stuff like maintaining state) but they also have their
    > drawbacks.
    >
    > With so many frameworks it just confuses developers and makes all of
    > the frameworks "less than they could be" by creating FUD (as to which
    > one to use, am I using the right one) and spreading the expertise too
    > thin.
    >


    HTH,
    Ray

    --
    XML is the programmer's duct tape.
    Raymond DeCampo, Jan 6, 2006
    #11
  12. Sam

    stive_deivis

    Joined:
    Dec 2, 2008
    Messages:
    4
    shine j2ee framework

    Hello.
    I `m stive deivis . I `m a java developer.
    Today I want to speak about a new J2EE framework to name SHINE , that I read several document and comment about that.
    In many of these documents complimented about shine whereas even a big project also do not implemented with shine framework.
    Nonetheless When I see these compliment about shine framework, and I see PAUCITY documents about shine`s shortcomings, I be enthusiastic fore learning more about shine framework.
    Therefore I download shine frame work from sourceforge.net/projects/shine-app/ and deploy several sample with that.(those samples that write with shine support team)
    I must avowal shine frame worke have a powerful architecture and have simple usage,
    But:
    To my idea it`s soon for praise shine framework and shine`s ability because of shine not tested by high developer and not implemented a big project with it.

    of course some of shine`s abilitys such as " it is SERVICE ORIENTED , working with AJAX in shine is easy , support MVC and shine is easy to use " is demonstrator a powerful framework,

    but:
    some ability of shine such as JWMS ARCHITECTUR that saying it `s shine framework`s special Architecture , is a new Architecture and nobody don`t understand what is it(like me). And in my search in internet I understand is not any document about that. I don`t know why some developers compliment than JWMS .
    to my Idea it `s soon for discussion about shine`s abilitys with this confidence and I can`t implement my project with it because it `s new and unpromising , until developers impelement several project with it and accept it such as a powerful J2ee framework.


    however I belive shine will be a good frame work in future. but for now, it `s not a confident j2ee frame work.

    This text is only my Idea and if some one have any proof unlike my idea , his/her can discuss it.
    stive_deivis, Dec 3, 2008
    #12
  13. Sam

    Sofia

    Joined:
    Dec 5, 2008
    Messages:
    1
    JWMS is:

    Hello Stive!

    If u want know what is JWMS I think I can help u!

    It would help u to organize ur project & let ur project to have more efficiency because of its scope about your response pages! JWMS says insted of having many respose pages u can group them & lay each group on one JSP page ! so u will have some different services with their own pages which every one can response to many requests!


    In Fact, when u are developing , your response page acts as a service & its tags act as the service's pages! and all of them would have the same format of their service! And the mapping class will forward you to one of the service's tags that is suitable for your request!



    as u see JWMS is powerful really,isn't it?!:veryprou:

    more infomation:
    J2SOS.ORG
    Sofia, Dec 5, 2008
    #13
  14. Sam

    stive_deivis

    Joined:
    Dec 2, 2008
    Messages:
    4
    thanks sofia.but is shine framework a JWMS framework?

    hi.
    thanks sofia.is it a jwms framework realy?
    I must test shine`s JWMS architecture and then Speak about that.
    but thank you for your ansewer to my post.

    have you more information about shine fore answer to my LIKELY quastion about shine framework?

    instead of it you can ask any quastion about struts and jsf than me.
    I answer to all of your question my friend.

    thanks and good luck.:stupido:
    stive_deivis, Dec 9, 2008
    #14
  15. Sam

    stive_deivis

    Joined:
    Dec 2, 2008
    Messages:
    4
    thanks sofia.but can u give more info about shine's validation too?

    hi sofia.
    thanks for your answer.that is intrest for me.
    but my frient can you give more info about shine framework's validation and engineering to me my friend?

    I really need to more info about shine framework fore decide and choose a j2ee framework for my project?

    with more thanks:
    stive deivis.
    stive_deivis, Dec 16, 2008
    #15
  16. Sam

    mehdi mousavi

    Joined:
    Feb 15, 2009
    Messages:
    5
    J2EE and Service Oriented Programming-part1(shine j2ee framework)

    J2EE and Service Oriented Programming

    Authored by: AmirSam Bahador
    Level:
    Advanced
    Contents:
    Introduction
    - The purpose of compilation this essay

    Chapter 1: Basic concepts of J2EE
    - Servlet and JSP
    - MVC
    - MVC or JWMS? That is the problem? Perhaps both!

    Chapter 2: Basic concepts of Shine Framework
    - What is "Shine Framework”?
    - The components of Shine Framework
    - Implimentation of an application by Shine Framework

    Chapter 3: The objects of Shine Framework
    - The types of objects in Shine Framework

    Chapter 4: Engineering & Communication items
    - The communication of Shine Framework with the other
    existing Frameworks
    - The major purpose of Shine Framework


    Introduction
    The purpose of compilation of the this paper
    A few years ago, when I was the software architect of a big project with J2EE, I advised some of the modern tools of that time to the project manager. He acknowledged it. Therefore, we began deploying our Enterprise on Java platform. However, we encounterd with many problems, as we got ahead the project. Our tools were included Struts Framework, Spring Framework & Hibernate.

    I convinced that MVC architecture is the best option to develop macro projects! However, I believe it now, as well. Couldn't it be more completed? In developed Enterprise projects, an advanced architecture is required to divide the project, technically. The project was successfully finished after one year, but my mind was busy with it for a long time!

    Then, I began implementing an Application Framework and registered it in Sourceforge.net as an Open Source Framework. I developed some Enterprise projects & some other J2EE frameworks, as well. I achieved a good result! The velocity of implemention & developing projects increased up to 50%. Subsequently, by cooperation of my elected students who had worked with Application Framework, I established an organization, named J2SOS, to protect & develop this Application Framework.
    Fortunately, my students were so skilled that each took a chief task in big J2EE projects.
    Their experiences had a practical affect on development of Application Framework as well as the organization.
    Therefore, it is required to write down my & my yesterday students (my today co-workers) experiences. This was the outset to write the present paper!

    Chapter 1
    The basic concepts of J2EE
    Purposes
    In this chapter, we do our best to introduce J2EE basic concepts.
    Servlet & JSP
    If you ahve ever worked with JSP & Servlet, you know that Servlet is so proper for processing functions but there are particular problems with it in displaying functions.

    JSP is applied reverse to Servlet. Thus, what is the solution? To apply both JSP and Servlet together!

    What is MVC?
    MVC is an easy way to use JSP & Servlet together. In MVC architecture, the request will be processed by a Class (Servlet) and the appropriate response will be showen by JSP.

    See Figure 1-1


    Figure 1-1

    In the above Servlet Class, the validation operation, etc will be done.

    Nowadays, there are numerous Frameworks which will assist you to use MVC Framework architecture. Struts Framework is the most well-known one.
    MVC or JWMS ? That is the problem! Perhaps both!

    MVC is a powerful architecture, but it is required an advanced architecture to implement developed projects.
    Today, web applications are well developed which complicatethe work for programmers & developers.
    To clarify it, see Google site! Google Web Application enjoys numerous services, each have a special service for the users.
    For Instance, Gmail service, E-Mail or by SearchEngine, the users can search for websites, pictures, etc.

    These services have certaily close communication with each other.
    If the services do not use a particular architecture, the Google will encounter with various problems.
    In Service Oriented architecture, each part of the program is a service programme. For example, E-Mail service, SearchEngine service, etc.

    Consider Electeronic-Goverment application. This application does numerous services; each can be regarded as a separate application.


    Figure 1-2

    However, there is a problem! These applications should have communication with each other, i.e., a communication which is not a simple messaging one! I propose JWMS architecture to solve this problem!
    Java Web Model Service (JWMS) transforms each part of E-Government application to a service. For instance, E-Bank service, E-Ministry service, etc.

    See Figure 1-3

    Figure 1-3

    As you see, the request of user is transfered to Model via Web, it is processed by the Model t and the user is directed to the proper Service.
    Model means a Servlet which processes the Request of the user.
    It is likely that, in the first outlook, this architecture looks like MVC. Wait! You are not familiar with its internal components, yet!
    To understand it obviously, you should be familiar with a Framework.

    J2EE Service Oriented Programming
    In
    shine
    Framework


    J2SOS Organization Web Site: J2SOS.org
    You can finde complete document in: j2sos.org/download/doc.rar
    mehdi mousavi, Feb 15, 2009
    #16
  17. Sam

    mehdi mousavi

    Joined:
    Feb 15, 2009
    Messages:
    5
    J2EE and Service Oriented Programming-part2(shine j2ee framework)

    Chapter 2
    Basic concepts of Shine Application Framework

    Purposes

    The purpose of this chapter is to introduce you Shine Application Framework.
    What is Shine Application Framework?
    Shine Application Framework is a Service Oriented Framework which assists you to implement applications in accordance with MVC & JWMS architedtures.
    The components of Shine Framework
    In applications which impliment by Shine, the request is first processed by the Model and the user is directed to the proper Service.

    The Class that acts as Model is called Mapping. Mapping Class is similar to a servlet.

    Each Mapping Class should extend “j2sos.shine.controller.Mapping” Class & implement “public void rater()” method.

    Each service includes a JSP or a JSF page or … in which there are a succession of Shine’s rules and its exclusive tags.


    See Figure 2-1:

    Figure 2-1

    Let’s review exclusively the components of the application which have been implemented by Shine.

    See Figure 2-2:



    Figure 2-2


    The request is processed when it inserts the Mapping Class which spacifies the appropriate service for the user’s request and directs the user toward the service by web.xml file.
    Implimentation of an application by Shine Framework
    Make a web application as below:



    Then apply “shine.jar” file to your library.
    After adding the mentioned library, change “web.xml” file as follow:


    web.xml file (it source is in complete document)



    Now, let’s analyze this file.
    - “Description” tag indicates the name of application.
    - “Servlet-name” & “servlet-class” tags show the name & address of “Mapping” class.

    - “Init-param” tag and “ServerConsoleStatus” property & its “true” value notify Shine that the descriptions of the request should be displayed in Server side

    This property will help you to get information about the requests via text environment of ApplicationServer. This property will certainly remind you of “showsql” in “Hibernate”.

    - “Init-param” tag & its “Content-Type” property indicate the type of the contents of the response.
    - "Init-param" tag & "servicename1", "servicename2" properties identify two services to Shine as well as specify the address of each service on the same server or the other one in Shine.
    - "Servlet-mapping" tag indicates a name to attain "Mapping" class to the requests.
    - The address of the library of Shine is identified to the ApplicationServer by "Taglib" tag.

    Getting to know setting of Shine's properties in "web.xml" file, you should put "shine.tld" file beside "web.xml" file.

    At present, “ properties’ setting of “web.xml” file is finished & we should consider the “Mapping” classes.

    All of “Mapping” classes should be extended “j2sos.shine.controller.Mapping” class and implement “public void rater()” method.

    For instance, let’s impliment “view.MyMapping” class.

    Package view;
    Import j2sos.shine.controller.Mapping;
    Public class MyMapping extends Mapping
    {
    Public void rater()
    {
    Forward("servicename2","tag1");
    }
    }



    As you see, this class enjoyes a method named “rater”. When the request inserts the “MyMapping” class, It will automatically be called.

    This method is responsible for the first processes on the requests.

    It is obvious that another method has been called in this method.

    “Forward” method lead the user to the proper service. In this example, the user will be directed to “servicename2” service.

    The value of “tag1” will be further explained next.

    It is noted that you can call “forward” method by the other methods.

    Package view;
    Import j2sos.shine.controller.Mapping;
    Public class MyMapping extends Mapping
    {
    Public void rater()
    {
    m1();
    }
    public void m1()
    {
    forward("servicename2","tag1");
    }
    }

    As it is previously mentioned, “servicename1” & “servicename2” indicate the address of two JSP pages which perform as a service.

    Let’s implement one of these services (JSP pages).

    Since “servicename2” is utilized in the previous example, we implement “service2.jsp” now. First “web.xml’ should be reviewed.



    Iimplement a JSP page initially named “service2” with the following contents:
    <% taglib uri="/web-INF/shine.tld" prefix="shine"%>
    <header>this is shine Application</header>
    <tags>
    <shine:tag name="tag1">
    Hello.this is service 2 and tag 1
    </shine:tag>
    <shine:tag name="tag2">
    Hello.this is sevice 2 and tag 2
    </shine:tag>
    </tags>
    < footer>J2sos Organization </footer>


    In the beginning of the above page, the library of ApplicationServer is identified.

    This page (Service) includes four principal tags.

    “header” & “footer” tags act as the same as header & footer of text pages.

    The values of “tag1” & “tag2” perform as two pages. When you call “forward” method in “MyMapping” class as below:

    Forward (“servicename2”,”tag1”);

    The user will be directed to “service2.jsp” as well as “tag1” will be displayed alongwith header & footer.

    This is Shine Application !
    Hello , this is service 2 and tag 1
    J2SOS Organization

    Now, if you call “forward” method in “MyMapping” class as below:

    Forward (“servicename2”,”tag2”);

    The user will be directed to “service2.jsp” and “tag2” will be displayed alongwith header & footer.

    This is Shine Application !
    Hello , this is service 2 and tag 2
    J2SOS Organization

    This type of coding in these pages lead to data sorting. In these pages, you can get values once via JSP and use it in all tags.


    <% taglib uri="/web-INF/shine.tld" prefix="shine"%>
    <header>this is shine Application</header>
    <tags>
    <%! String name;%>
    <%name="ali";%>
    <shine:tag name="tag1">
    Hello.<%=name;%> this is service 2 and tag 1
    </shine:tag>
    <shine:tag name="tag2">
    Hello. <%=name;%> this is sevice 2 and tag 2
    </shine:tag>
    </tags>
    < footer>J2sos Organization </footer>



    In fact, in this architecture, JSP pages act as “Service” & tags are considered as your “pages”.

    Now, let’s impliment “service1.jsp” page.
    <% taglib uri="/web-INF/shine.tld" prefix="shine"%>
    <header>this is shine Application</header>
    <tags>
    <%! String name;%>
    <%name="ali";%>
    <shine:tag name="tag1">
    Hello. this is service 1 and tag 1
    </shine:tag>
    <shine:tag name="tag2">
    Hello. this is sevice 1 and tag 2
    </shine:tag>
    </tags>
    < footer>J2sos Organization </footer>


    To direct user to this service, it is merely required to call “forward” method as below:

    Forward (“servicename1”,”tag1”);

    To get the address of JSP pages & setting them in “web.xml” file, each page is directly run directly, then its address is indicated in “web.xml” file.



    In these pages, reverse to Struts, you can use objects of request, response, etc in JSP since URL values are sent to JSP pages (Services) by “Mapping” classes send to.

    Being acquainted with “Mapping” classes & “Service” pages, you should be able to send the request of user to “Mapping” class.

    Therefore, It is required to set the value of the Action of HTML forms on your Mapping classes.


    It is observed that this form bears a text field called “name” and the value of its action has been set on “MyMapping” class.
    Now, let’s survey on sending request by Ajax! In this example, you should put “ajax.js” & “md5.js” files beside the request page.



    As you can see, this form have a name. its information is sent to “MyMapping” class via “ajaxSubmit” method.
    The value of “flase” in “ajaxSubmit” method causes the user not to communication with the request page till receiving the response.

    “AjaxLoad” method will automatically be called when the form is sent. While the response is received, “ajaxResponse” method will be called, as well.

    The value of “content” value includes the response of “MyMapping” class.

    You can use “ajaxMD5Submit” method instead of “ajaxSubmit” one to send the information of form in MD5 format to “MyMapping” class.

    “ajaxEternalSend” method acts similar “ajaxSubmit” method but it sends an URL and receives response, constantly. For instance:

    ajaxEternalSend(“MyMapping.exec?name=’’ali”,false,4);

    In this method, the number “4” indicates a time scale to send URL to the “MyMapping.exec” class again.

    Some other methods are determined in “component.js” file to help you in communication with java.
    mehdi mousavi, Feb 15, 2009
    #17
  18. Sam

    mehdi mousavi

    Joined:
    Feb 15, 2009
    Messages:
    5
    J2EE and Service Oriented Programming-part3(shine j2ee framework)

    Chapter 3

    The objects of Shine Framework

    Purposes

    In this chapter, the objects of Shine framework will be discussed.

    The types of objects of Shine framework
    As you know we have not achieved a parameter in mapping classes yet, therefore, 3 methods are used in these classes as follows;
    - getRequest() method acts similar to request object in JSP.
    To get parameter from URL, it is required perform as bellows;

    getRequest().getParameter(“ParameterName”);

    getConfig() and getResponse() method are applied the same as getRequest() too.


    j2sos.shine.script.Server class help you work with server operating system API. If you intend to install a web based operating system, you can use this class.
    The followings are the methods of this class:



    To work with each method, you should make an object from this class.
    Herein, the above methods are described.

    Write() and writln() methods create a text on textual consul of Application Server.

    getFileValue() method receives a directory and afile name, then return the contents of textual file.

    writeFile() method receives a directory, a file name as well as file contents and makes a file in server.

    createFolder() method recieves a directory and a file name to create a folder in server.

    deleteFolderAndFile() method deletes a file or folder in server.

    getCurrentDate() method sends back server's local time .

    shutDownApplication() method stops the executing application.

    j2sos.shine.script.CompietionRequest class helps you to receive parameters from URL. The followings are the methods of this class:



    getUserid() method sends back identify number of the user session.

    getRequestCounter() method makes a general counter and recieves a value for indicating the step of counter.
    The other methods of this class perform similar to request.getParameter("ParamName") command, except they help you in casting and validation.
    For instance, getStrParam("name","it is null") method leads the value of name to be sent back from URL, if this value is not available in URL, "it is null" value is returned.
    j2sos.shine.monitor.ServerConsole class bears a method named showSeverConsole, which receives an object of request and displays the descriptions of request by application server console.
    j2sos.shine.socket.ResponseService class have a method named getTagText, which receives an URL and tag name, then returns the contents of tag.


    Chapter 4
    Engineering and communication items

    Purposes

    In this chapter, you are acquainted with engineering and communication items.

    The communication of Shine Framework with other existing Frameworks

    As you now, the communication of a framework with other frameworks is extremely important.
    You can communicate with other frameworks in shine.
    These frameworks include as follows:
    Hibernate
    Spring
    Struts
    Or even Jsf, I am sure you have idea in this regard.
    I try my best to put some of frameworks beside shine.
    You can have several methods in mapping classes, for instance:


    In this class, it is first received PageName value from URL.
    Next, regarding PageName value, the service which should respond the request, will be identified.
    If the insert value is p, p1Validation() method will be called.
    If the input value is p2, p2Validation() method will be called.
    If it is not input any P1 & P2 values, the user will be directed to errorservice and the value of notexisturl tag will be displayed.
    If it is not input any P1 & P2 values, the user will be directed to errorservice and the contents of URL tag will be displayed.
    If the developer makes an Exception, the user will be directed to errorservice and the contents of exp will be displayed.
    Suppose we made an aspect file and programming it as before running each of methods(P1Validation, P2Validation), the other method is called.
    Therefore, you will create a powerful management in mapping2 class.
    Now, let's combine struts and shine together. It is required to use struts tags in your own service tags. For instance:



    As you see, you can easily communicate with other existing frameworks in shine.
    Ther have been published numerous papers about SHINE and JDBC , etc. See the following websites:
    j2sos.org .

    The major purpose of Shine framework

    The main purpose of shine framework is implementing service oriented applications. In this framework, the developer is focused on implementing services.
    This framework includes java web model service (JWMS) and MVC , which provides a particular system in implementing enormous applications.



    J2SOS Organization Web Site:J2SOS.org
    You can finde complete document in: j2sos.org/download/doc.rar
    mehdi mousavi, Feb 15, 2009
    #18
  19. Sam

    mehdi mousavi

    Joined:
    Feb 15, 2009
    Messages:
    5
    Shine J2EE Framework 1.2 Vs. Other J2EE Frameworks

    Shine J2EE Framework 1.2 Vs. Other J2EE Frameworks

    Author: Amir Sam Bahador
    Level:
    Advanced
    Subjects list:
    Introduction
    -The object of edition of this article
    First chapter: Can one method change all things?
    -One new method
    -Advantages

    Introduction:
    The object of editing this essay:

    What we expect from the new tools, are not more than what they are, so we can hope. For few years, new J2EE Framework for Java did not become popular like the Struts. I do not say that it is not made, but I say that it did not become popular, but we submitted you new program more that what you expect, so be ready and choose your way and method.
    A way for approaching shine.

    First chapter: Can one method change all things?

    Objects:
    In this chapter, we are going to acquaint you with shine's new features in 1.2 editions.

    One new method:
    In the previous small article (J2EE And Service Oriented Programming), you have acquainted with shine. If you have not studied the article J2EE And Service Oriented Programming, firstly, I suggest you to study it, then keep continuing to study this article, because I do not like to make voluminous article, whereas others like it.

    I am sure that you have worked with Session, Application in JSP and FormBean in Struts. Utilizing each of them has the own special problems. Disadvantages of utilizing the above mentioned cases are traffic bar in Ram level, complicated codes and boring.
    As we addressed in the previous article, on the contrary to Struts, in Shine, you can use the URL parameters in the services.
    For example, you can send the name's contents to the mapping class via one URL, and after the processing the name's contents, guide the user toward a service, you can use the URL's contents again in the considered service. This process was not possible in Struts, and not now, you have 3 principal options for doing this process in Struts.
    1- Utilizing the Session: making busy the server RAM.
    2- Utilizing the Application: limited utilizing
    3- Utilizing the FormBean: establishing some extra classes
    It is done easily in shine; you can use easily URL's contents in considered service again in shine. But, it is not finished yet.
    For clearing the case, we give an example. You have made a HTML form in which there is a context filed which is titled famil. When the user submits the form, the functional program will guide him/her toward the mapping class. In the mapping class, the amount of received URL which contains the famil has been considered, and user is guided toward the special service.
    In the considered service, the famil amount has been received and displayed twice; this is what the shine does!

    There is a small problem, assume that you need to produce amount and send it to the considered service in the mapping class. this amount does not exist in the HTML format! Mapping class undertakes to produce this amount.
    In the mapping class, you can not use Application, Session and FormBean.
    Figure 1-1
    As you see, the above mentioned function is not possible in shine, but be careful that there is a much loveable creature which is titled URL.
    In the mapping class, you are able to add an amount to the URL easily and guide toward the considered service.
    I give an example regarding the above mentioned case, in order to clarify the matter:
    Assume:
    You have created an HTML format, in which there is a context field which is titled famil, when the user submits the form, the functional program guides him/her toward the mapping class, in the mapping class, the received URL's amount which contains the famil's amount is considered and the age will be created, and after doing this process, the age will be added to URL, and the user is guided toward a special service. In the considered service, the famil amount and age are obtained from URL and displayed for it.
    Come to observe the amounts of URL's parameters before entering the mapping class:
    Famil=fowloer
    Now, come to observe the amounts of URL's parameters after exiting the mapping class, and before entering the service:
    Famil=fowloer&age =23

    Be careful that there is no limitation in utilizing the method of addURL , you could use session just one time, but you can use this method , pay attention to the following example:
    Figure 1-2

    In the previous example, the famil's amount was sent through form and URL to the mapping class, when the code is done, age=23 and name =Amir is added to URL, now you can receive amount, name, age and famil in the considered service 2 and show it to the user.
    With the above mentioned method, you have used URL instead of application, now come to use URL instead of session.
    Figure 1-3

    In the above code, the age and name will be added to URL in any condition.
    If the user famil will be equal to fowler, the amount of sent URL to service 2 will be as follow:
    Famil=fowler&age=23&name=amir

    If the user famil will not be equal to fowler, and for example, it would be equal to bahador, the amount of sent URL to service1 will be as follow:
    Famil=bahador&age=23&name=amir
    Now, pay attention to the following code:
    Figure 1-4

    If the user famil will be equal to fowler, the amount of sent URL to service 1 will be as follow:
    Famil=bahador&age=23&name=amir&address=newyork

    Advantages:
    With utilizing this method, you do not need Session, Application and FormBean.

    I can't show this sample's pictures in this forum. please download complete sample from below link:
    j2sos.org/download/doc.rar

    J2SOS Organization Web Site:J2SOS.org
    mehdi mousavi, Feb 15, 2009
    #19
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    659
  2. Gac

    Struts or Tapestry

    Gac, Mar 10, 2005, in forum: Java
    Replies:
    2
    Views:
    395
    Arjunan Venkatesh
    Mar 10, 2005
  3. Replies:
    0
    Views:
    434
  4. Karel Miarka
    Replies:
    3
    Views:
    180
    Karel Miarka
    Aug 10, 2006
  5. Shaguf
    Replies:
    0
    Views:
    156
    Shaguf
    Dec 11, 2008
Loading...

Share This Page