How to access Java arrays in HTML code - java

I am creating a Tic-Tac-Toe program using HTML and Java. After user input, the server goes to the servlet, which puts the value back into the array and then redirects the server back to the HTML page.
HTML code (with Tic-Tac-Toe table that needs values to go in the entries):
<form action="servlet1" method="get">
<br><br> <table>
<tr>
<td><input type="radio" name="input" value="0"> </td>
<td><input type="radio" name="input" value="1"> </td>
<td><input type="radio" name="input" value="2"> </td>
</tr>
<tr>
<td><input type="radio" name="input" value="3"> </td>
<td><input type="radio" name="input" value="4"> </td>
<td><input type="radio" name="input" value="5"> </td>
</tr>
<tr>
<td><input type="radio" name="input" value="6"> </td>
<td><input type="radio" name="input" value="7"> </td>
<td><input type="radio" name="input" value="8"> </td>
</tr>
</table>
<br><input type="submit" value="Turn Completed" />
</form>
Java Servlet code:
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
#WebServlet("/servlet1")
public class Servlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String[] board = new String[9];
for (int i = 0; i < 9; i ++) {
board[i] = "<input type=\"radio\" name=\"input\" value=\"" + i + "\">";
}
int loc = Integer.parseInt(req.getParameter("input"));
board[loc] = "X";
resp.setStatus(resp.SC_MOVED_TEMPORARILY);
resp.setHeader("Location", "index.html");
}
}
How do I get the value of board in my Java code to transfer to the HTML page each time and render Xs based on user input? Is there any way to access board in the HTML program and use board[0], board[1] etc to fill the table values in the HTML code?

You have to form a response, here is a simple example:
public void doGet(HttpServletRequest req, HttpServletResponse response)
throws ServletException, IOException {
// set content type
response.setContentType("text/html");
// get response writer
PrintWriter writer = response.getWriter();
// build HTML code
String htmlResponse = "<html>";
htmlResponse += "<h2>This is my Response example:</h2>";
htmlResponse += "Some Text as an example.";
htmlResponse += "</html>";
// return response
writer.println(htmlResponse);
}

Related

Redirecting to other servlet based on HTML page action

Here i've have 2 servlets
#WebServlet("/Login")
public class Login extends HttpServlet {
.........
.........
}
#WebServlet("/Create")
public class Create extends HttpServlet {
.........
.........
}
And a HTML page like this.
<form name="loginForm" method="post" action="Login">
<table width="20%" bgcolor="0099CC" align="center">
<tr>
<td colspan=2>
<center>
<font size=4><b>HTML Login Page</b></font>
</center>
</td>
</tr>
<tr>
<td>Username:</td>
<td><input type="text" size=25 name="username"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="Password" size=25 name="password"></td>
</tr>
<tr>
<td><input type="submit" onclick="return check(this.form)" value="Login"></td>
</tr>
<tr>
<td><input type="submit" onclick="return check(this.form)" value="Create profile"></td>
</tr>
</table>
</form>
I want to redirect to Create servlet when the user clicks on create profile. Can anyone help me with this?
You need to select the action based on the button which is clicked. You can do it using JavaScript. Given below is the minimal, working example which you can extend as per your requirement:
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function check(form, button){
if(button.id=='login'){
form.action="Login";
}else if(button.id=='create'){
form.action="Create";
}
form.submit();
}
</script>
<title>Insert title here</title>
</head>
<body>
<form name="loginForm" method="post">
<table width="20%" bgcolor="0099CC" align="center">
<tr>
<td colspan=2>
<center>
<font size=4><b>HTML Login Page</b></font>
</center>
</td>
</tr>
<tr>
<td>Username:</td>
<td><input type="text" size=25 name="username"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="Password" size=25 name="password"></td>
</tr>
<tr>
<td><input type="button" id="login" onclick="check(this.form,this)"
value="Login"></td>
</tr>
<tr>
<td><input type="button" id="create" onclick="check(this.form,this)"
value="Create profile"></td>
</tr>
</table>
</form>
</body>
</html>
Login.java
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
#WebServlet("/Login")
public class Login extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Login");
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request,response);
}
}
Create.java
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
#WebServlet("/Create")
public class Create extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Create");
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request,response);
}
}
You have one form and you want it to go to two different servlet. You can't do that. If you want to goto login servlet first and then goto create servlet. You can do that view requestDispatcher or httpServletresponse.sendRedirect()
RequestDispatcher rd=request.getRequestDispatcher("servlet Name")
rd.forward(request, response);
or by
response.sendRedirect("/url");
Or if you dont want to go the login servlet at all and directly want to go to create then use two forms one for your Login and another one for your Create Profile.
<form name="loginForm" method="post" action="Create">
<tr>
<td><input type="submit" onclick="return check(this.form)" value="Create profile"></td>
</tr>

