Struts reload data
От: Аноним  
Дата: 24.01.06 14:30
Оценка:
Привет.
Я хочк сделать что бы у меня было так :
В верху страницки выпадающий список который берёт даные с бина №1, рядом кнопочка,
Ниже таблица которая отображает даные в соответсвии с выбраным значением списка, таблица берёт данные с бина №2.
код:
JSP:

<html:form action="contentList">
<html:select property="shortCodeId">
<html:options collection="shortCodesc" property="id" labelProperty="shortCode"/>
</html:select>
<td><html:link action="contentList.do" paramProperty="shortCodeId" paramId="shortCodeId">Show</html:link></td>
</html:form>
<logic:notEmpty name="contentListForm" property="contents">
<logic:iterate name="contentListForm" property="contents" id="content">
<td><bean:write name="content" property="content"/></td>
<td><bean:write name="content" property="keyword"/></td>
<td><bean:write name="content" property="contentTypeID"/></td>
<td><bean:write name="content" property="shortCodeID"/></td>

Action:

  public class ContentListAction extends Action {

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,    HttpServletResponse response) throws RemoteException, FinderException
    {
        HttpSession session = request.getSession();
        ContentListForm contentListForm = (ContentListForm) form;
        CommonUtils commonUtils = new CommonUtils();
        commonUtils.loadData();
        session.setAttribute("shortCodesc", commonUtils.getAllShortCode());
        String str = request.getParameter("shortCodeId");
        if(str==null) str = "1";
        Integer shortCodeId = new Integer(str);
        contentListForm.setContents(commonUtils.getAllContentsByShortCode(shortCodeId));
        return mapping.findForward("showList");
    }
}

struts-config

 <action attribute="contentListForm" input="/jsp/contentList.jsp" name="contentListForm" parameter="step" path="/contentList" scope="request" type="warelex_impl.shortcode.contentmanagementweb.action.ContentListAction" validate="false">
      <forward name="showList" path="/jsp/contentList.jsp" />
    </action>

form:

   public class ContentListForm extends ActionForm {

    private Collection contents;
    private Integer shortCodeId;

    public Integer getShortCodeId() {
        return shortCodeId;
    }

    public void setShortCodeId(Integer shortCodeId) {
        this.shortCodeId = shortCodeId;
    }
    public Collection getContents() {
        return contents;
    }
   public void setContents(Collection contents) {
        this.contents = contents;
    }

    public void reset(ActionMapping arg0, HttpServletRequest arg1) {
        contents = new ArrayList();
    }
}


у меня эта строчка
 String str = request.getParameter("shortCodeId");
всегда NULL, где ошибка и как сделать правильно??, подскажите плиз .. !!
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.