What does request.getParameter return?

// index.jsp

<form method="post" action="backend.jsp">
<input type="text" name="one" />
<input type="submit value="Submit" />

In backend.jsp what does request.getParameter(“one”); return?


returns java.lang.String, so it must be a String right?

However I cannot do

String one = request.getParameter("one");
if (!"".equals(one)) {}


This is obvious, because variable one does not return null. Is

only way to go, or are there better solutions or a better approach? I am considering both solutions to be on jsp. Using a servlet (although jsp is a servlet) is a different use case in this scenario.

Leave a Comment