You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by 蔡茂昌 <ca...@gmail.com> on 2010/06/17 09:23:39 UTC

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

Re: modalWindow can not be closed

Posted by Jeremy Thomerson <je...@wickettraining.com>.
What shows up in the ajax debug window?

Jeremy Thomerson
-- sent from my smartphone - please excuse formatting and spelling errors

On Jun 17, 2010 10:59 PM, "蔡茂昌" <ca...@gmail.com> wrote:

i have set a breakpoint on modalWindow.close(target)  ,, it reached ,but
modalWindow still could not be closed ,............is there any other
suggestion?

2010/6/18 <aa...@oocl.com>


> Hi,
>
> Not sure if there is any kind of exception thrown within your code, if any
> other than U...

Re: modalWindow can not be closed

Posted by 蔡茂昌 <ca...@gmail.com>.
i have set a breakpoint on modalWindow.close(target)  ,, it reached ,but
modalWindow still could not be closed ,............is there any other
suggestion?

2010/6/18 <aa...@oocl.com>

> 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.wang@oocl.com
>
>
> -----Original Message-----
> From: 蔡茂昌 [mailto:caimaochang.ctit@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

RE: modalWindow can not be closed

Posted by aa...@oocl.com.
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.wang@oocl.com 


-----Original Message-----
From: 蔡茂昌 [mailto:caimaochang.ctit@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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: modalWindow can not be closed

Posted by "robert.mcguinness" <ro...@gmail.com>.
What does your ajax return? are you using HTTPSessionStore?  
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/modalWindow-can-not-be-closed-tp2258304p2258336.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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