简体   繁体   中英

calling servlet from action class

I am calling a servlet from an action class by using forward. It is then going to the servlet but it is not showing the output.

Actually I have create a PDF file which I need to show it on runtime. If I run that servlet only on server then it is showing the PDF file I want to. But if I forward it from the action class it is not not showing anything. I have given a simple condiiton on the action class like this:

 if(id.equals("SGSY"))
    {
    forward = mapping.findForward("SGSY");
    }
    else
    {
    forward = mapping.findForward("fail");
    }

After this it is going to servlet but not actually showing the output. I don't understand why. Am I doing something wrong?

Try response.sendRedirect 1st instead of forward mapping,if it works it means there must be problem with your path

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM