@SuppressWarnings({"unchecked"})
    public int onDoStartTag() throws JspException {
        String strValue = null;

        if (getSubject() != null) {

            // Get the principal to print out
            Object principal;

            if (type == null) {
                principal = getSubject().getPrincipal();
            } else {
                principal = getPrincipalFromClassName();
            }

            // Get the string value of the principal
            if (principal != null) {
                if (property == null) {
                    strValue = principal.toString();
                } else {
                    strValue = getPrincipalProperty(principal, property);
                }
            }

        }

        // Print out the principal value if not null
        if (strValue != null) {
            try {
                pageContext.getOut().write(strValue);
            } catch (IOException e) {
                throw new JspTagException("Error writing [" + strValue + "] to JSP.", e);
            }
        }

        return SKIP_BODY;
    }
The default value that should be displayed if the user is not authenticated, or no principal is found.
web/src/main/java/org/apache/shiro/web/tags/PrincipalTag.java