I have a JSP page with a textarea and a button, a servlet and a new jsp:
My 3 problems are:
- My analysis.jsp is empty. My borwser opens a new tab but without the text "Hello World"
- The variable "sql" in my java class is empty too. It should contain the text from my textarea
- How can I hand over after my variable sql isn't empty (after analyze) new new code to a new jsp
index.jsp
<form action="ServletName" method="post" target="_blank">
<div class="form-group">
<label for="codeEditor" style="margin-top: 15px;">Code:</label>
<textarea name="codeEditor" class="form-control" id="codeEditor" rows="15" style="resize: none;"></textarea>
</div>
<div class="analysisButton">
<button type="submit" id="startAnalysis" class="btn btn-default btn-block" style="margin-top: 10px;">Start analysis</button>
</div>
</form>
ServletName.java
protected void doPost(...) ...{
String sql = request.getParameter("codeEditor");
response.sendRedirect("/analysis.jsp");
}
analysis.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
Many thanks in advance
UPDATE: nevermind the variable sql isn't empty <(^,^<) but the other 2 questions are open :)