about response.getWriter().println() in javaBean???

hi,experts:
now i hava a jsp page:a.jsp
<jsp:useBean id="idmy" class="com.my.Ex" scope="page"/>

<html>
<body>
   aaaaaaaaaa<br>
   <%=idmy.pt(response,"mystr")%>
</body>
</html>

com.my.Bx:
public class Bx
{
    public static void pt(HttpServletResponse response,String str){
      //response.getWriter().flush();
      response.getWriter().println(str);
   }
  ....
}

when i deplay a.jsp in resin web server&#65292;i see the html source:
<html>
<body>
aaaaaaaaaaaaa
mystr
</body>
</html>

but when in tomat or jboss web server,the html source is:

mystr
<html>
<body>
aaaaaaaaaaaaa
</body>
</html>

now i want to get sample source in tomcat,like this
<html>
<body>
aaaaaaaaaaaaa
mystr
</body>
</html>
how can i do it? thanks!
hgbdelphiAsked:
Who is Participating?
 
sompol_kiatkamolchaiCommented:
try adding ; in scriptlet like this

<%idmy.pt(response,"mystr");%>
0
 
sunil_bandaruCommented:
try removing the = from the following statement

<%=idmy.pt(response,"mystr")%>

like this:

<%idmy.pt(response,"mystr")%>
0
 
hgbdelphiAuthor Commented:
sorry,this is my mistake,i not this mean ,
<%idmy.pt(response,"mystr")%>
the error is either!

thanks!
0
 
hgbdelphiAuthor Commented:
thanks,now i can work well when i change the code like this:

public class Bx
{
    public static void pt(javax.servlet.jsp.JspWriter out,String str){
      //response.getWriter().flush();
      out.println(str);
   }
  ....
}
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.