フォーム(struts2)の送信ボタンをクリックしても、アクションは実行されません。このファイルの何が問題になっている可能性がありますか?
struts.xml
:
...<action name="EditMessageAction"
class="action.content.EditMessageAction">
<result name="success">/WEB-INF/pages/messages/message.jsp</result>
</action>
<action name="SaveEditedMessageAction"
class="action.content.SaveEditedMessageAction">
<result name="input">/WEB-INF/pages/messages/message.jsp</result>
<result name="success">/WEB-INF/pages/messages/messagesFirstPosition.jsp</result>
</action>...
message.jsp
:
<s:form id="saveEditedUserForm" action="SaveEditedUserAction" theme="simple">
<h1>Edycja komunikatu</h1>
<div>
Id: <b><s:property value="id"/></b>
</div>
<div>
<s:label for="dateFrom" value="Od:*"/>
<s:textfield id="dateFrom" name="dateFrom" required="true"/>
</div>
<div>
<s:label for="dateTo" value="Do:*"/>
<s:textfield id="dateTo" name="dateTo" required="true"/>
</div>
<div>
<s:label for="linkChecked" value="Link?"/>
<s:checkbox id="linkChecked" name="linkChecked" value="true" cssClass="linkChecked"/>
</div>
<div class="linkDiv">
<s:label for="link" value="Link:*"/>
<s:textfield id="link" name="link"/>
</div>
<div class="redirectActionDiv">
<s:label for="redirectAction" value="redirectAction:*"/>
<s:textfield id="redirectAction" name="redirectAction"/>
</div>
<div>
<s:label for="typeDth" value="DTH:"/>
<s:checkbox id="typeDth" name="typeDth"/>
</div>
<div>
<s:label for="typeMvno" value="MVNO:"/>
<s:checkbox id="typeMvno" name="typeMvno" cssClass="typeMvno"/>
<div class="typeMvnoDiv">
<s:label for="subTypeMvnoPostpaid" value="PostPaid:"/>
<s:checkbox id="subTypeMvnoPostpaid" name="subTypeMvnoPostpaid"/>
<s:label for="subTypeMvnoPrepaid" value="PrePaid:"/>
<s:checkbox id="subTypeMvnoPrepaid" name="subTypeMvnoPrepaid"/>
</div>
</div>
<div>
<s:label for="typeDvbt" value="DVBT:"/>
<s:checkbox id="typeDvbt" name="typeDvbt"/>
</div>
<div>
<s:label for="active" value="Aktywny:"/>
<s:checkbox id="active" name="active"/>
</div>
<div>
<s:submit/>
</div>
</s:form>
およびSaveEditedMessageAction.java
:
package pl.cyfrowypolsat.ebok.bm.action.content;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import pl.cyfrowypolsat.ebok.bm.action.BaseAction;
import pl.cyfrowypolsat.ebok.bm.consts.SessionParameters;
import pl.cyfrowypolsat.ebok.bm.ejb.IMessages;
import pl.cyfrowypolsat.ebok.bm.ejb.bean.MessageBean;
import pl.cyfrowypolsat.ebok.bm.utils.EJBLocator;
public class SaveEditedMessageAction extends BaseAction{
private static final long serialVersionUID = 1L;
private static final Log LOG = LogFactory.getLog(SaveEditedMessageAction.class);
private int id;
private Date dateFrom;
private Date dateTo;
private String link;
private String header;
private String redirectAction;
private boolean typeDth;
private boolean typeMvno;
private boolean typeDvbt;
private boolean subTypeMvnoPostpaid;
private boolean subTypeMvnoPrepaid;
private boolean active;
private boolean linkChecked;
public String execute() {
LOG.info("Enter: execute(). " + dateFrom + " " + link);
MessageBean sessionMessageBean = (MessageBean) sessionParameters.get(SessionParameters.MESSAGE_EDIT);
if(sessionMessageBean != null) {
IMessages messagesEJB = EJBLocator.getMessages();
sessionMessageBean.setDateFrom(getDateFrom());
sessionMessageBean.setDateTo(getDateTo());
sessionMessageBean.setLinkHref(getLink());
if(linkChecked){
sessionMessageBean.setHtml(generateMessageHtmlLink(getLink(), getHeader()));
sessionMessageBean.setRedirectAction("NULL");
} else {
sessionMessageBean.setRedirectAction(getRedirectAction());
sessionMessageBean.setHtml(generateMessageWithoutLink(getHeader()));
}
sessionMessageBean.setTypeDth(booleanToInt(isTypeDth()));
sessionMessageBean.setTypeMvno(booleanToInt(isTypeMvno()));
sessionMessageBean.setSubTypeMvnoPostpaid(booleanToInt(isSubTypeMvnoPostpaid()));
sessionMessageBean.setSubTypeMvnoPrepaid(booleanToInt(isSubTypeMvnoPrepaid()));
sessionMessageBean.setTypeDth(booleanToInt(isTypeDth()));
sessionMessageBean.setAktywny(booleanToInt(isActive()));
messagesEJB.updateMessage(sessionMessageBean);
}
LOG.info("Exit: execute()");
return SUCCESS;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getDateFrom() {
return dateFrom;
}
public void setDateFrom(Date dateFrom) {
this.dateFrom = dateFrom;
}
public Date getDateTo() {
return dateTo;
}
public void setDateTo(Date dateTo) {
this.dateTo = dateTo;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public String getHeader() {
return header;
}
public void setHeader(String header) {
this.header = header;
}
public String getRedirectAction() {
return redirectAction;
}
public void setRedirectAction(String redirectAction) {
this.redirectAction = redirectAction;
}
public boolean isTypeDth() {
return typeDth;
}
public void setTypeDth(boolean typeDth) {
this.typeDth = typeDth;
}
public boolean isTypeMvno() {
return typeMvno;
}
public void setTypeMvno(boolean typeMvno) {
this.typeMvno = typeMvno;
}
public boolean isTypeDvbt() {
return typeDvbt;
}
public void setTypeDvbt(boolean typeDvbt) {
this.typeDvbt = typeDvbt;
}
public boolean isSubTypeMvnoPostpaid() {
return subTypeMvnoPostpaid;
}
public void setSubTypeMvnoPostpaid(boolean subTypeMvnoPostpaid) {
this.subTypeMvnoPostpaid = subTypeMvnoPostpaid;
}
public boolean isSubTypeMvnoPrepaid() {
return subTypeMvnoPrepaid;
}
public void setSubTypeMvnoPrepaid(boolean subTypeMvnoPrepaid) {
this.subTypeMvnoPrepaid = subTypeMvnoPrepaid;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
public boolean isLinkChecked() {
return linkChecked;
}
public void setLinkChecked(boolean linkChecked) {
this.linkChecked = linkChecked;
}
}