Avatar billede fredand Forsker
26. maj 2010 - 17:35 Der er 2 kommentarer og
1 løsning

How to show an error.jsp with Jboss and struts?

Hello!

We use JBoss 5 and struts 1.2.4.

First I got to fix a bug that we got an error in a log file:
Cannot forward after response has been committed.

If I'm not wrong this occured because we got <error-page> pointing to syserror.jsp in web.xml and in struts-config.xml we got <exception> handling to the same page.

How ever when I removed the error-page from web.xml the error in the log file was gone.

...But...

First time I trigger the excption that should lead me to the syserror.jsp I get:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

expetion.MyExceptionDTO


Next time I trigger it everything runs through the struts and the syserror.jsp is showing correct.

Is thie because I have not precompile the jsp?

If you got any clue please let me know!

Best regards
Fredrik
Avatar billede arne_v Ekspert
26. maj 2010 - 17:43 #1
"Cannot forward after response has been committed."

indicates that the action has somehow started to write to the response before forwarding to the JSP.
Avatar billede fredand Forsker
28. maj 2010 - 13:08 #2
Hello!

Your thoughts about "started to write to the response" was absolutly right.

In web.xml there was <error-page>
In struts config there was global-forwards: <forward name="error" path=".systemfel"/> via the tiles to the same page as in <error-page>

The soultion was to remove the <forward name="error" path=".systemfel"/> and make sure there was a <forward name="error" path=".systemfel"/> for each action.

Please give a svar mate!

Best regards
Fredrik
Avatar billede arne_v Ekspert
01. juni 2010 - 04:32 #3
OK

But I still don't think I completely understand the issue.  :-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester