このコードは SearchTIN.java クラスにあります。jspでtin、name & addressの値を表示したい
public class SearchTIN extends ActionSupport implements ServletRequestAware{
private String tin;
private String name;
private String address;
public String getTpTin() {
return tin;
}
public String getTpName() {
return name;
}
public String getTpAddress() {
return address;
}
public void setTpTin(String tin) {
this.tin = tin;
}
public void setTpName(String name) {
this.name = name;
}
public void setTpAddress(String address) {
this.address = address;
}
public String execute() throws Exception {
Debugger.border();
Debugger.startDebug(this.getClass().toString());
String tax = request.getParameter("tin");
TblTaxPaymentDAO tdao = DAOFactory.getDaoManager(TblTaxPayment.class);
TblTaxPayment t = null;
t = tdao.findbyTIN(tax.replace("-", ""));
TblTaxPayment tbltaxpayment = (TblTaxPayment) t;
try{
Debugger.print("TIN : "+tax);
if(tax != null) {
tin = tbltaxpayment.getTpTin();
name = tbltaxpayment.getTpName();
address = tbltaxpayment.getTpAddress();
}
return SUCCESS;
JSP: tinの値は入力に、名前は textarea name に、アドレスは textarea address に含まれます。
<form action="searchTIN" name="TIN" method="post" enctype="multipart/form-data">
<div class="TIN">
<div>
<label style="font-size: 17px;">TIN - Branch Code</label><br><br>
<input id="mask" name="tin" type="text" value="" style="margin-top: -9px; width: 170px; float: left;"/>
<div class="buttont" style="float: left; width: 100px; height: 30px; line-height: 30px; margin-left: 4px; margin-top: -12px;">
<a href="javascript:document.TIN.submit();" onclick="rmAlert()">Search</a>;
</div>
<br><br>
<label style="font-size: 17px;">Registered Name</label><br><br>
<textarea disabled id="name" name="name" style="margin-top: -9px; width: 275px; height: 40px;"/><% %></textarea>
<br><br>
<label style="font-size: 17px;">Address</label><br><br>
<textarea disabled id="address" name="address" style="margin-top: -9px; width: 275px; height: 40px;"/></textarea>
<br><br>
</div>