import os

def addTextTagtoJstl(jstlPath,applicationId):
    root_len = len(os.path.abspath(jstlPath))
    for root, dirs, files in os.walk(jstlPath):
        archive_root = os.path.abspath(root)[root_len:]
        for f in files:
            if f.find(".jstl") > 0:
                fullpath = os.path.join(root, f)
                fromFile=open(fullpath,"r")
                temp=fromFile.read()
                fromFile.close()
                toFile=open(fullpath,"w")
                if not temp.count("/os-commons/1.0/common/scripts/views/widget.jstl")>0:
                    temp = temp.replace("/common/scripts/views/widget.jstl","/os-commons/1.0/common/scripts/views/widget.jstl")
                if not temp.count("<%text>")>0:
                    temp = ["<%text>",temp,"</%text>"]
                    temp = "".join(temp)
                toFile.write(temp)
                toFile.close()