Hidden form in JSP/Servlet

I want to get parameters from my jsp to my servelet.
so i used input form and it works for the name and the last name but it doesn't work for my ID.
Here is the code of my JSP:
<tr>
<td><form method="post" action="ServBddInsa">
<input type="hidden" name="id" id="id" value="testId"/>
<c:out value="${ utilisateur.id }" />
</form>
</td>
<td><c:out value="${ utilisateur.prenom }" /></td>
<td><c:out value="${ utilisateur.nom }" /></td>
<td><form method="post" action="ServBddInsa">
<p>
<label for="prenom"> Prenom :</label> <input type="text"
id="prenom" name="prenom" />
<label for="nom"> Nom :</label> <input type="text" id="nom"
name="nom" />
</p>
<input type="submit" name="editer" value="editer" />
</form></td>
</tr>
</c:forEach>
and this of my servlet:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
BddInsa listU = new BddInsa();
request.setAttribute("utilisateur", listU.recupererList());
this.getServletContext().getRequestDispatcher("/WEB-INF/bddinsa.jsp").forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Utilisateur utilisateurs = new Utilisateur();
utilisateurs.setNom(request.getParameter("nom"));
utilisateurs.setPrenom(request.getParameter("prenom"));
utilisateurs.setId(request.getParameter("id"));
System.out.println(utilisateurs.getPrenom());
System.out.println(utilisateurs.getNom());
System.out.println(utilisateurs.getId());
BddInsa listU = new BddInsa();
listU.Editer(utilisateurs);
request.setAttribute("utilisateurs", listU.recupererList());
this.getServletContext().getRequestDispatcher("/WEB-INF/bddinsa.jsp").forward(request, response);
}
}
I get NULL when I try to see the value of id
Thank you for your help !
Please can you try to use only one open and one close form tag? I think you problem is because you have two <form method="post" action="ServBddInsa"> . So the submit button is on the second form. In this case the hidden field of the first form is not considered and it is not sent.

How to get jsp textbox values in to the servlet [duplicate]

