Search code examples
struts2struts-1

What is the alternative for classes like org.apache.struts.taglib.bean.WriteTag & org.apache.struts.taglib.logic.PresentTag in Struts 2?


I'm trying to migrate a part of my existing project from Struts 1.1 to Struts 2.5 framework. But I'm facing while replacing the tags like "write" tag in the "struts-bean.tld" and "present" tag in the "struts-logic.tld" tag libraries with their corresponding Struts 2 tags as these tags are not present in the in-built "struts-tags.tld" file of Struts2. Can anyone please help me out ?


Solution

  • We no more require the struts 1 tags. Remove these tags for your jsp pages and also remove the .tld files (struts-html, struts-logic,struts-bean) from the folder you have placed in workspace.

    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    

    Struts 2 uses only a single tld, the struts-tags.tld. Add this in your jsp

    <%@ taglib prefix="s" uri="/struts-tags" %>