struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: SEVERE: Servlet.service() for servlet default threw exception, java.lang.IllegalStateException
Date Tue, 26 Jul 2011 14:20:01 GMT
My first guess would be that it's an issue with two different things writing
to the output stream, that often causes illegal state exceptions. Can you do
it in such a way that errors are handled by a result instead off in the
action and see what that does?

Dave
 On Jul 26, 2011 10:13 AM, "Emi Lu" <emilu@encs.concordia.ca> wrote:
> Hi Łukasz,
>
>>> tomcat6 + struts2.2.3 + tiles2.2.2 + springframework3.05 + displaytag
1.2.
>>
>> Could you list the jars in WEB-INF/lib ? It looks like you're mixing
>> different version of jars.
>
> It seems that I found the problem. When I commented out ajax section
> "onclick="return ajax_check_search_table('check_search_opr')"", the
> error is gone. But I need ajax check support.
>
> Do you know why ajax and which parts in ajax cause this exception?
>
> Thanks a alot!
> Emi
>
> ----
>
> form.jsp
> ===========
> ....
> <s:submit value="Login" onclick="return
> ajax_check_search_table('check_search_opr')" action="method1ActionView" />
> .....
> <script type="text/javascript">
> function ajax_check_search_table(opr_name)
> {
> var str = $("form").serialize(); //http://api.jquery.com/serialize/
> var return_yn = false;
>
> $.ajax({
> async: false,
> url : opr_name + "ProcessAction.action?" + str,
> success: function(data)
> {
> if(data==1)
> {
> return_yn = true;
> }
> else
> {
> $("#action_error_div").html(data);
> $("#action_error_div").removeClass().addClass("errormsg");
> return_yn = false;
> }
> }
> });
> return return_yn;
> }
> </script>
>
> ProcessAction.java
> =======================
> public String check_search_opr() throws Exception
> {
> inputStream = new ByteArrayInputStream("".getBytes());
> PrintWriter out = res.getWriter();
> res.setContentType("text/html");
> StringBuffer sb = new StringBuffer();
> .... if existing error sb.append....
> String str = sb.toString();
> if(!Utils.isNullOrBlank(str))
> {
> out.println(str);
> }
> else
> {
> out.println(1);
> }
> out.flush();
> return "ajax_forward";
> }
>
> struts.xml
> ===============
> <action name="*ProcessAction" method="{1}" class="ProcessAction">
> <result name="success" type="tiles">...</result>
> <result name="error" type="tiles">...</result>
> <result name="ajax_forward" type="stream">
> <param name="contentType">text/html</param>
> <param name="inputName">inputStream</param>
> </result>
> </action>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message