This question already has answers here:
request getParameter is always null when using enctype="multipart/form-data"
(2 answers)
Closed 2 years ago.
I have Registration_Page.jsp in that page i had one form ..I want to submit the form to database with the use of the servlet..My servlet name is Save_User_Details.java i want to get the jsp page form data into the servlet..It is getting null value ..How i can get those values in to the servlet anyone help me i am the newer to java..
Registration_Page.jsp
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title> Registration Page</title>
<script language="JavaScript" src="gen_validatorv4.js"
type="text/javascript" xml:space="preserve"></script>
</head>
<body>
<h2 style="color: #ff6666" align="center">NEW USER REGISTRATION HERE</h2>
<form ENCTYPE="multipart/form-data" action="Save_User_Details"
method="POST" align="center" name="myform">
<table border="02" align="center" style="color: #ff3399">
<tr>
<th style="color:#ff6666">FIRST NAME:</th>
<td><input type="text" name="FName" id="FName" placeholder="First name" /></td>
</tr>
<tr>
<th style="color:#ff6666">LAST NAME:</th>
<td><input type="text" name="LName" id="LName" placeholder="Last name" /></td>
</tr>
<tr>
<th style="color:#ff6666">PASSWORD:</th>
<td><input type="password" name="password" id="password" placeholder="password"></td>
</tr>
<!-- <tr>
<th>CONFORM PASSWORD:</th>
<td><input type="password" name="conform_password" placeholder="conform password"></td>
</tr> -->
<tr>
<th style="color:#ff6666">EMAIL ID:</th>
<td><input type="email" name="mailid" id="mailid" placeholder="Mailid"></td>
</tr>
<tr>
<th style="color:#ff6666">MOBILE NUMBER</th>
<td><input type="number" name="mobile" id="mobile" placeholder="Mobile number"></td>
</tr>
<tr>
<th style="color:#ff6666">GENDER:</th>
<td style="color:#ff6666"><input type="radio" value="male" name="gender" id="gender"
checked="true">MALE <input type="radio" value="female"
name="gender">FEMALE <input type="radio" value="other"
name="gender">OTHER<br> <br></td>
</tr>
<tr>
<th style="color:#ff6666"><label>DATE OF BIRTH:</label></th>
<td><input type="date" name="dob" id="dob"><br> <br></td>
</tr>
<tr>
<th style="color:#ff6666">COUNTRY:</th>
<td><select name="Country" id="country" style="width: 150px">
<option value="000" selected="selected">[choose yours]</option>
<!-- <select name="country" style="width:150px"> -->
<option>India</option>
<option>USA</option>
<option>UK</option>
<option>Other</option>
</select>
<tr>
<th></th>
<td><input type="submit" style="color: #ff3399" value="SUMIT" />
<button style="color: #ff3399" type="reset">CLEAR</button>
</td>
</tr>
</tr>
<tr>
<td></td>
<td>LOGIN PAGE</td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript"
xml:space="preserve">
//<![CDATA[
//You should create the validator only after the definition of the HTML form
var frmvalidator = new Validator("myform");
frmvalidator.addValidation("FName", "req",
"Please enter your First Name");
frmvalidator.addValidation("FName", "maxlen=20",
"Max length for FirstName is 20");
frmvalidator.addValidation("FName", "minlen=4",
"Min length for FirstName is 4");
frmvalidator.addValidation("FName", "alpha", "Alphabetic chars only");
frmvalidator.addValidation("LName", "req",
"Please enter your Last Name");
frmvalidator.addValidation("LName", "maxlen=20", "Max length is 20");
frmvalidator.addValidation("LName", "minlen=4",
"Min length for LastName is 4");
frmvalidator.addValidation("password", "maxlen=10");
frmvalidator.addValidation("password", "req");
frmvalidator.addValidation("password", "");
frmvalidator.addValidation("password", "minlen=6",
"Min length for Password is 6");
frmvalidator.addValidation("mailid", "maxlen=50");
frmvalidator.addValidation("mailid", "req");
frmvalidator.addValidation("mailid", "email");
frmvalidator.addValidation("mailid", "minlen=6",
"Min length for Mailid is 6");
frmvalidator.addValidation("gender", "dontselect=000");
frmvalidator.addValidation("gender", "req");
frmvalidator.addValidation("mobile", "maxlen=10");
frmvalidator.addValidation("mobile", "numeric");
frmvalidator.addValidation("mobile", "req");
frmvalidator.addValidation("mobile", "minlen=10",
"Mobile number should be 10 numbers");
frmvalidator.addValidation("dob", "maxlen=40");
frmvalidator.addValidation("dob", "req");
frmvalidator.addValidation("Country", "dontselect=000");
frmvalidator.addValidation("Country", "req");
//]]>
</script>
</body>
</html>
Save_User_Details.java
package com.ih.Control;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ih.Dao.UserDao;
import com.ih.Model.User_Details;
/**
* Servlet implementation class Save_User_Details
*/
#WebServlet("/Save_User_Details")
public class Save_User_Details extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* #see HttpServlet#HttpServlet()
*/
public Save_User_Details() {
super();
// TODO Auto-generated constructor stub
}
/**
* #see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* #see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
User_Details ud=new User_Details();
System.out.println("i am in Save_User_Details..........");
PrintWriter out=response.getWriter();
int status=0;
String fname=request.getParameter("FName");
System.out.println("The FNAME::"+fname);
String lname=request.getParameter("LName");
System.out.println("The LNAME::"+lname);
String password=request.getParameter("password");
System.out.println("The PASSWORD::"+password);
String mailid=request.getParameter("mailid");
String mobile=request.getParameter("mobile");
String gender=request.getParameter("gender");
String dob=request.getParameter("dob");
String country=request.getParameter("country");
System.out.println("FNAME::"+fname+"LNAME::"+lname+"PASSWORD::"+password+"MAILID::"+mailid+"MOBILE::"+mobile+"GENDER::"+gender+"DOB::"+dob+"COUNTRY::"+country);
ud.setFName(fname);
ud.setLName(lname);
ud.setPassword(password);
ud.setMailid(mailid);
ud.setMobile(mobile);
ud.setGender(gender);
ud.setDob(dob);
ud.setCountry(country);
try {
UserDao.SaveRegistration_Details();
RequestDispatcher rd=request.getRequestDispatcher("Login.jsp");
rd.forward(request, response);
} catch (SQLException e) {
out.println("<h1 style='color:red'>FAILED TO INSERT USER DATA TRY AGAIN!!</h1>");
out.println("<a href='Registration_Page.jsp'>REGISTER AGAIN</a>");
e.printStackTrace();
}
}
}
enctype="multipart/form-data" is for 'file upload', not for normal textbox.
When you use enctype="multipart/form-data" form fields aren't available as parameter of the request, so you will get request.getParameter() as null.
You can find more info in HTML5 specification.

mixing up ajax and jsp to get data into a servlet

I've got a jsp file with two text fields (signUp and post). Now, I want the post text and the signUp text to be called to a servlet. Normally its going with request.getParameter(), but now I want the post text going to the servlet with an AJAX function and the signup text with the normal way (that means the name of the input within the jsp file and then request.getParameter).
Is it possible to mix both parts within one servlet because i have this:
<form name="form1" method="POST" action="PostWallServlet" id="form1">
form1 is the ajax code. I don't know how this should work. Normally there stands
`<form action="PostWallServlet" method="POST" >
and everything is callable through the Servlet. But, for now I don't know how I can mix up both components.
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PostWall pw=new PostWall();
SimpleDateFormat df = new SimpleDateFormat("YYYY/MM/DD hh:mm:ss");
Calendar cal = Calendar.getInstance();
System.out.println("Current Date Time : " + df.format(cal.getTime()));
String message = "";
String sender = request.getParameter("sender");
String post = request.getParameter("message");
String a= df.format(cal.getTime()).toString();
pw.setSender(sender);
pw.setPost(post);
pw.setDate(a);
if (pwi.addPost(pw)) {
message = "Student Successfuly Added";
} else {
message = "Student Adding Failed";
}
//RequestDispatcher rd = request.getRequestDispatcher("post.jsp");
//rd.forward(request, response);
}
$(document).ready(function(){
$('#Add').click(function(){
sendData();
});
});
function sendData(){
var mge = $('#newText').val();
alert(mge);
$.ajax({
type: "POST",
url: "PostWallServlet",
data: { message : mge }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
}
</script>
<form name="form1" method="GET" action="PostWallServlet" id="form1"></form>
<table border="0" width="100%">
<tr>
<td colspan="3"> ${message}</td>
</tr>
<tr>
<td>Sender</td>
<td>:</td>
<td><input type="text" name="sender" value="" size=20/></td>
</tr>
<tr>
<td>Post</td>
<td>:</td>
<td><input type="text" name="post" value="" size=500 id="newText"/ ></td>
</tr>
<tr>
<td></td>
<td></td>
<td><input type="submit" value="Add" name="Add" /></td>
</tr>
</table>
Any solutions?
Put your ending tag for form AFTER all your inputs:
<form name="form1" method="GET" action="PostWallServlet" id="form1">
...
<td><input type="text" name="sender" value="" size=20 /></td>
...
<td><input type="text" name="post" value="" size=500 id="newText" /></td>
...
<td><input type="submit" value="Add" name="Add" /></td>
...
</form>
Your inputs must be INSIDE the form, not after the form.
Also make sure to end your input tags with /> not / >. You have a space between / and > on one of them.
For the Ajax part you need to give your inputs ids as well as names:
<td><input type="text" name="sender" id="sender" value="" size=20 /></td>
And then in your Ajax function for data:
data: { sender: $('#sender').val(), post: $('#post').val() }

retrieve the data to the same html page i am using

using servlet code i inserted the data to database.
and i want to retrieve that data to the same html page.....i want the servlet code
in the same class for inserting and editing. i am using eclipse.....so plz help me frnds.....i am new to java and
my knowledge is close to nothing
html page
<!DOCTYPE html>
<html>
<head>
<title>PATIENT</title>
<style type="text/css">
input, textarea,select {
background-color : lightgray;
}
table
{
border: 2px solid gray;
}
</style>
</head>
<body bgcolor="#DDDDDD">
<script>
function myFunction()
{
var reg_no=prompt("Please enter your Register No", "")
}
</script>
<p align ="center"><b>PATIENT</b></p><br>
<form method="post" name ="patientForm" action="patientDemo">
<table align="center" cellpadding="2" cellspacing="2">
<tr>
<td>
<font color="maroon">Register Number</font>
</td>
<td colspan="1">
<input type="text" maxlength="15" name="regs_numb" required>
</td>
<td>
<font color="maroon">PatientId</font>
</td>
<td colspan="2">
<input type="text" maxlength="10" size="18" name="pat_Id" required>
</td>
<td>
<font color="maroon">Patient Type</font>
</td>
<td colspan="2">
<input type="text" size="3" maxlength="3" name="pat_Type">
</td>
<tr>
<td>
<font color="maroon">Patient Name</font>
</td>
<td colspan="4">
<input type="text" maxlength="50" size="53" name="pat_Name">
</td>
<td>
<font color="maroon">Age</font>
</td>
<td>
<input type="text" maxlength="3" size="3" name="age">
<select name="age_units">
<option value="years">Years</option>
<option value="months">Months</option>
<option value="days">Days</option>
</select>
</td>
</tr>
<tr>
<td>
<font color="maroon">Sex</font>
</td>
<td>
<select name="sex">
<option value="male">Male</option>
<option value="female">Female</option>
</select>
</td>
<td>
<font color="maroon">Package</font>
</td>
<td>
<input type="text" maxlength="10" SIZE="18" name="package">
</td>
</table>
<br>
<table align="center" cellpadding="2">
<tr>
<td>
<input type="submit" value="save" id="save"/>
<td>
<input type="button" onclick="myFunction()" value="edit" id="edit"/>
</td>
<td>
<input type="button" value="delete" id="delete">
</td>
<td>
<input type="reset" value="cancel" id="cancel"/>
</td>
<td>
<input type="button" value="exit" id="exit"/>
</td>
</tr>
</table>
</form>
</body>
</html>
PatientDemo.java
package patientDemo;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class PatientDemo extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out= response.getWriter();
String a=request.getParameter("regs_numb");
String b=request.getParameter("pat_Id");
String c=request.getParameter("pat_Type");
String d=request.getParameter("pat_Name");
String e=request.getParameter("age");
String f=request.getParameter("age_units");
String g=request.getParameter("sex");
String h=request.getParameter("package");
try
{
Class.forName("com.mysql.jdbc.Driver");
System.out.println("driver loaded");
System.out.println("Driver is loaded");
Connection con= (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/charms","root","root");
System.out.println("Connection created");
PreparedStatement ps= ((java.sql.Connection) con).prepareStatement("insert into patient(p_reg_no_v,p_patient_id_v,p_patient_type_v,p_patientname_v,p_age_s,p_ageunit_v,p_sex_v,p_package_v) values (?,?,?,?,?,?,?,?)");
ps.setString(1,a);
ps.setString(2,b);
ps.setString(3,c);
ps.setString(4,d);
ps.setString(5,e);
ps.setString(6,f);
ps.setString(7,g);
ps.setString(8,h);
ps.execute();
out.close();
System.out.println("Inserted");
}
catch(Exception e1)
{
System.out.println(e1);
}
}
}
Name all your buttons something like "action". At the top of doPost() check which button was pressed by calling request.getParameter("action") like you did for the other fields.
Branch your logic depending on the value. For "save" you do what you are already doing. For "delete" you would do delete SQL instead. If it's not set, do nothing.
After all that, have the code fall though to query the database and render the page.
(edited to add example)
In the HTML, give your buttons a name like this
<input type="submit" value="save" id="save" name="action"/>
Also make place holders for your data like this
<input type="text" maxlength="15" name="regs_numb" required value="${regs_numb}">
In java do what i described above
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String action = request.getParameter("action");
if (action.equals("save")) {
saveData(request);
} else if (action.equals("delete")) {
deleteData(request);
}
renderPage(request, response);
}
private void renderPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// load your html file from disk
String html = loadHtml(filename);
// load the last data you were just editing
String a=request.getParameter("regs_numb") // or whatever you primary key field id
Map<String,String> model = loadSqlData(a);
// inject the data into your html
for(Entry<String,String> entry : model.entrySet()) {
html = html.replace("${" + entry.getKey() +"}", entry.getValue());
}
// send the page to the browser
response.getWriter().println(html);
response.flush();
}
You'll need to implement those methods for saveData, deleteData, loadHtml, and loadSqlData.
For loadSqlData have it return a HashMap where the key is all the fields you put placeholder for like ${regs_numb), and the value is from the database.
If this seems like a lot of work, it is. That's why everyone is recommending using a framework that does 90% of this for you.

Categories