Remote Link Ajax Struts

我只是一个虾纸丫 提交于 2019-12-14 02:53:40

问题


In my menu.jsp:

 <s:url id="ajaxTest" value="addCustoInfo"/>
 <sx:a id="link3" href="%{ajaxTest}" targets="main-content">
    Update Content
 </sx:a>

in my struts:

 <action name="addCustoInfo" method="renderAddCustomerInfo"
         class="customerInfoAction">
    <result name="success">/page/addCustoInfo.jsp</result>
    <result name="empty">/page/addCustoType.jsp</result>
 </action>

in my CustomerAction:

@SuppressWarnings("unchecked")
public String renderAddCustomerInfo(){
    this.listCustomerType = daoManager.listCustomerType();
    if(this.listCustomerType.size() <= 0){
        this.session.put("error", "Empty customer type.");
        return "empty";
    }else{
        this.customerInfo = new CustomerInfo();
        return SUCCESS;
    }
}

in addCustoInfo.jsp:

      <form id="addCustoInfo" action="saveCustoInfo" method="post">
            <fieldset>
                <p>
                    <label>Customer Type</label> <select name="idCustoType">
                        <s:iterator value="listCustomerType" status="s">
                            <option value='<s:property value="customerTypeId" />'>
                                <s:property value="customerDesc" />
                            </option>
                        </s:iterator>
                    </select>
                </p>
                <p>
                    <label>Customer Name<br></label> <input name="customerInfo.name" type="text" class="required" minlength="8">

                </p>
                <p>

The form addCustoInfo.jsp success to display, but dropdown idCustoType didn't display anything whereas listCustomerType size more than one. It's maybe caused of active url. In this case, active url is not change even when I click Update Content link. How can I resolve this. I'd really appreciate your solution. Thanks.

来源:https://stackoverflow.com/questions/8179353/remote-link-ajax-struts

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!