ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 34 - 312-96 discussion

Report
Export

Suppose there is a productList.jsp page, which displays the list of products from the database for the requested product category. The product category comes as a request parameter value. Which of the following line of code will you use to strictly validate request parameter value before processing it for execution?

A.
public boolean validateUserName() {String CategoryId= request.getParameter('CatId');}
Answers
A.
public boolean validateUserName() {String CategoryId= request.getParameter('CatId');}
B.
public boolean validateUserName() { Pattern p = Pattern.compile('[a-zA-Z0-9]*$'); Matcher m = p.matcher(request.getParameter(CatId')); boolean result = m.matches(); return result;}
Answers
B.
public boolean validateUserName() { Pattern p = Pattern.compile('[a-zA-Z0-9]*$'); Matcher m = p.matcher(request.getParameter(CatId')); boolean result = m.matches(); return result;}
C.
public boolean validateUserName() { if(request.getParameter('CatId')!=null ) String CategoryId=request.getParameter('CatId');}
Answers
C.
public boolean validateUserName() { if(request.getParameter('CatId')!=null ) String CategoryId=request.getParameter('CatId');}
D.
public.boolean validateUserName() { if(!request.getParamcter('CatId').equals('null'))}Answer: B
Answers
D.
public.boolean validateUserName() { if(!request.getParamcter('CatId').equals('null'))}Answer: B
Suggested answer: B
asked 18/09/2024
Hammad Chandio
31 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first