0

我在同一页面上插入和查看。但问题是错误消息未显示

<action name="ViewAllCostings" class="volo.tms.costings.Costings" method="ViewAllCostings">
                  <result name="success">/costings/costings.jsp</result>
</action>     

<action name="addcosting" class="volo.tms.costings.Costings">
    <result name="input">/costings/costings.jsp</result>
    <result name="success" type="chain">ViewAllCostings</result>
    <result name="error" >/costings/costings.jsp</result>
</action>

和 costings.jsp

<s:actionerror/>
    <s:form action="addcosting" method="post">
    <s:textfield label="Costing Type" name="costtype" required="true"/>
    <s:textfield label="Cost(rs.)" name="costrs" required="true"/>           
    <s:submit value="ADD" name="addcostbutton"/>
</s:form>

<div class="Wrapper">           
    <display:table id="txt" name="costinglist" pagesize="10" cellpadding="2px;" cellspacing="5px;" requestURI="">
        <display:column property="costtype" title="Cost Type" sortable="true"></display:column>
        <display:column property="costrs" title="Cost(rs.)" sortable="true"></display:column>               
    </display:table></div>

和动作类

 public String execute(){//used this method for insert data 
        ArrayList costList = new ArrayList();
        costList.add(costtype);
        costList.add(costrs);
         costList.add(costid);
         if (AddCostDao.insertEditCostDetails(costList)) {
            return SUCCESS;
        } else {
            addActionError("Employee name already exists !");
            return ERROR;
        }}

public String ViewAllCostings(){ 
   //used for view data using list
    return SUCCESS
}

没有收到错误信息。我试过但没有得到解决方案

4

1 回答 1

0

您可能会遇到验证错误INPUT,但未执行该操作且未设置消息。如果您想阻止该操作进行验证,您可以配置该操作以将该方法从验证拦截器中排除。至于验证拦截器实现方法过滤器拦截器,您可以在struts.xml. 或者只是@SkipValidation在方法上添加注释。

@SkipValidation
public String execute(){//used this method for insert data  
于 2015-08-31T09:54:37.330 回答