Email field validation JSP for Access Request forms

Document created by Chitra Anilkumar Employee on Feb 16, 2017
Version 1Show Document
  • View in full screen mode

Following is the contents of the field validation jsp for validating if a text field for email address has it in the right format:

<%@ page import="java.io.*"%>

<%@ page import="java.util.*"%>

<%@ page import="java.util.regex.*"%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%

                try {

                                String name = request.getParameter("name");

                                String question = request.getParameter("question");

                                String value = request.getParameter("value");

                     Pattern pattern = Pattern.compile("^.+@.+\\..+$");

                                Matcher matcher = pattern.matcher(value);

                                if (!matcher.matches())

                                                out.println("Invalid User Id for " + question + ", expected ####@####.###");

                                }

                catch (IOException e) {

                       e.printStackTrace();

                }

%>

For details on field and form validation jsps, refer here:

https://community.rsa.com/docs/DOC-32532

Attachments

    Outcomes