Struts 1.x Installation Guide – Struts Tutorial

Struts 1.x Software installation gives:-

  1. Basic framework Software
  2. Plugins-> validator plug-in and  Ties plug-in
  3. Custom JSP tag libraries.
  4. Does about -> API, XML files, JSP tag libraries and etc.
  5. Example application
  6. Jar files representing struts API’s &other helper API’s.
  • Basic framework software contains the logics to generate integration logic of the controller layer dynamically.
  • “Plug-in” is a patch software or s/w application which can enhance the functionalities existing software or software application. In java plug-in come as jar files.
  • JSP tag library contains set of readily available jsp tags. Struts supplies 5 no. of JSP tag libraries have been JSP tags to make programmer developing the JSP programs Of struts application as java codeless JSP programs.
  • Struts home / lib /struts – core – 1.3.8.jar file represents the whole struts API. For this jar file multiple dependent jar files are there.
  • If the classes of a jar file use the classes & interfaces of b-jar file then b-jar file is dependent jar file to a-jar file.
  • Working with struts is nothing but developing web resource programs of normal java web application by taking the support of struts api.
  • Struts api in 3rd party api because it is not part of any java modules like JSE, JEE &JME
  • When java web application uses  3rd party API’s (other than JSE,JEE,JME API’s) then the 3rd party  API related main jar file should be added to class path and 3rd party  API related main jar & dependent jar file should be added to WEB-NF/ lib folder of web application.

First jar (main jar file):-

      Public class demo

             {

                   Public void xyz ()

                      {

                           Test t1=new test (); //initially use class test

                           T1.m1 ();

                     }

            }

Second jar (dependent jar file to first.jar)

      Public class test

         {

               Public class m1

                      {

                         ———–

                        ————

                   }

   }

Development of test app web application:-

      Test srv.java

           Public class testsrv extends httpservlet

               {

                    Public void service (httpservlet request req. httpservlet response res) throws servlet exception, ioexception

             {

                   ————

                    Demo d1=new Demo ();

                    D1.xyz ();

          }

   }

    //assume that sevlet-API.jar is already there is in class path.

Cmd  > javac testsrv.jar (x)

      Error: cannot find symbol demo, xyz

Solution:  add first jar file to class path (“where demo class is available in first.jar”)

cmd> javac testsrv.java -> gives testsrv.class file.

  • Prepare deployment directory structure and deploy the web application in web server.

Give request to testsrv servlet program from browser window…(x)

Exception: java.iang.NoClassDefFound:Demo

Solution: place first.jar file in lib folder of deployed test app web application 

  • Again give request to test servlet program from browser window-> Error come

Exception:  place second.jar file in / lib folder to deployed test app web application. 

  • Give request to TestSrv servlet program from browsers window…(success)

                  —> Response goes to browser window from servlet program.

  • In the above application the jar file added to the class path will be used by java compiler to recognize “demo” class while compiling the servlet program by the jar files placed if in WEB-INF/lib folder will used by servlet container to recognize & use Demo, test classes during the execution of servlet program.
  • Developing struts application is nothing but developing java web application by taking the support of struts API, in the development of web resource programs.

Leave a Reply

Your email address will not be published. Required fields are marked *