I have a Jsp file that include these lines:
<s:select list="list" name="message" id="selectMsg"></s:select>
<div id="txtMessage" style="display:none">
<h3>
<span id="txtMessage" style="margin-left: 230px">
Message: <s:textarea name="message" placeholder="Message"/>
</span>
</h3>
</div>
Action:
public String warn() throws Exception {
WarnDAO dao = new WarnDAO();
AccountDAO accdao = new AccountDAO();
acc = accdao.getAccountByUsername(username);
List<WarningMessage> warningMessage = dao.showMsg();
list = new ArrayList<String>();
for (WarningMessage warningMessage1 : warningMessage) {
list.add(warningMessage1.getMessage());
}
list.add("Other");
warning_msg_DAO wmDAO = new warning_msg_DAO();
wm = wmDAO.getByMessage(message);
DateFormat dateFormat = new SimpleDateFormat("hh:mm a dd/MM/yyyy");
Date date = new Date();
System.out.println(dateFormat.format(date));
WarningAccount warningAcc = new WarningAccount();
warningAcc.setWarnedaccount(acc);
warningAcc.setMessage(message);
warningAcc.setDay(date);
dao.warn(warningAcc);
return "success";
}
In the s:select include an option "Other". When the user choose "Other" the text area will display and allow user to input their own message. Is there any solution?