package pac1;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public final class ShoriCtrl extends Action {
public ActionForward execute
(ActionMapping map, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
{
// データの入力
inputForm inputform = (inputForm)form;
String nyuryoku = inputform.getNyuryoku();
// モデル呼び出し
Shori1 shori1 = new Shori1();
String kekka = shori1.rituKeisan(nyuryoku);
// エラー時の出力
if ( kekka == null )
{
errorForm errorform = new errorForm();
errorform.setMsg("NO DATA!");
request.setAttribute("errorForm",errorform);
return map.findForward("error");
}
else if ( kekka.equals("NO DATA!") == true)
{
errorForm errorform = new errorForm();
errorform.setMsg("NO DATA!");
request.setAttribute("errorForm",errorform);
return map.findForward("error");
}
// 正常時の処理
kekkaForm kekkaform = new kekkaForm();
kekkaform.setRitu(kekka);
request.setAttribute("kekkaForm",kekkaform);
return map.findForward("success");
}
}
|