Avoiding java.lang.IllegalStateException in jsp

后端 未结 1 1138
鱼传尺愫
鱼传尺愫 2021-01-29 09:52

i try to download a generated pdf in jsp.but my log shows following error.how can i avoid this error.my code and error are the following

List sdolist          


        
相关标签:
1条回答
  • 2021-01-29 10:07

    The reason you're getting this error is because you're doing your logic with a JSP. A JSP renders its output with using the Writer object of the response, but you are calling getOutputStream inside the JSP as well. Therefore, you'll get an exception since you're trying to use both the OutputStream and the Writer at the same time. You haven't showed your entire JSP code, but I'm guessing you're doing some output (maybe some blank characters) after your main logic. As @VigneshVino says, you should do your logic inside a servlet instead. A JSP should only be used to render the view.

    0 讨论(0)
提交回复
热议问题