public String tag(String text, String token, String type) throws Exception {

        String[] textSplit = text.split(token);

        String textFomat = "";
        String close = "";
        boolean tag = false;

        try {
            for (int x = 0; x < textSplit.length; x++) {
                if (tag) {
                    tag = false;
                    close = "/";
                } else {
                    close = "";
                    tag = true;
                }

                textFomat += textSplit[x] + "<" + close + type + ">";

            }
            if (tag == true) {
                textFomat = textFomat.substring(0, textFomat.length() - 4);
            }
        } catch (Exception e) {
            throw new ServletException("Method " + type + " Error: " + e.getMessage());
        }
        tag = false;
        return textFomat;
    }