它是我将数据发送到 javabean 的 jsp 页面:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%@taglib uri="/struts-dojo-tags" prefix="sx" %>
<%@page session="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<sx:head parseContent="true" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Set the Leaves </title>
<script language="JavaScript" src="../Advance_Academic_ERP/css/Ck_Effect.js"></script>
<link rel="stylesheet" type="text/css" media="all"
href="../Advance_Academic_ERP/css/jsDatePick_ltr.min.css" />
<script type="text/javascript"
src="../Advance_Academic_ERP/css/jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
window.onload = function(){
new JsDatePick({
useMode:2,
target:("fromDate"),
dateFormat:"%d-%m-%Y"
});
new JsDatePick({
useMode:2,
target:("toDate"),
dateFormat:"%d-%m-%Y"
});
};
</script>
<script type="text/javascript">
function display(val) {
var o = document.getElementById('name1');
var b = document.getElementById('leaveNo1');
(parseInt(val) == '5' || parseInt(val)=='6')? o.style.display = 'block' : o.style.display = 'none';
(parseInt(val) == '5' || parseInt(val)=='6')? b.style.display = 'block' : b.style.display = 'none';
}
</script>
</head>
<body>
<s:form action="LeaveSetterAction" name="leave" validate="true">
<s:select label="Type Of Holiday/Leave*"
headerKey="-1" headerValue="Select Type"
list="#{'1':'National Holidays', '2':'Weekly Holidays', '3':'Local Holidays', '4':'Situational Holidays', '5':'Seek Leaves', '6':'Personal Leaves'}"
name="leaveType" id="leaveType" onchange="display(this.value);"/>
<table id="name1" style="display: none;">
<tr>
<td>Name</td>
<td><input type="text" name="name" id="name"></td>
</tr>
</table>
<table id="leaveNo1" style="display: none;">
<tr>
<td>No Of Alloted Leaves</td>
<td><input type="text" name="leaveNo" id="leaveNo"></td>
</tr>
</table>
<s:textfield name="fromDate" label="From date*" key="fromDate" id="fromDate"></s:textfield>
<s:textfield name="toDate" label="To date*" key="toDate" id="toDate"></s:textfield>
<s:textfield name="difference" label="Duration" key="difference" id="difference" readonly="readonly"></s:textfield>
<s:textarea name="desc" label="Description*" key="desc" onmouseover="setDifference(this);"></s:textarea>
<s:submit align="center"></s:submit> <s:reset align="center"></s:reset>
</s:form>
</body>
</html>
我应该在其中获取数据的我的 javabean 页面:
package abc.Model;
public class SetLeave {
String leaveType;
String name;
String leaveNo;
String fromDate;
String toDate;
String difference;
String desc;
public String getLeaveType() {
return leaveType;
}
public void setLeaveType(String leaveType) {
this.leaveType = leaveType;
}
public String getName() {
System.out.println(name);
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLeaveNo() {
System.out.println(leaveNo);
return leaveNo;
}
public void setLeaveNo(String leaveNo) {
this.leaveNo = leaveNo;
}
public String getFromDate() {
return fromDate;
}
public void setFromDate(String fromDate) {
this.fromDate = fromDate;
}
public String getToDate() {
return toDate;
}
public void setToDate(String toDate) {
this.toDate = toDate;
}
public String getDifference() {
return difference;
}
public void setDifference(String difference) {
this.difference = difference;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
我在一些获取空值的文本字段上使用 javascript 请帮帮我。提前致谢。