Sunday, 11 August 2013

Change the attribute of textarea in jsp using java class

Change the attribute of textarea in jsp using java class

I want to change the attribute of these textareas using java class.
example: in the if else statement the text areas disabled will be set to
false.
java class:
@SuppressWarnings("unused")
public String execute() throws Exception {
Debugger.border();
Debugger.startDebug(this.getClass().toString());
String tax = request.getParameter("tpTin");
TblTaxPaymentDAO tdao = DAOFactory.getDaoManager(TblTaxPayment.class);
TblTaxPayment t = null;
t = tdao.findbyTIN(tax.replace("-", ""));
tbltaxpayment = (TblTaxPayment) t;
try{
Debugger.print("TIN : "+tax);
if(tax != null) {
tpTin = tbltaxpayment.getTpTin();
tpName = tbltaxpayment.getTpName();
tpAddress = tbltaxpayment.getTpAddress();
String tin = tpTin;
String name = tpName;
String address = tpAddress;
request.setAttribute("tin", tin);
request.setAttribute("name", name);
request.setAttribute("address", address);
return SUCCESS;
}else{
request.getParameter("tpName"); //Enable this
request.getParameter("tpAddress"); //Enable this
return SUCCESS;
}
jsp:
<label style="font-size: 17px;">Registered Name</label><br><br>
<textarea disabled id="tpName" name="tpName" style="margin-top: -9px;
width: 275px; height: 40px;">${name}</textarea>
<br><br>
<label style="font-size: 17px;">Address</label><br><br>
<textarea disabled id="tpAddress" name="tpAddress" style="margin-top:
-9px; width: 275px; height: 40px;">${address}</textarea>
Change to enable based on the if else statement in java class.

No comments:

Post a Comment