我有一个html页面“organization.html”,我希望将Java Object值放入这个html页面。
我的Java对象
order by coalesce(title, content)
我的organization.html页面代码
public class User_Objects {
public String firstName;
public String lastName;
}
我的Java代码如下所示
<!DOCTYPE html>
<html lang="en">
<head>
<title>Organization</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" href="css/jquery-ui.css">
<script src="js/jquery-1.12.4.js"></script>
<script src="js/jquery-ui.js"></script>
<script>
$(function() {
var reqfirstName = '${reqObj.firstName}';
alert("reqfirstName>>>>>>>"+reqfirstName);
var reqlastName = '${reqObj.lastName}';
alert("reqlastName>>>>>>>"+reqlastName);
});
</script>
</head>
<body>
<form name="orgname" action="org_name" method="post">
<div class="container-fluid orgdiv">
<div class=" text-center topbgimage">
<img src="images/bg.jpg" class="" style="max-width: 100%;">
</div>
<div class="container">
<div class="row">
<div class="col-sm-12 heading text-center" style="text-align: center;">
<h1 class="">Hello <label id="lblfullname"></label> </h1>
<p>Enter your organization Name to determine if there is a current terms of service agreement with app.</p>
<label><span class="starred">*</span>Oraganisation:</label>
<input type="text" id="txtOrgName" name="txtOrgName"
class=" form-group" placeholder="enter your organisation"
style="float: none; margin-left: 8px;" />
</div>
</div>
</div>
<div class="col-md-12 text-center footerdiv"
style="text-align: center;">
<input type="submit" name="btnOrgName" id="btnOrgName" class="bg-primary btn"
value="Validate" onclick="return validateOrg();" />
<input type="hidden" name="myJObject" id="myJObject" value='${reqJSONObj}' />
</div>
</div>
</form>
</body>
但是当我的organization.html页面加载时,我收到JSONObject jObj = new JSONObject(fillObj);
request.setAttribute("reqJSONObj", jObj);
request.setAttribute("reqObj", fillObj);
forward = "/organization.html";
RequestDispatcher view = request.getRequestDispatcher(forward);
view.forward(request, response);
警报。
我收到reqfirstName>>>>>>>${reqObj.firstName}
${reqObj.firstName}
firstName
reqObj
的值{。}}。
我在Java Mars1中使用Java。