Hi,
I've a strange bug. I create an action class with three methods: view(),
check(), do(). These three methods are in one class. In my
struts-config.xml, I have made the following entries:
<action name="letterRequestIndex" class="springLetterRequestIndex"
method="view">
<result
name="success">/WEB-INF/application/modules/letterrequest/index.jsp</result>
</action>
<action name="letterRequestCheck" class="springLetterRequestCheck"
method="check">
<result name="input"
type="redirectAction">letterRequestIndex</result>
<result
name="add">/WEB-INF/application/modules/letterrequest/addDetails.jsp</result>
<result name="success"
type="redirectAction">letterRequestDoRequest</result>
</action>
<action name="letterRequestDoRequest"
class="springLetterRequestDoRequest" method="do">
<result
name="success">/WEB-INF/application/modules/letterrequest/viewStatus.jsp</result>
<result
name="add">/WEB-INF/application/modules/letterrequest/index.jsp</result>
</action>
When I call an action, i.e.: letterRequestDoRequest, this method is repeated
3 to 5 times. My question is: Why this action is repeated 3 to 5 times? Can
you help me?
The method called within the letterRequestDoRequest action is:
public String do() throws PortletException{
this.session =
PortletActionContext.getRequest().getPortletSession();
LetterInfo letterInfo = new LetterInfo();
letterInfo.setTypeOfLetter((TypeOfLetter)this.session.getAttribute(TYPE_OF_LETTER));
if
(letterInfo.getTypeOfLetter().getCode().equals(
TypeOfLetter.CONSULAR.getCode())){
if
(this.getLetterInfo().getRecipient().trim().length() == 0){
setLetterInfo(letterInfo);
return ADD;
} else {
letterInfo.setRecipient(getLetterInfo().getRecipient());
}
} else {
letterInfo.setRecipient("");
}
letterInfo.setDateOfRequest(new Date());
letterInfo.setStatus(TypeOfStatus.UNPROCESSED);
if
(BasicUtils.isFromThursdayToFriday(letterInfo.getDateOfRequest())) {
setStatusMessage(getText("label.afterNextFriday"));
letterInfo.setDateOfDelivery(
BasicUtils.getNextDay(
letterInfo.getDateOfRequest(), Calendar.FRIDAY, 1));
} else {
setStatusMessage(getText("label.nextFriday"));
letterInfo.setDateOfDelivery(
BasicUtils.getNextDay(
letterInfo.getDateOfRequest(), Calendar.FRIDAY, 0));
}
setLetterInfo(letterInfo);
this.letterRequestService.create(letterInfo);
this.session.removeAttribute(TYPE_OF_LETTER);
return SUCCESS;
}
Thanks in advance!!
--
View this message in context:
http://www.nabble.com/Struts-2%3A-Multiple-methods-in-an-action-Class-tp14666539p14666539.html
Sent from the Struts - User mailing list archive at Nabble.com.