java In a JSP, we want to compare two integers stored in the URL parameters usin
ID: 3720543 • Letter: J
Question
java
In a JSP, we want to compare two integers stored in the URL parameters using JSTL. Assume that these two integers are stored under the parameter names num1 and num2. If these two numbers are equal, print out the string “same”; otherwise, print out the string “different”.
Ans:
In a JSP, we want to compare two integers stored in the request scope using JSTL. Assume that these two integers are stored under the attributes num1 and num2. If these two numbers are equal, print out the string “same”; otherwise, print out the string “different”.
Ans:
Explanation / Answer
Using jstl tag...<% %> we can write the java code in between them.....so comparing num1 and num2 came from URL and printing them using java out.println() by help of jstl tags.....below is the code snippet...
///////Snippet/////////
<%if(%>num1==num2<%){ out.println("Same");}else{out.println("different");}%>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.