on 09-17-2007 2:59 PM
Hi!!!
I'm following the guide to download files onDemand in a table, you can find that guide at:
If found a problem with the guide: What would happen if there's an error while downloading or somenthing else? There the author doesn't explain how to show an error in the view.
What I'd like to do is to show a error message in the view where the table is.
I tried to add some code, but it doesn't finally show the error message.
I have a method that generates the file and returns the path of the file in the context, so I can read it. It return boolean (true if the file was generated, false on the contray). That method is called executeZgav_Sf_Formulario_Sv_Input(nroEmpleado, nroViaje, morei, datosEspejo); and is working fine.
I also have a static class that reads a file and returns the byte[] called: ManejoArchivos.getByteArrayFromResourcePath(wdContext.currentOutput_FormularioSVElement().getP_Path(), true);
But if for example, the parameters are incorrect and the file cannot be generated, the method is supposed to show an error but is not displayed on the screen.
I have some code after that which validates if the file could be read or not and returns the bytes of a prewritten PDF file with an error message.
-
Added code:
byte[] r = null;
boolean continuar =
this.executeZgav_Sf_Formulario_Sv_Input(nroEmpleado, nroViaje, morei, datosEspejo);
if (continuar)
try {
r =
ManejoArchivos.getByteArrayFromResourcePath(
wdContext.currentOutput_FormularioSVElement().getP_Path(),
true);
} catch (FileNotFoundException e) {
wdComponentAPI.getMessageManager().reportMessage(
IMessageData.ARCHIVO_NO_ENCONTRADO,
null,
true);
} catch (IOException e) {
wdComponentAPI.getMessageManager().reportMessage(IMessageData.PROBLEMA_IO, null, true);
}
I tried so, but it still doesn't work!!
Does it have somenthing to do with the version?? I'm using NW04s Stack 06.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
While Catching the FileNotFound Exception, try printing the message directly instead of using the Message designed in Message Pool. You can so this by:
wdComponentAPI.getMessageManager().reportException("Your Message", false);
OR
wdComponentAPI.getMessageManager().reportWarning("Your Message");
Regards,
Alka.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As I understand,
A window open ups when File Download action is fired, and the error messages
should be shown in this window.
If so, then in the View that is rendered in the pop-up window, you can place a Message Area UI Element, in the visible part of view. Message Area is used to
dispaly all error messages (both from message pool and direct one's) in a fixed
area on the View.
Regards,
Alka.
Hi Alejandro,
Try This.
try
{
......
}
catch (FileNotFoundException e) {
wdComponentAPI.getMessageManager().reportException("Given FileNotFoundException : "+e.getMessage(),true);
}
catch (IOException ex) {
wdComponentAPI.getMessageManager().reportException("Given IOException : "+ex.getMessage(),true);
}
Regards,
Mithu
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.