use scriplet (i.e <%%>) for writing java code in jsp page
<html
<body>
<form method="post">
<input type =text name="urltext">
<input type="Submit" name="btn" value="submit">
<%
String txtbox=request.getParameter("urltext");
String btn1=request.getParameter("btn");
if(btn1!=null)
{
out.println(txtbox);
}
%>
</body>
</html>