Is there something like ASP.NET web user controls in Java / struts / jsp

In the java / struts / jsp world, there is something like an ASP.NET user control, a part of the back-end user interface that executes certain logic and can be pulled out and used elsewhere (for example, something like an input control )

+6
java
source share
2 answers

The Java EE API currently offers JSF 2.0 for Facelets. Note that Struts (2) is actually a competitor to JSF, and JSP is a view technology such as ASP, not an MVC framework. According to Java EE 6 / JSF 2.0, JSP has been replaced by Facelets as the default view technology.

In addition to the main JSF implementation, you can choose from a variety of β€œrich” component libraries that add extra CSS and Ajax sausage, such as PrimeFaces ( showcase ) and OpenFaces ( showcase ).

See also:

+5
source share

What you need is called tag files in the JSP. I found that they are not so easy to learn and use as .NET custom elements.

You can use them similarly to .NET controls.

The workflow is as follows.

  • Create tag file in web-inf / tags / AtillaTagLibrary / DropDownList.tag
  • link to your tag file in your jsp file as shown below

    <%@ taglib prefix="ct" tagdir="/WEB-INF/tags/AtillaTagLibrary"%> 
  • Use your tag file as a regular jsp tag.

     <ct:DropDownList /> 

These tag files can receive attribute values ​​from the outside, like user controls.

+2
source share

All Articles