Flush parameter of jsp:include has no effect on servlet code

I am running 9.0.3 and my jsp code looks like:
<jsp:include page =".." flush="false"/>
but the resulting servlet code is:
pageContext.include( __url);
Which defaults to flushing the buffer!
Does anyone know a work around or if Oracle is going to fix this?
Thanks,
Mike

Try:
public class ...  extends ...
    private static final boolean antialias = Boolean.getBoolean ("swing.aatext");
    private static Map hintsMap = null;
    @SuppressWarnings("unchecked")
    static final Map getHints() {
       if (hintsMap == null) {
            hintsMap = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N
             if (hintsMap == null) {
                hintsMap = new HashMap();
                 if (antialias) {
                      hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
       return hintsMap;
... later in class ...
    @Override
    protected void paintComponent(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        g2d.addRenderingHints(getHints());
        super.paintComponent(g);
        ...needed this so custom paint would use AA. In my app I wrote text in my component and it was not AA, this turned it on.
I don't think I had the same problem you, as my jlabels were always aa.
Edited by: 805835 on Oct 27, 2010 5:06 PM
Edited by: 805835 on Oct 27, 2010 5:07 PM

Similar Messages

  • Flush in the jsp:include tag

    should I state flush="true" every time I include a jsp using <jsp:include> tag in a jsp pages? For example I am trying to include a menu bar on the top of every jsp pages. Should I flush the buffer every time? if not, will it affect the performance?
    Thank you
    Cal

    Hi,
    This is a known problem, ��flush before you include�� limitation in JSP 1.1.
    As a result, you have to state flush="true" every time you include a jsp using <jsp:include> tag if you are using JSP1.1.
    Fortunately, it is fixed in JSP1.2. The flush attribute controls flushing. If true, then, if the page output is buffered and the flush attribute is given a ��true�� value, then the buffer is flushed prior to the inclusion, otherwise the buffer is not flushed. The default value for the flush attribute is ��false��.
    Gary Wang
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developers/support/

  • Qestion about jsp:include

    When using <%@ include> , file is included at compiler time. So a) is OK because ShowForm.jsp has access to the form bean.
    When using <jsp:include>, file is included at runtime. So b) is wrong.
    But why c) is correct? Does "flush" attribute for <jsp:include> make things different?
    /////////////form.jsp
    <jsp:useBean id='form' class='beans.Form' scope='request'>
    <jsp:setProperty name='form' property='*'/>
    </jsp:useBean>
    <%@ include file ='showForm.jsp' %> <--a) OK
    <jsp:include page='showForm.jsp' /> <--b) wrong
    <jsp:include page='showForm.jsp' flush = 'true' /> <--c) OK . Why ?????
    ///////////showForm.jsp
    <b>name: </b> <%= form.getName() %><br>
    <b>comments: </b> <%= form.getComments() %><br>
    <b>credit: </b> <%= form.getCredit() %></p>

    When using <%@ include> , file is included at
    compiler time. So a) is OK because ShowForm.jsp has
    access to the form bean.
    When using <jsp:include>, file is included at
    runtime. So b) is wrong.
    But why c) is correct? Does "flush" attribute for
    <jsp:include> make things different?
    /////////////form.jsp
    <jsp:useBean id='form' class='beans.Form'
    scope='request'>
    <jsp:setProperty name='form' property='*'/>
    </jsp:useBean>
    <%@ include file ='showForm.jsp' %>
    <--a) OK
    <jsp:include page='showForm.jsp' />
    <--b) wrong
    <jsp:include page='showForm.jsp' flush = 'true' />
    <--c) OK . Why ?????
    ///////////showForm.jsp
    <b>name: </b> <%= form.getName() %><br>
    <b>comments: </b> <%= form.getComments() %><br>
    <b>credit: </b> <%= form.getCredit() %></p>Are you sure that c is ok, and that you are not just flushing the output to the user before you can display an error message? Try putting information after c) and see if it gets displayed, and check your log files and see if an error is occuring that you are not seeing...
    (not sure if that is real or not, just my suspicion...)

  • What is the difference between jsp :include and server side include

    what is the difference between jsp :include and server side include(request dispatcher include method)????
    i understand that both request dispatcher include method and jsp:include take dynamic data,so when would one use request dispatcher include and when jsp:include.
    Is the usage interchangeable?i believe jsp include is used only for jsp/html but include directive can be used to include servlets ,jsp and html....correct me if i m wrong and
    do suggest if u hav ny other diff in this context...

    The difference really is: in what format do you want your inclusions? If your environment has many Java developers and only a few designers that focus mainly on, say, Flash, that might push you more towards the server-side include() directive. Or, if you have a large set of pages that receive dynamic content that is displayed in a consistent fashion (such as a workflow header area on a page).
    If, on the other hand, you have more web designers, there may be a greater desire to deal in markup rather than Java code. Java developers themselves might prefer to view markup (JSP) that more resembles the eventual output than something occuring in Java code.
    Finally, there are considerations of tiering. While it is totally possible to (and I have previously) implement 'view classes' that render markup or generate layout templates, JSP's offer, IMO, a subtle, psychological advantage. By forcing a developer to work in a different format, markup versus Java source, the separation on view from controller and model becomes a bit easier. It is still possible to make mistakes, but if a developer at some point notices, "Wait, I'm in a JSP, should I be importing a java.sql class?", then the choice to use JSP includes has paid off in spades.
    - Saish

  • Jsp:include doesn't work with Tomcat & IIS

    Hi, Guys,
    I installed IIS4.0 and Tomcat in my windows NT system. http://localhost/examples/jsp/index.html works fine.
    When I load http://localhost:8080/about.jsp, it's also working fine. But when I load http://localhost/about.jsp, it will ignore the part which the line is display as
    <%String topName = "/servlet/topServlet";%>
    <jsp:include page="<%=topName%>" flush="true"/>
    The other part will work just as a html file. And I didn't get any error message.
    Would can tell me how to figure out this problem. Thank in advanced very much!

    Oh, God, why not tell me earlier!!!!!! I do use tomcat 3.1 and it just support servlet. I have no way out but modify all my jsp:include to encoding into a servlet page. I almost re-do all my work. But anyway, thank you! Next time I will know.

  • Why doesnt jsp:include work?

    Hello all
    I am trying to include a header file in my jsp page, and then include a servlet on another server. Question is, is this possible? In my code below, the header file is shown but the results of the servlet, which resides on a different server, are not. Any idea why the second line doesnt work?
    Thanks in advance for any help.
    <%@ include file="header.jsp" %>
    <jsp:include page="http://differentserver:1080/servlet/Docu?dir=AdminProc" flush="true" />

    Thanks for the clarification. I am actually trying to convert some PHP to JSP, and idea what the equivalent of
    <?php
         include("header.php");
         include("http://differentserver:1080/servlet/DocuServ?dir=Procedures");
    ?>
    is in JSP?

  • Remove danger of using a request parameter in a JSP:include

    HI,
    I have a basic include where the filename is controlled by a request parameter:
    <%String fileName = request.getParameter("param1")+".jsp"; %>
    <jsp:include page="<%=fileName%>" flush="true" />This works fine but I am rather worried about the security as some can easily edit the URL to something like this:
    http://www.mysite.com/include.jsp?param1=../../../passwords
    Does anyone have any good security techniques that would strip out anything in param1 that could potentially be rather dangerous?
    Thanks

    Check/test the request parameter before using. Best way is to use a (controller) servlet for this.

  • In jsp:includes , is there a flush="false" in jsp 1.1

              In <jsp:includes>, is there a flush="false" in jsp 1.1...i know that it's going
              to be in jsp 1.2 but is there something like it that i can use in jsp 1.1.
              

    As far as I know (not very far, btw) new versions of Java are now only distributed from Oracle specifically for OS X. Apple is no longer updating Java beyond the version distributed with the 2014-001 security update. Java SE Runtime Environment 7 1.7.0_67 is the most recent Oracle release. That's pretty much all I know.

  • Problem with flush=true in the jsp:include tag

    Hello
    I have deployed a JSP based application , based on the apache struts framework. The web server is Sun One Webserver 6 Service Pack4, on a windows 2000 machine
    The same application was tried on SunONE application server 7, and it works without any problem. However in this case the following error , on the page
    javax:servlet.jspexception:Illegal to flush within a custom tag
    Does this mean flush="true" is not allowed within custom tags
    Or is there a workaround for this
    Any help is appreciated
    thanks
    - Aniruddha

    Hi,
    This is a known problem, ��flush before you include�� limitation in JSP 1.1.
    As a result, you have to state flush="true" every time you include a jsp using <jsp:include> tag if you are using JSP1.1.
    Fortunately, it is fixed in JSP1.2. The flush attribute controls flushing. If true, then, if the page output is buffered and the flush attribute is given a ��true�� value, then the buffer is flushed prior to the inclusion, otherwise the buffer is not flushed. The default value for the flush attribute is ��false��.
    Gary Wang
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developers/support/

  • Repeating parameter names in jsp:include

    Hi,
    I have this jsp code fragment:
    <div>
    <jsp:include page="fragment_1.jsp">
    <jsp:param name="param" value="hello world!"/>
    </jsp:include>
    <jsp:include page="fragment_2.jsp">
    <jsp:param name="param" value="good morning!"/>
    </jsp:include>
    </div>
    When this code executes, the value for param, as the fragment_2 is included, is "hello world!" and not "good morning!".
    How can I use the same name for a param in fragment_2 ?
    Pietro

    The problem is that nothing in the servlet specifications prohibits a requests from having more that one parameter with the same name. It looks that when you set a parameter with the jsp:param tag that it is appending another parameter with that name.

  • Pass parameter to the jsp include

    Hello,
    Is it possible to pass a string to the <jsp:include page ?
    Thanks!
    ~ Kyle

    Use jsp:param.

  • How to Parse Escape Character(&) with JSP Include URGENT

    Hi,
    I guess anyone could help me out.
    I have a JSP file where I am including another JSP file and setting parameter for that include file. Among those parameters one of the parameter is having a value having ampersand with it. like R&D. In such case am i getting following error.
    I dont know how should I get rid of this &.
    I tried converting it to amp; even tried \\& also tried using escape("R&D"). But no success. Can you guys help
    Code:
    <jsp:include page="../hottopics/controller_hottopics1.jsp" flush="true">
    <jsp:param name="UserID" value="<%=username%>" />
    <jsp:param name="kmsid" value="<%=kmsid%>" />
    <jsp:param name="department" value="<%=department%>"/>
    <jsp:param name="location" value="<%=location%>"/>
    <jsp:param name="supportorg" value="<%=supportorg%>"/>
    <jsp:param name="supportflag" value="<%=supportflag%>"/>
    </jsp:include>
    department : R&D
    Error :
    java.lang.IllegalArgumentException
    at javax.servlet.http.HttpUtils.parseQueryString(HttpUtils.java:151)
    at org.apache.tomcat.facade.RequestDispatcherImpl.addQueryString(RequestDispatcherImpl.java:546)
    at org.apache.tomcat.facade.RequestDispatcherImpl.doInclude(RequestDispatcherImpl.java:388)
    at org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl.java:270)
    at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)
    at ITHelpAlerts_0002dv_00034._0002fITHelpAlerts_0002dv_00034_0002fgadget_0002ejspgadget_jsp_7._jspService(_0002fITHelpAlerts_0002dv_00034_0002fgadget_0002ejspgadget_jsp_7.java:210)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
    at org.apache.tomcat.core.Handler.service(Handler.java:287)
    at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
    at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
    at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
    at java.lang.Thread.run(Thread.java:534)

    Okay, not surprising. Like I said, the & has special meaning in URLs, to seperate one parameter from the next. Perhaps you should thing about using request attributes instead of parameters:
    request.setAttribute("department", "R&D");
    //then on recieving side
    String department = (String)request.getAttribute("department");

  • Relatiive Path problem when using JSP:include in web portlet

    Hi
    I am using Oracle Portal 9.0.2, and thus OC4J as the J2EE platform.
    I have created a JSP web portlet that is supposed to inlude a specific static html file, which name is passed to it using a portlet parameter. It works, but I had to create a symbolic link from the applicable J2EE applications's htdocs directory in order to access the content:
    /j2ee/OC4J_Portal/applications/<application>/htdocs/<portlet>/content/
    where /content/ is a symbolic link to another directory altogether.
    I can then access the content from within the portlet with a JSP include tag that looks like :
    docPath = "/htdocs/<portlet>/html/"+doc_path;
    %>
    <br>Include:
    <jsp:include page="<%=docPath%>" flush="true"/>
    I would like to access the content using the JSP include without having to use the symbolic link. Is there a way to do this. I tried using an Apache alias, but that did not work.
    Regards
    Harry

    Hi
    Thanx
    In the end we build up a static URL to the document to be included using:
    String contentLocation="content/";
    docPath = contentLocation+getAdditionalDocPath();;
    out.println("docPath="+docPath);
    String docPathAndName = portletRequest.getParameter("doc_path");
    %>
    <!--
    This java script function calls the display content page with the
    page parameter doc_path (which is in return passes it to the display
    content portlet) in order to retrieve and display specific document
    with a JSP:include tag
    -->
    <script language="JavaScript">
    function generateSectionPath(docName) {
    this.location="http://<%=portletRequest.getServerName()%>:<%=portletRequest.getServerPort()%>/pls/portal/url/page/<%=getPageGroup()%>/content?doc_path="+"<%=docPath%>"+docName;
    <script language="JavaScript">
    function generateRelativePath(docName) {
    this.location="http://<%=portletRequest.getServerName()%>:<%=portletRequest.getServerPort()%>/pls/portal/url/page/<%=getPageGroup()%>/content?doc_path="+docName;
    </script>
    <br>Include:
    <%
    if (portletRequest.getParameter("doc_path") == null) {
    out.println("Error - no doc path specified");
    } else { 
    try { %>
    <jsp:include page="<%=docPathAndName%>" flush="true"/>
    <% } catch (Exception e) {
    out.println("Error retrieving document:"+e.toString());
    } // end if
    %>
    Each link from one included HTML file to another becomes a JS function that points the browser to the portal page that includes the portlet that includes thwe JSP that has the include tag to include the html document that is to be displayed.
    The current relative path the the html document (from a predefined root in the file system that is symbolically linked to the same directory as where the including JSP lives) is stored in a session variable, and appended to the document name that is passed to the page.
    If a full document path, as opposed to just the name, is stored, that no appending is done. However, the path is stripped out and stored in a session variable.
    Ths thing is, sometimes a document name, and sometimes a path is passed to the page. Therefore the requirement to know the path when it is not available. A name only will always be passed subsequent to a request for a document with the full path specified, therefore the session variable mechanism works.
    Thanx for the input
    Harry

  • Nested jsp:include includes wrong file

    Hi,
    I've encountered a somewhat strange problem that's upsetting me for more than 3 hours by now. I've searched on the Web, Usenet, Tomcat Bugzilla, and the java.sun.com forums, but still didn't find a solution.
    Let me explain my current JSP/servlet flow:
    A servlet retrieves an article from a database, puts the article data into a bean, sets that bean as request attribute and includes a JSP to display the content of this bean (your basic MVC pattern). This works fine.
    The page being included by the "retrieve" servlet is actually a layout page (index.jsp) including the JSP (article.jsp) which displays the bean data, so the servlet actually includes "index.jsp?c=article.jsp" (with the bean as request attribute).
    In that index.jsp, there's a jsp:include that should include the output from another MVC-style servlet/JSP-block: Servlet "poll" creates a PollBean from a database, puts that as attribute into the request and includes "polls/show.jsp".
    Here's a simplified representation of my page layout:
    +---------+---+       The outer box is the "index.jsp", which
    |         |   |      
    |         |   |       a) includes the servlet "retrieve"
    |    1    | 2 |          which in turn includes "article.jsp"
    |         |   |          at position 1 and
    |         |   |
    |         |   |       b) includes the servlet "poll"
    |         |   |          which in turn _should_ include "polls/show.jsp"
    |         |   |          at position 2
    +---------+---+Well now, my problem is: Somehow Tomcat manages it to include the "article.jsp" TWICE at position 1 AND 2, although the jsp:include at positon 2 reads (that's hardcoded):
    <jsp:include page="/poll?action=latest&limit=1" />
    And in the PollServlet (as you guess, mapped to "/poll") the file to be included is hardcoded to "polls/show.jsp".
    If there wouldn't be anything included at position 2, that would pretty clearly be an error with wrong relative paths used in the jsp:include at position 2. But what really scares me is that the "article.jsp" get's included at position 2 although some debugging statements show that the PollBean is actually in the request after the jsp:include at position 2 has been executed.
    I just don't get it why "article.jsp" is included twice, and although the poll servlet is called, the "polls/show.jsp" doesn't show up anywhere.
    I've tried to flush the "out"-JSPWriter of "index.jsp" at several different key locations in the code, even flushed() in the PollServlet after including "polls/show.jsp" but that didn't help.
    If you need some proof of this weird behavior, ask in this thread and I'll post the link the website where that happens.
    Thanks in advance,
    phil

    Try deleting all the compiled JSPs (usually in a
    directory called "work") then requesting the pageThat's what I did, too. I've gone through the whole make-Tomcat-start-all-over procedure:
    - reloaded via webapp manager: nope
    - stopped/started via webapp manager: nope
    - clear /work/ directory and restarted Tomcat: nope
    Didn't help anything.
    Have you debugged your PollServlet to see if it's
    returning/including the right (hard-coded) page?Mmh.. What should I debug there? There's not much to debug, if stuff is hard-coded like ...
    I just found the error in my code! duh I was just looking in Eclipse for a piece of code to post here when I saw my mistake:
    The CMS I'm currently adding the poll feature to is more flexible than I thought (and that although I wrote it myself!):
    The article-retrieve servlet is called by this URL:
    /retrieve?nextPage=article.jsp&id=12345And my poll servlet is called by
    /poll?action=latest&limit=1Normally this would include the "polls/show.jsp" from the PollServlet because the code in PollServlet reads:
    // Use nextPage from request or show by default
    nextPage = request.getParameter("nextPage");
    if(nextPage == null) nextPage = "polls/show.jsp";But when the PollServlet got called from the "index.jsp?c=retrive&nextPage=article.jsp&id=123" page, there actually was a "nextPage" param and it's value was "article.jsp". And because there was still an ArticleBean in the request (from the ArticleRetrieveServlet), this "article.jsp" included by the PollServlet displayed the article a second time.
    I fixed it by including my PollServlet's output with the "nextPage" parameter explicitly set:
    /poll?action=latest&limit=1&nextPage=polls/show.jsp
    The other way to test is to change your hard-coded
    page to some arbitrary HTML page so you know that at
    least it IS being included.That's something I didn't think about :)
    The other thing to test is to request this page
    (action) directly. So type
    /poll?action=latest&limit=1 into the browser and see
    what you get.Already did that, no problems.
    Sorry I can't be of more help... but I would bet the
    farm that it's not a problem with Tomcat.You're right. I'd really be shocked to have me find 2 bugs in Tomcat within the last to weeks (although the bug was already fixed in a newer version of Tomcat)
    Also... You may want to consider using Struts for your
    MVC if you can.Lots of people keep telling me that, but I'll want to do a general cleanup of the code first - maybe then I'll convert to Struts. After all I'm a freelancer and currently don't have time to learn Struts.
    Thanks for your help,
    phil

  • Jsp:include cutom tag libs

    OC4J 9.0.3
    JDK 1.4.2_01
    I have a jsp (outer.jsp) that includes another jsp (inner.jsp).
    inner.jsp contains a form with a table in it. It also has custom tags for inputs, etc.
    For example:
    <form ...>
    <table>
    <tr>
    <td>
    <ww:input ... />
    </td>
    </tr>
    </table>
    </form>
    When I view the source for my outer.jsp it looks like this:
    <input ... />
    <form ...>
    <table>
    <tr>
    <td>
    </td>
    </tr>
    </table>
    </form>
    It looks like the custom tag was expanded first and then the remaining html.

    you need to use the flush="true" parameter on your include statement.

Maybe you are looking for

  • My wifi conection does not work on my 3G iphone

    my 3g phone will not connect to wifi.  I am using OS 4.2.1

  • Attaching Max Resolution Photos to Mail

    How do I attach a full rez photo (from iPhoto) to an outgoing mail? Attaching a reduced size version is straightforward but I can't figure out how to attach the original... Thanks Nick (new to Mac!)

  • Socket 1366 chipsets - what's coming down the road?

    Hi everyone. I'm probably going to build a new rig in about 6 months to a year, and I intend to use the Socket 1366 architecture. However, one thing I have noticed at the moment is the lack of reasonably priced boards for that architecture. In short,

  • Project not opening

    I saved a project on one computer and am trying to open it on another. They are both running the latest FCP and upgraded all the way. When I try to open the project on my Mac Pro it claims that the project is from a newer version and cannot open it.

  • Error - 50 and other really frustrating issues, none resolved so far on online community

    Hi all, I'm on the verge of giving up on Apple Itunes and the Store altogether. Since the second last iTunes update came out I've had continuing issues with downloads that get interrupted with a range of error messages coming up, the most recent and