0

我使用 Struts 2.2。

我已经迭代了一个ArrayList用户。我有每个用户的编辑链接。

单击编辑链接时,我想在数据库中找到用户并显示其属性。

不幸的是,该链接没有将我带到所需的页面,而是将我重定向到同一页面。有任何想法吗?

显示.jsp:

<logic:iterate id="customerElement" name="ACTIVE_PROFILES_LIST" property="list">
  <tr>
    <td>
      <bean:write name="customerElement" property="lastName"/>
    </td>

    <td>
      <bean:write name="customerElement" property="firstName"/>
    </td>

    <td>
      <pdk-html:link action="/beforeEditProfile.do?toEdit=${customerElement.login}">Edit</pdk-html:link>
    </td>
  </tr>
</logic:iterate> 

动作类:

public class BeforeBeforeEditProfileAction(){

  public ActionForward execute(ActionMapping mapping, ActionForm form,
                               HttpServletRequest request,
                               HttpServletResponse response) throws IOException,
                                                                    ServletException {


 // retrieve the parameter


    String toModify= request.getParameter("toEdit");  
    SearchBean search = new SearchBean();
    Cetatean cet = search.getSingleCitizen(toModify);
    LogManager.info("BeforeEditProfileAction: ENTER");
    if(cet!=null){
        request.setAttribute("cetatean", cet);
        LogManager.info("BeforeEditProfileAction: cetatean not null");
        return mapping.findForward("succes");
    }
    else {  
        LogManager.info("BeforeEditProfileAction: cetatean null");
        return  mapping.findForward("failure");
    }

  }
 }

struts-config.xml

<action path="/beforeEditProfile" type="pm.action.BeforeEditProfileAction" name="user" validate="true" scope="request" input="/htdocs/pages/display.jsp">
  <forward name="success" path="/htdocs/pages/editProfile.jsp"/>
  <forward name="failure" path="/htdocs/pages/profileEditedFailed.jsp"/>
4

0 回答 0