Hi, 

Not sure if there is any kind of exception thrown within your code, if any 
other than UnsupportedEncodingException, the  modalWindow.close(target) is not 
reachable.
You can try to place it into the final block.

Best Regards, 
Aaron Wang 
OLL DCS - OCHL/ZHA 
*(86-756)3396170 *aaron.w...@oocl.com 


-----Original Message-----
From: 蔡茂昌 [mailto:caimaochang.c...@gmail.com] 
Sent: Thursday, June 17, 2010 3:24 PM
To: users@wicket.apache.org
Subject: modalWindow can not be closed

there is some error in the last email i send, here is real code

AjaxButton saveBtn = new AjaxButton("save") {
   @Override
   protected void onSubmit(AjaxRequestTarget target, Form<?> form) {

    List<People> list3 =
peopleService.fetchBySearchCondition(searchCondition);
    List<PeopleForExport> resultList = doTransLate(list3);
    File file = peopleService.exportExcelFile(resultList,formModel);
    IResourceStream is = new FileResourceStream(file);
    try {
     if (((WebRequest) getRequest()).getHttpServletRequest()
       .getHeader("User-Agent").toLowerCase().indexOf(
         "firefox") > 0) {
      getRequestCycle()
        .setRequestTarget(
          new ResourceStreamRequestTarget(is)
            .setFileName(new String(file
              .getName().getBytes(
                "UTF-8"),
              "ISO8859_1")));
     } else {
      getRequestCycle().setRequestTarget(
        new ResourceStreamRequestTarget(is)
          .setFileName(URLEncoder.encode(
            file.getName(), "UTF-8")
            .replace("+", "%20")));
     }
    } catch (UnsupportedEncodingException e) {
     e.printStackTrace();
    }
    modalWindow.close(target);
   }
   @Override
   protected void onError(AjaxRequestTarget target, Form<?> form) {
    target.addComponent(feedbackPanel);
   }
  };
  form.add(saveBtn);

thanks

--jans

IMPORTANT NOTICE
Email from OOCL is confidential and may be legally privileged.  If it is not
intended for you, please delete it immediately unread.  The internet
cannot guarantee that this communication is free of viruses, interception
or interference and anyone who communicates with us by email is taken
to accept the risks in doing so.  Without limitation, OOCL and its affiliates
accept no liability whatsoever and howsoever arising in connection with
the use of this email.  Under no circumstances shall this email constitute
a binding agreement to carry or for provision of carriage services by OOCL,
which is subject to the availability of carrier's equipment and vessels and
the terms and conditions of OOCL's standard bill of lading which is also
available at http://www.oocl.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to