Results 1 to 2 of 2
Thread: Input Validation Error
- 01-29-2012, 09:23 AM #1
Member
- Join Date
- Jan 2012
- Posts
- 2
- Rep Power
- 0
Input Validation Error
Hi there,
I was trying an input validation example taken from the OWASP ESAPI and I am getting the following error:
Error: Cannot make a static reference to the non-static method getValidInput(String, String, String, int, boolean) from the type Validator
Html:
Java Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <form method="post" action="inputvalidation"> Enter zip:<input type="text" name="zip" /> </form> </body> </html>
Servlet
Any suggestions?Java Code:package com.example.web; import java.io.IOException; import java.io.PrintWriter; import org.owasp.esapi.*; import org.owasp.esapi.errors.ValidationException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class InputValidation extends HttpServlet { private static final long serialVersionUID = 1L; public InputValidation() { super(); // TODO Auto-generated constructor stub } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out=response.getWriter(); try { String zipCode=Validator.getValidInput("ChangeAddressPage_ZipCodeField", request.getParameter( "zip" ), "zipCodePattern", 10, false); //Error on this line out.print(zipCode); } catch(ValidationException e) { response.sendError( response.SC_BAD_REQUEST, e.getMessage() ); } } }
- 01-29-2012, 02:02 PM #2
Similar Threads
-
Input validation help
By AdamG in forum New To JavaReplies: 3Last Post: 10-17-2011, 09:29 PM -
Input Validation Help
By Spyderpig in forum New To JavaReplies: 3Last Post: 02-18-2011, 11:58 AM -
JTable input validation
By Manfizy in forum New To JavaReplies: 10Last Post: 06-10-2009, 09:04 AM -
Input Validation
By kickflipper1087 in forum New To JavaReplies: 5Last Post: 11-03-2008, 05:47 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks