I have n number of text fields named in the form "Question.....". How can I get all the parameters which starts with "question" from the JSP page to the Action?
getParameter() – Passing data from client to JSP The familiarity of the getParameter() method in getting data, especially form data, from a client HTML page to a JSP page is dealt with here. The request. getParameter() is being used here to retrieve form data from client side.
For displaying the parameters on the file. jsp page, we have used the expression language (${}). However you can also use the following code which is using the JSP expression tag and request implicit object.
getParameter is a function name in JSP which is used to retrieve data from an HTML/JSP page and passed into the JSP page. The function is designated as getParameter() function. This is a client-side data retrieval process. The full function can be written as request. getParameter().
<%@ page import = "java.util.Map" %> Map<String, String[]> parameters = request.getParameterMap(); for(String parameter : parameters.keySet()) { if(parameter.toLowerCase().startsWith("question")) { String[] values = parameters.get(parameter); //your code here } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With