Procedure to Use Struts Supplied HTML Tag Library Based Jsp Tags in Our Struts Application

Step1: Gather information about the jsp tags of Struts-html tag library

              Refer Struts-home \ does \ Struts-taglib \index.html file.

Step2: Keep the Struts-html.tld file in WEB-INF folder.

               Gather it by extracting Struts-taglib-1.3.8.jar file by using winzip tool.

Step3:  Keep the html tag library related main & dependent jar files in WEB-INF \ lib folder to recognize & work with tag handler classes.jar files are: Struts-taglib-1.3.8.jar & its dependent jar files.

Step4: Configure this Struts supplied html tag library in web.xml file of Struts application.

                Web.xml

                            <web-app>

                                  <taglib>

                                       <taglib-uri> test </taglib-uri>

                                      <taglib-location> / WEB-INF /Struts-html.ltd </taglib-location>

                                 </taglib>

                           </web-app>

Step5: Use the jsp tags of Struts supplied html tag library in the jsp programs of Struts application.

                            Test.jsp

                                <% @ taglib uri = “test” prefix = “j” %>

                                    <j: form action = “reg.do”>

                                        Username: <j: text property = “username”/> <br>

                                        Password: <j: password property = “password” /> <br>

                                             <j: submit value = “login” />

                                 </j: form>

  • We can use the Struts supplied jsp tag library tags only in our Struts application that means they cannot be used in regular java web applications.

Leave a Reply

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