When you press on Wildyfly and Edit Configurations, do you have the right URL and are the right deployments there?
How do I implement JSP in C#
So I am trying to convert my Java JSP programm to an C# programm. I want to create a client.
I have my Index.jsp:
<%@ page import="model.Employee" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<title>Employee</title>
</head>
<body>
<h1><%= "Employee!" %>
</h1>
<br/>
<form action=hello-servlet method="post">
<p>Name
<input type="text" name="name">
</p>
<input type="submit" >
</form>
</body>
</html>
and an Employee.jsp file:
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<jsp:useBean id="selectedEmployee" type="model.Employee" scope="request"></jsp:useBean>
<!DOCTYPE html>
<html>
<head>
<title>Employee</title>
</head>
<body>
${selectedEmployee.firstName}
<p>${selectedEmployee.lastName}</p>
</body>
</html>
Can someone help me create a client for my h2 database?
2 answers
Sort by: Most helpful
-
-
Bruce (SqlWork.com) 56,926 Reputation points
2022-05-09T02:55:54.04+00:00 While classic asp.net uses the same template syntax (<% … %>), I’d still suggest use .net 6 razor pages. This is like a more modern approach, but architecturally similar modern jsp.
Beside converting the Java code to C# you will need to find replacements for your javabeans. There is no direct equivalent, you will probably create custom classes and pick nuget packages and use dynamic injection instead. Asp.net core and razor pages DI support has similar scoping to javabeans.
You should try some razor page tutorials. Pay attention to dynamic injection, and model binding.
You will also want to pick a replacement for h2. SQLite is a good choice, it’s more robust, faster and better supported. If you have existing data, you will find tools to do the convert.