I’m making a jsp(f) that requires a parameter to be set to make any sense.
Therefore I want it to error if it is not provided so that developers don’t make a mistake. How can I do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would transform the JSP fragment into a JSP tag file, with a required parameter:
/WEB-INF/tags/hello.tag:That way, your JSP editor will warn you about the missing required parameter, and a JSP using the tag without the required parameter wouldn’t compile.
Such a tag would be used like this:
See http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPTags5.html for more information.