How creating the tag of JSTL library and add it to the project in Netbeans?

Sometimes we need creating own jstl tag to adding it to the project. Example for use of this is repeated code. Imagine that you need add for several JSP pages the short form with one text field , list and submit button.

Create in Netbeans Java Web project as Web Application. I name my project MyJSTLTag.

Right click the project node and choose New->Java Class.

You see New Java Class window. In Class Name write MultiForm name and click the Finish button.

In MultiForm.java file paste code:

package net.doraprojects;

public class MultiForm {
   private String personName;
   private String[] listLang;
   
   public void setPersonName(String personName){
       this.personName=personName;
   }
   public String getPersonName(){
       return this.personName;
   }
   public void setListLang(String[] listLang){
       this.listLang=listLang;
   }
   public String[] getListLang(){
       return this.listLang;
   }
}

Next step is creating JSTL tag. Right click the project node and choose New->Other.

From Categories section choose Web and from File Types select Tag File.

Click the Next button.

In Tag File Name field write shortform name,

Click the Finish button.

Paste into shortform.tag file code:





                        
                               
                        
Name of person:                     
Languages:                             English                 Polish                Spanish                            
                

Delete from project node index.html file. Create index.jsp file. Right click the Web Pages in project node and choose New->JSP.

In File Name field write index and click the Finish button.

Paste into index.jsp file this code:









    
        
        Form
    
    
        
          
        
    

Run application.