vendredi 17 mai 2019

Replace scriptlet to avoid java code inside .jsp file

I have the same Java scriptlet copied and pasted into multiple .jsp files. I would like to replace it with a solution that's easier to maintain and has better readability

    <%
    if (!MediaUtil.validateAuthorization()) {
        out.println("Unauthorized");
    } else {
        String srcquery = request.getQueryString();
        if (srcquery == null) {
            srcquery = "";
        }
        User currentUser = UserService.findCurrentUser();

        if (currentUser == null) {
            out.println(User.MESSAGE_NO_USER);
        } else {
    %>

    <html>
    <head>





Aucun commentaire:

Enregistrer un commentaire