Html comment in JSP compiled and rendered in NW7.3?

Hi,
We are updateing from EP NW7.0 to NW7.3 and are facing a strange issue with html comment (<!-- -->) in JSP files. It seems as in 7.3 html comment is compiled and rendered but of course does not work.
Is this correct or is it a bug?
Thanks,
Stefan

Hi,
We are updateing from EP NW7.0 to NW7.3 and are facing a strange issue with html comment (<!-- -->) in JSP files. It seems as in 7.3 html comment is compiled and rendered but of course does not work.
Is this correct or is it a bug?
Thanks,
Stefan

Similar Messages

  • HTML Comment Vs JSP Comment

    HTML Comment : <!-- Comment -->
    JSP Comment : <%-- --%>
    1) What is the different between HTML Comment and JSP comment.
    2) How the web container will treat these two comments??
    Regards
    Dhinesh

    Hi,
    JSP comments are used for documenting JSP code and are not visible client-side (using browser's View Source option) where as HTML comments are visible.
    cheers,
    k

  • JSP Compiler and ClassCastException

     

    Have been using JDK1.2.2 from sun since day one and I've been seeing
              ClassCastException since day 1 too.
              Don't think it had anything to do with the compiler.
              "Jun Ying" <[email protected]> wrote in message
              news:[email protected]...
              > I noticed something that might be causing the ClassCastException and has
              not
              > been mentioned: the compiler that is used for jspc. I remember seeing a
              few
              > people mentioning extra classes in the workDir (ie, the bean class that is
              > being used). This is caused by using a smart compiler such as jikes or
              sj.
              > While those compilers will get you more speed for newly modified jsp's,
              they
              > resolve dependencies and recompile all the referenced classes. The result
              > is that the bean class gets recompiled and put into workDir. So no matter
              > where you put the workDir, you end up getting a new copy of the bean class
              > file, which is reloaded by the classloader that loads the newly compiled
              > JSP. That copy of the class file is considered "different" from the one
              > from the normal system classpath or the weblogic.class.path. Thus the
              > ClassCastException. So if you see java classes other than the jsp's in
              the
              > workDir, make sure you are using javac from the sun jdk. So to answer
              > Anish's question, WebLogic is not sticking a copy of the bean class.
              > Rather, it's the java compiler that you are using.
              >
              > Jun Ying
              > Meritsoft, Inc
              >
              >
              > "Michael Boudreau" <[email protected]> wrote in message
              > news:[email protected]...
              > > Hello,
              > >
              > > Well we ran into the same problem here at my company, and we have been
              > > pulling our hair out. I was reading through the jsp 1.1 spec, and
              > > thought I might try using the <jsp:useBean ...> tag instead of the <%@
              > > page import ...> tag. After careful inspection of the resulting .java
              > > file, I found that the <jsp:useBean ...> tag does not put insert any
              > > import statements, but simply declares the bean with the fully
              > > qualified package name. I am sure that this is not new news to anyone;
              > > however, the class cast exception went away (knock on wood, cross
              > > fingers, whatever).
              > >
              > > Basically, my statement looked like this:
              > > <jsp:useBean id="beanname" type="com.company.Class" scope="session" />
              > >
              > > My question is: is there something that I am missing or have not
              > > thought of? Because so far, this "seems" to be working, but I have
              > > been reading posts that say this does not work.
              > >
              > > Oh, one last quick note to BEA. While I was looking at the
              > > generated .java file from the jsp file, I found that weblogic's jspc is
              > > still generating getValue and setValue methods for HttpSession....
              > > which has been deprecated as of the servlet 2.2 spec.
              > >
              > > Michael
              > >
              > >
              > >
              > >
              > > Anish Parvataneni wrote:
              > >
              > > > Hi,
              > > >
              > > > I have a JSP which uses two different classes. Whenever, I change the
              > > > JSP and save it to recompile, there is a ClassCastException. ( I store
              > > > them in the session and load them) . Thats common ! The solution to
              this
              > > > as per documentation is to get rid of the classes in the workingDir of
              > > > JSP. However, I can find ONLY ONE of the classes in the workingDir. I
              > > > delete that class and the JSP works. I change the JSP , problem
              recurrs.
              > > >
              > > > 1. Why does weblogic stick a copy of the class in the workingDir,
              > > > everytime the JSP compiles, although it is available in the weblogic
              > > > classpath ?
              > > > 2. Why is it happening to only one of the classes I use in the JSP ?
              > > > 3. How can I make sure that this class is not available in the
              > > > workingDir, other than deleting it EVERYTIME.
              > > >
              > > > Thanks
              > > > Anish
              > >
              >
              >
              

  • JSP Compiler and CLASSPATH

     

    hi
              what u can do is add the classpath where ur beans are in pre_classes
              variable in startweblogic.bat file
              this way it works fine for us.
              Parag B.Bhagwat
              Olga Penina <[email protected]> wrote in message
              news:[email protected]...
              > I don't have this problem (in WL 4.5.1 at least)
              >
              > My servlets AND my beans are in weblogic.httpd.servlet.classpath
              >
              > Olga
              >
              > Developer <[email protected]> wrote in message
              > news:[email protected]...
              > > I have set the weblogic.httpd.servlet.classpath properties to the
              > > following directory: c:\weblogic\myserver\servlets. In addition to
              > > Servlets I have a number of JavaBeans that I use within my JSP pages.
              > > However, when WebLogic compiles my JSP pages it fails to find the beans
              > > located in the weblogic.httpd.servlet.classpath. To fix the problem I
              > > have to do away with the reloadable servlet classpath and put everything
              > > in the system classpath. This means I need to restart the server
              > > everytime and bean or servlet changes.
              > >
              > > Has anyone else run into this problem? I've worked with WebSphere and
              > > J/Run, and both products support this capability.
              > >
              > > Thanks,
              > >
              > > Thomas McAlees
              > > ObjectFrame Technologies, Inc.
              > > [email protected]
              > >
              > >
              > >
              >
              >
              

  • Compiling and running problems

    Dear Friends:
    I believe I encountered a very difficult situation when I try to run Fortran
    files in Sun Sparc Solaris 8.0.
    I would like to describe it, hopefully someone can give me some suggestions.
    The the files I try to run is fortran 77 files developed originally for VAX
    machine, later on there are Linux and Unix adaptions (but not for Sun
    Solaris). The source code is open source from the link:
    http://www.webmo.net/support/mopac_linux.html. I have compiled and run
    successfully in Redhat 9.0 (means same results as the samples). The linux
    dependency is gcc (or egcs) glibc (or libc) f2c.
    Also it is compatible with SGI IRIX unix system with the dependency MIPSpro Fortran 77 and MIPSpro C as the link http://www.webmo.net/support/mopac_sgi.html. I havenot tried it yet.
    In sun solaris, I have tried g77, but even cannot compiled. With Apogee's
    F77 (www.apogee.com), it can be compiled, but cannot run completely (terminate in the middle
    process, i.e. without the complete output as the samples).
    Could anyone take a time do a analysis and provide me any suggestions?
    thanks a lot,
    Justin

    Justin,
    I downloaded the mopac tarball and compiled it on Sun Solaris using the Sun Studio 10 compiler. The code compiles successfully with only a small change to the included Makefile.
    Change the original unix target as follows:
    unix:
         f77 -w -O -static *.f -o $(EXE)
    becomes
    unix:
         f90 -f77 -w -O *.f -o $(EXE)
    I noticed during the compilation that there were a number of BLAS and LAPACK routines that are being compiled into the application. The Sun Studio compilers include a high performance BLAS/LAPACK library called the Sun Performance Library which provides highly tuned versions of the BLAS/LAPACK routines called by this application. I would be more than happy to help you modify the source and makefile so that you can use these tuned routines and realize increased performance in this application.
    I ran several of the data sets in the examples directory and they appeared to complete successfully. Since none of them run for more than a second or so, it's hard to say whether or not the tuned Performance Library will have a large impact on the performance or not.
    If you are interested, please contact me : [email protected]

  • HTML Comments in a JSP Document

    I am writing a JSP Document that has a number of comments. Some I want to be server-side such as version history and some I want to be client-side.
    Using a JSP page this is easily achieved using JSP comments <%-- JSP comment for server-side --%> and HTML Comments<!-- HTML comment client-side -->.
    Using XML syntax a number of things are apparent:
    1. There is no XML equivalent of a JSP comment (this has been well doc'd for a long time).
    2. In the Java EE tutorials the recommended alternative to a JSP coomment is a HTML comment.
    3. Using HTML comments in a JSP document the web container omits these in the page output - and so they are server-side only just like a JSP comment.
    Code Snippet:
    <template xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" version="1.2">
    <!-- this comment will not appear in the generated source on the client browser -->
    </template>
    <!-- JSP fragment for no caching policy -->
    So, my question is how do I generate a client-side comment in a JSP Document?
    Thanks
    Edited by: DJT on Mar 3, 2008 4:28 AM
    Edited by: DJT on Mar 3, 2008 4:30 AM

    I found this ....
    http://www.javaworld.com/javaworld/jw-07-2003/jw-0725-morejsp.html
    One significant disadvantage of JSP documents is that no XML-compliant version of JSP comments exists. A JSP document developer can use client-side (HTML-/XML-style) comments or embed Java comments in scriptlets, but there is no JSP document equivalent to <%-- -->. This is a disadvantage because the other two commenting styles JSP documents can use have their own drawbacks. You can see the client-side comments in the rendered page using the browser's View Source option. The Java comments in scriptlets require placing Java code directly in the JSP document.
    So try to embed the HTML comment inside scriptlet tags...
    <%
    <!-- HTML comment here -->
    %>

  • EAR and long CLASSPATH at JSP compilation time

              Hi all,
              we have an EAR-packaged application with over 260 jars (mainly
              EJB) that is deployed to a managed server WL6.1SP3(AIX). Then
              we hit a JSP page of this app. and Weblogic generates the
              adecuate .java file that is passed as an argument to a forked
              process for the javac compiler with a CLASSPATH that is more
              than 22KB!! of length because of the EAR classloader schema
              (it must include all the jars of the EJB level).
              The problem is that the EAR deployment in WL6.1 generates a fixed and very long
              path for every jar that it is composed of:
              $WL_HOME/./config/DOMAIN/applications/.wl_notdelete_EARNAME
              /wlap#####/ejbjarname.jar
              and the invoke of the compiler fails with argument too long.
              We can control the EJB jar name, EARNAME, WL_HOME
              and DOMAIN to shorten the CLASSPATH, but that is not enough
              giving that the fixed part of the PATH is very long, for example:
              with DOMAIN=DOM1, WL_HOME=W, ejbjar name=EJB1, EARNAME=EAR1
              you get:
              /w/./config/DOM1/applications/.wl_notdelete_EAR1/wlap#####/EJB1.jar: that is
              68 chars * 260 jars = more than 17KB only with the
              EJB part of the CLASSPATH (plus the standard SYSTEM CLASSPATH
              and WARS CLASSPATH.)
              As workarounds we can:
              1.- Use an "pseudo exploded" EAR with EJBREMOTE and EJBHOME in clientclasses path
              with every jar and war by their own. Not very
              clean and we've lost the benefits of EAR deployment.
              2.- Consolidate a bunch of EJB in every jar. More administrative
              tasks (common xml descriptors:ejb-jar.xml,...) and less isolation
              between developer teams.
              3.- Consolidate at functionality level (source) a bunch of EJB
              in a few one. :(
              4.- Precompile every JSP outside of WEBLOGIC and generate
              the corresponding class and entries at web.xml and weblogic.xml
              5.- ...?
              or maybe:
              6.- configure this very long directory of deployment
              to a shorter deployer choosen and use relative paths.
              Is this possible? :)
              PacoG.
              

    You may try to use JSP compiler class. Please specify 'compilerclass'
              option in weblogic.xml. This option specifies name of a Java compiler
              that is executed in WebLogic Servers's virtual machine. (Used in place of
              an executable compiler such as javac or sj.)
              Please see
              http://e-docs.bea.com/wls/docs61/webapp/weblogic_xml.html#jsp-descriptor.
              Paco Garcia wrote:
              > oops!
              >
              > >$WL_HOME/./config/DOMAIN/applications/.wl_notdelete_EARNAME
              > >/wlap#####/ejbjarname.jar
              >
              > >with DOMAIN=DOM1, WL_HOME=W, ejbjar name=EJB1, EARNAME=EAR1
              > >you get:
              > >/w/./config/DOM1/applications/.wl_notdelete_EAR1/wlap#####/EJB1.jar:
              >
              > please read SERVERNAME instead of EARNAME
              >
              > PacoG.
              Regards,
              Ann
              Developer Relations Engineer
              BEA Support
              

  • Weblogic 9 and JSP compiler errors

    Hello everyone,
              I am having problems with my Jsps in my EAR file deployed on WL 9.0.
              I have a Jsp called upms.jsp that contains the following code snippets:
              After my import statements, I have some code that creates a resource bundle that accesses a properties file:
               <%!
                   ResourceBundle bundle = null;
                   public void jspInit() {
                   bundle = ResourceBundle.getBundle("conf.properties");
              %>
              I get an error from the above code:
              upms.jsp:3:11: 'try' statement has neither 'catch' nor 'finally' clause
                        import="java.util.ResourceBundle"
              ^----------------------^
              I am totally clueless as to what that error means.
              Next I declare a bean I use in the jsp:          
                   <jsp:useBean
                        id="userPrefsManagerBean"
              class="controllers.beans.UserPreferencesManagerBean"
                   scope="session">
                   </jsp:useBean>
                   <jsp:setProperty name="userPrefsManagerBean" property="*" />
              I get these errors from the above portion:
              upms.jsp:27:3: The qualifier of this name is a package, which cannot contain fields.
                   <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: The qualifier of this name is a package, which cannot contain fields.
                   <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Expression expected (found '.' instead)
                   <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Syntax error: expected ) (found 'class' instead)
                   <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Syntax error: expected <identifier> (found ')' instead)
                   <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              Has anyone encountered these before?
              This jsp worked perfectly well when I deployed my EAR file on JBoss...no such luck using Weblogic.
              Is there something I am missing here? I appreciate any help.
              Cheers, :-)
              M.

    Mildred,
              Two suggestions:
              1) use option weblogic.jspc's "-keepgenerated", you can keep the generated
              servlet's source code.
              Please paste it here.
              2) Can you create a simple reproducer(e.g. a war), and put it here, so that
              we can debug it and give more clues.
              To reproduce your issue, I write a simple a simple
              UserPreferencesManagerBean classs below :
              package controllers.beans;
              public class UserPreferencesManagerBean {
              private int p1;
              public void setP1(int p)
              p1 = p;
              public int getP1()
              return p1;
              But it works(oh, I run it under 910MP1).
              We cannot tell too much without your further information
              Thanks
              Leon
              <Mildred A> wrote in message news:[email protected]...
              I am still fighting with this issue.. Dang!
              I don't know what to change in my JSP because the WL JSP compiler errors are
              so out there..
              Here is the first portion of the JSP file:
              <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
              session="true"
              pageEncoding="ISO-8859-1"
              import="java.util.ArrayList"
              import="java.util.HashSet"
              import="java.util.Date"
              import="java.util.Collections"
              import="java.util.ResourceBundle"
              %>
              <%!
              ResourceBundle bundle = null;
              public void jspInit() {
              bundle = ResourceBundle.getBundle("conf.properties");
              %>
              <jsp:useBean
              id="userPrefsManagerBean"
              class="controllers.beans.UserPreferencesManagerBean"
              scope="session">
              </jsp:useBean>
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              Below is the error I get from this section alone (after precompiling):
              upms.jsp:3:11: 'try' statement has neither 'catch' nor 'finally' clause
              import="java.util.ArrayList"
              ^-----------------^
              upms.jsp:27:3: The qualifier of this name is a package, which cannot contain
              fields.
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: The qualifier of this name is a package, which cannot contain
              fields.
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Expression expected (found '.' instead)
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Syntax error: expected ) (found 'class' instead)
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Syntax error: expected <identifier> (found ')' instead)
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Expression expected (found 'catch' instead)
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Illegal use of an expression as a statement.
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: No variable or field with this name could be found at this
              location.
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: No variable or field with this name could be found at this
              location.
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Syntax error: expected ) (found '__ee' instead)
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Illegal use of an expression as a statement.
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Syntax error: expected ; (found ')' instead)
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: No variable or field with this name could be found at this
              location.
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: No variable or field with this name could be found at this
              location.
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              upms.jsp:27:3: Syntax error: expected } (found 'EOF' instead)
              <jsp:setProperty name="userPrefsManagerBean" property="*" />
              ^-------------^
              Can anyone see what I am doing wrong here? ?:| ?:|
              Cheers,
              M

  • HTML comments and scriptlets

    Hey,
    I have a question concerning the JSP specification and HTML comments (1.1 and 1.2):
    Code like this:
    <script language="JavaScript">
    <!--
    <%
    int a;
    if (true)
    a = 2;
    %>
    -->
    </script>
    <html>
    <body>
    <b>
    a = <%= a %>
    </b>
    </body>
    </html>
    prints print out:
    a = 2
    with Tomcat 4.0.x , but not with Orion 1.5.x. Orion ignores the scriptlet code within the HTML comment.
    Both blame to be JSP compliant in that respect. The specification says (1.1 chapter: 2.3; 1.2 chapter: 2.5):
    In order to generate comments that appear in the response output stream to the requesting
    client, the HTML and XML comment syntax is used, as follows:
    <!-- comments ... -->
    These comments are treated as uninterpreted template text by the JSP container. If the
    generated comment is to have dynamic data, this can be obtained through an expression
    syntax, as in:
    <!-- comments <%= expression %> more comments ... -->
    Now, does this mean JSP scriptlets (<% scriptlet %>) in HTML comments are ignored or not?

    This is a known bug in the Orion server; using the Oracle Containers for J2EE, which is the Orion server under license, I often have to deal with the same problem.
    Either don't remark out your JavaScript files, or place your HTML remarks inside JSP remarks so the Orion server can parse it correctly:
    <script language="JavaScript">
    <%="<!--"%>
    <%
    int a;
    if (true)
    a = 2;
    %>
    <%="-->"%>
    </script>

  • Urgent Solution needed--Problem in JSP compilation with JDK 1.5 and JDK 1.6

    Hi,
    I m using JDK 1.5 and Tomcat 5.0 the problem is that after starting server when I m going to access my application at that time instead of displaying HomePage it directly display the blank page on screen.
    After analyzing tomcat log I have found that there was a problem with JSP page compilation.
    The exception logged in Tomcat Log is given below
    An error occurred at line: 1 in the generated java file
    The type Collection is not generic; it cannot be parameterized with arguments <? extends E>
    Stacktrace:
    *     at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)*
    *     at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)*
    *     at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)*
    *     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)*
    *     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)*
    *     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)*
    *     at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)*
    *     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)*
    *     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)*
    *     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)*
    *     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*
    *     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)*
    *     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)*
    *     at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)*
    *     at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)*
    *     at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)*
    *     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)*
    *     at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)*
    *     at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:343)*
    *     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:144)*
    *     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)*
    *     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)*
    *     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)*
    *     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)*
    *     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)*
    *     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)*
    *     at java.lang.Thread.run(Thread.java:619)*
    After getting this kind of error I have analyzed my code furhter then I came to know that there was problem with static include tag.
    In my jsp page I have used following line which is the main cause of error
    <%@ include file="top.jsp" %>If I ommit this line then it is working properly.
    Instead of static include I have used jsp:include also.
    Still I m getting same problem.
    We have to migrated from JDK 1.5 to 1.6 and Tomcat 5.0.28 to 6.0.14, still same problem is there.
    We have tried a lot but didnt get success to overcome this problem.
    If anybody having any solution then ur each reply will be appreciated.
    Thanks in advance..........!!!!!!!
    Edited by: JBOSS2000 on Jan 15, 2008 9:29 AM

    Hi "mshanu" and "amit" Thanks for ur replies Here I m posting the code of "top.jsp"........!!!!
    <%@ page errorPage="errordisplay.jsp"%>
    <table cellpadding="0"
           cellspacing="0"  height=50 width=780>
           <tbody>
             <tr class="header">
               <td class="logo"><IMG SRC="assets/Logo.gif" BORDER=0 ALIGN=top></td>
               <td align="right"><span class="applicationtitle"><%@ include file="/contents/logo.htm" %></span><br>
               <span class="companyname"><%@ include file="/contents/companyname.htm" %></span></td>
             </tr>
            </tbody>
    </table>To include top.jsp I have tried
    <jsp:include page="top.jsp" flush="true">
    </jsp:include>
             AND       
    <%@ include file="top.jsp"%>but none of this worked.
    If I remove the include then It is working properly.
    But I need inluded file too so that I am wondoring for the solution.
    This problem seems very wiered to me. I dont know why it is happening.
    This problem is started only when I used the TOMCAT 6.14.
    Is it the bug of TOMCAT 6.14 or What somebody Plz help.
    I got stuck here.........!!!!!!!!!!
    It doesn't seem any problem with top.jsp. As per my thinking the problem is there in include due to that it doesn't compile the JSP page in Tomcat 6.0.
    Earlier I am having same code running on the Tomcat 5.0.28 and JDK 1.5.0.
    But problem occured when I have used Tomcat 6.x...!!

  • How to upload an html file using jsp and jdbc

    Hi,
    im trying to upload an html page using JSP and jdbc. but of no success.
    my aim is to keep some important html pages in the database.the file size can vary.the file has to be selected from a local machine (through the browser) and uploaded to a remote machine(where the databse resides).
    any help/sample code or pointer to any helpful link is appreciated.
    thanks in advance
    javajar2003

    When uploading a file, I use a byte array as a temporary buffer..
    So, you should then be able to store the byte array in the
    database as binary data.
    example>
    //Temporary Buffer To Store File
    byte[] tmpbuffer = new byte[860];
    //Some Code To Upload File...
    //File Should Now Be In Byte Array
    //Get DB Connection and execute Prepared Statement
    Connection con=//GET DB CONNECTION;
    String sql=insert into TABLE(page) values(?);
    PreparedStatement ps=con.prepareStatement(sql);
    ps.setBytes(1,tempbuffer);
    ps.executeUpdate();
    //Close PS and Free DB Connection
    ..... and this method looks like you dont even have
    to store the file in a byte array, you can just give
    it the input stream.
    ps.setBinaryStream(int, inputStream, int);
    You may have to make several attempts at this. I have
    uploaded a file and temporarily stored it in a byte array,
    but have never from there stored it in the DB as binary
    data.. but this looks like it'll work.
    Good Luck!

  • Compiling and running jsp-code on the fly.

    I am intending to use jsp as a report engine. The 'templates' should be jsp-code stored in the db, loaded and executed as if they where inside a plain jsp-file in the application. I cannot write new files on the file system since this is prohibited on the production env - so I would like to compile and execute the jsp-code directly in memory.
    Was hoping this could be done with the jee standard stack.
    Does anybode know how to to this, if possible?

    If you just want to run java applications, you just need the JRE: J2SE 5.0 JRE
    If you want to compile java source code, you need the JDK: J2SE 5.0 JDK
    It includes also the JRE. Recommended is also the J2SE 5.0 Documentation that contains the javadoc API that describes all the Java classes.
    To start develeoping I recommend the Java Tutorial: http://java.sun.com/docs/books/tutorial/

  • URGENT: sp6 and JSP compiling/classpath problem?

    Hi,
              We installed sp6 on our production site a little over a week and started
              seeing this problem on our logs with regards to any JSP with an include tag,
              such as:
              <%@ include file="/inc/insideHeadTag.jsp" %>
              INTERMITTENTLY, we will get the following error in the page on the client
              side at runtime:
              < ! -- cannot include file '/inc/insideHeadTag.jsp', resource not
              found -- >
              I grepped this newsgroup and noticed a previous unanswered post of the same
              nature, "Static compiles do not seem to include JSP's". Except in our case,
              this problem also manifest for dynamic JSP compiles, happens sporatically,
              and only started with sp6.
              Bug???
              Gene Chuang
              Join Kiko.com!
              

              Just to clarify - I'm not from BEA, I'm from EA - short a letter.
              As far as I know, there is no synchronization between WL instances in a cluster regarding the
              the compiling of JSPs. So when you start up two WL instances that share the same workingDir,
              and each WL instances gets a hit on your shiny new index.jsp, they both need to compile it. So the first
              one compiles it and writes index.class, the second does the same, overwriting the first _index.class,
              possibly at the same time that the first instance is trying to load _index.class into memory. And you
              get a mysterious 'class not found' error. Not likely, but possible.
              "Gene Chuang" <[email protected]> wrote:
              >Hmm, interesting... I thought Weblogic strongly recommends clustered
              >servers sharing the same file system?
              >
              >So you're saying the system-wide, cluster and node specific directories can
              >reside on the shared drive, but workingDirs should reside on local drives?
              >
              >--
              >Gene Chuang
              >Join Kiko.com!
              >
              >"Mike Reiche" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> Make sure that your WLS instances are NOT sharing the workingDir. If two
              >instances
              >> try to compile the same JSP at the same time, bad things can happen.
              >>
              >> Mike
              >>
              >> "Gene Chuang" <[email protected]> wrote:
              >> >Hi Jong,
              >> >
              >> >Thanks for the reply; but I wish the solution is as simple as that.
              >Yes,
              >> >my .jsps are in the proper directory. They have been working properly
              >for
              >> >the past 6 months, since we were running WL 4.5.1. Only when I switched
              >to
              >> >WL 5.1 sp6 did this bug start showing up. Plus, like I said in my
              >original
              >> >post, this bug is sporatic. SOMETIMES the included jsp is found by
              >Weblogic
              >> >and the includer jsp compiles correctly; other times it isn't found and
              >the
              >> >includer jsp leaves a gap! What's going on?
              >> >
              >> >We are running clustered web servers in Solaris 2.7 with a shared file
              >> >system. This sporatic behavior may be because some nodes aren't working
              >> >properly???
              >> >
              >> >--
              >> >Gene Chuang
              >> >Join Kiko.com!
              >> >
              >> >"Jong Lee" <[email protected]> wrote in message
              >> >news:[email protected]...
              >> >>
              >> >> "Gene Chuang" <[email protected]> wrote:
              >> >> >Hi,
              >> >> >
              >> >> >We installed sp6 on our production site a little over a week and
              >started
              >> >> >seeing this problem on our logs with regards to any JSP with an
              >include
              >> >tag,
              >> >> >such as:
              >> >> I assumed insideHeadTag.jsp is in
              >> >> YOUR_DOCUMENT_ROOT/inc/insideHeadTag.jsp
              >> >>
              >> >> if you haven't read the spec of relative URI please do so:
              >> >> jsp spec 1.1 - section 2.5.2
              >> >>
              >> >> Jong
              >> >>
              >> >> >
              >> >> > <%@ include file="/inc/insideHeadTag.jsp" %>
              >> >> >
              >> >> >INTERMITTENTLY, we will get the following error in the page on the
              >client
              >> >> >side at runtime:
              >> >> >
              >> >> > < ! -- cannot include file '/inc/insideHeadTag.jsp', resource not
              >> >> >found -- >
              >> >> >
              >> >> >I grepped this newsgroup and noticed a previous unanswered post of the
              >> >same
              >> >> >nature, "Static compiles do not seem to include JSP's". Except in our
              >> >case,
              >> >> >this problem also manifest for dynamic JSP compiles, happens
              >> >sporatically,
              >> >> >and only started with sp6.
              >> >> >
              >> >> >Bug???
              >> >> >
              >> >> >Gene Chuang
              >> >> >Join Kiko.com!
              >> >> >
              >> >> >
              >> >> >
              >> >>
              >> >
              >> >
              >>
              >
              >
              

  • Java compilation and running within jsp page

    hi,
    i need of a jsp page that has a textarea in which the java coding are entered and this coding is compiled and executed. The execution result is printed.
    Please guide me.

    I don't think you can invoke java compiler or run time environment at client side (browser). Even if you use applet, i think you will not be able to do it at client side. Moreover, though java virtual machine will be available in your target user's browser, but you should not expect a java compiler in users machine.
    I have seen exam sites where they have added java code compilation and execution ability. To achieve this you can do:
    1. In your JSP page use text area where user can edit java code.
    2. Provide two buttons - 'Compile' and 'Run'.
    3. On click of 'Compile' send the code to server side. In server machine create a file in a temporary location in disk and save the code content received from client.
    4. Invoke 'javac' command (as a separate process) to compile the java class created in step 3. This process will give you error/output back which you can send back to user.
    5. In case of 'Run' you must first invoke above mentioned 'Compile' service and then another service ('Run') to actually run you java class. You can build 'Run' service in similar way.
    Here you challenge would be managing multiple client requests (to compile and run java class) at the same time.
    Code to compile and run java classes:
    import java.io.*;
    * A class to compile and run java classes.
    * @author Mrityunjoy Saha
    public class JavaProcessor{
         public static void main(String[] args){
              // Option 1 to compile and option 2 to run.
              int option=1;
              if(args.length > 0){
                   option=Integer.parseInt(args[0]);
              JavaProcessor p=new JavaProcessor();
              if(option==1){
                   p.compile();
              } else {
                   p.run();
         public void run(){
              String file="FoodTest";
              String directory="C:/Users/mrityunjoy_saha/Documents/Test";     
              executeCommand("java", directory, file);
         public void compile(){
              String file="FoodTest.java";
              String directory="C:/Users/mrityunjoy_saha/Documents/Test";     
              executeCommand("javac", directory, file);
         public void executeCommand(String command, String directory, String file){
              try{
                   String[] envp=null;
                   // Make sure that you have done Java setup in your machine.
                   // To test this try invoking javac command in command prompt.
                   Process p=Runtime.getRuntime().exec(command+" "+file,envp,new File(directory));
                   BufferedReader errorStream=new BufferedReader(new InputStreamReader(p.getErrorStream()));
                   String readData="";
                   while((readData=errorStream.readLine())!=null){
                        System.out.println(readData);
                   BufferedReader outStream=new BufferedReader(new InputStreamReader(p.getInputStream()));
                   readData="";
                   while((readData=outStream.readLine())!=null){
                        System.out.println(readData);
              catch(IOException ioe){
                   ioe.printStackTrace();
    }Thanks,
    Mrityunjoy

  • JSP Servlet and convert the result set of an SQL Query To XML file

    Hi all
    I have a problem to export my SQL query is resulty into an XML file I had fixed my servlet and JSP so that i can display all the records into my database and that the goal .Now I want to get the result set into JSP so that i can create an XML file from that result set from the jsp code.
    thisis my servlet which will call the jsp page and the jsp just behind it.
    //this is the servlet
    import java.io.*;
    import java.lang.reflect.Array;
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.naming.*;
    import javax.sql.*;
    public *class *Campaign *extends *HttpServlet
    *private* *final* *static* Logger +log+ = Logger.+getLogger+(Campaign.*class*.getName());
    *private* *final* *static* String +DATASOURCE_NAME+ = "jdbc/SampleDB";
    *private* DataSource _dataSource;
    *public* *void* setDataSource(DataSource dataSource)
    _dataSource = dataSource;
    *public* DataSource getDataSource()
    *return* _dataSource;
    *public* *void* init()
    *throws* ServletException
    *if* (_dataSource == *null*) {
    *try* {
    Context env = (Context) *new* InitialContext().lookup("java:comp/env");
    _dataSource = (DataSource) env.lookup(+DATASOURCE_NAME+);
    *if* (_dataSource == *null*)
    *throw* *new* ServletException("`" + +DATASOURCE_NAME+ + "' is an unknown DataSource");
    } *catch* (NamingException e) {
    *throw* *new* ServletException(e);
    protected *void *doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    Connection conn = *null*;
    *try* {
    conn = getDataSource().getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select post_id,comments,postname from app.posts");
    // out.println("Le r&eacute;sultat :<br>");
    ArrayList <String> Lescomments= *new* ArrayList<String>();
    ArrayList <String> Lesidentifiant = *new* ArrayList<String>();
    ArrayList <String> Lesnoms = *new* ArrayList <String>();
    *while* (rs.next()) {
    Lescomments.add(rs.getString("comments"));
    request.setAttribute("comments",Lescomments);
    Lesidentifiant.add(rs.getString("post_id"));
    request.setAttribute("id",Lesidentifiant);
    Lesnoms.add(rs.getString("postname"));
    request.setAttribute("nom",Lesnoms);
    rs.close();
    stmt.close();
    *catch* (SQLException e) {
    *finally* {
    *try* {
    *if* (conn != *null*)
    conn.close();
    *catch* (SQLException e) {
    // les param&egrave;tres sont corrects - on envoie la page r&eacute;ponse
    getServletContext().getRequestDispatcher("/Campaign.jsp").forward(request,response);
    }///end of servlet
    }///this is the jsp page called
    <%@ page import="java.util.ArrayList" %>
    <%
    // on r&eacute;cup&egrave;re les donn&eacute;es
    ArrayList nom=(ArrayList)request.getAttribute("nom");
    ArrayList id=(ArrayList)request.getAttribute("id");
    ArrayList comments=(ArrayList) request.getAttribute("comments");
    %>
    <html>
    <head>
    <title></title>
    </head>
    <body>
    Liste des campagnes here i will create the xml file the problem is to display all rows
    <hr>
    <table>
    <tr>
    </tr>
    <tr>
    <td>Comment</td>
    <td>
    <%
    for( int i=0;i<comments.size();i++){
    out.print("<li>" + (String) comments.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>nom</td>
    <td>
    <%
    for( int i=0;i<nom.size();i++){
    out.print("<li>" + (String) nom.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>id</td>
    <td>
    <%
    for( int i=0;i<id.size();i++){
    out.print("<li>" + (String) id.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    </table>
    </body>
    </html>
    This is how i used to create an XML file in a JSP page only without JSP/SERVLET concept:
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%
    // Identify a carriage return character for each output line
    int iLf = 10;
    char cLf = (*char*)iLf;
    // Create a new empty binary file, which will content XML output
    File outputFile = *new* File("C:\\Users\\user\\workspace1\\demo\\WebContent\\YourFileName.xml");
    //outputFile.createNewFile();
    FileWriter outfile = *new* FileWriter(outputFile);
    // the header for XML file
    outfile.write("<?xml version='1.0' encoding='ISO-8859-1'?>"+cLf);
    try {
    // Define connection string and make a connection to database
    Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/SAMPLE","app","app");
    Statement stat = conn.createStatement();
    // Create a recordset
    ResultSet rset = stat.executeQuery("Select * From posts");
    // Expecting at least one record
    *if*( !rset.next() ) {
    *throw* *new* IllegalArgumentException("No data found for the posts table");
    outfile.write("<Table>"+cLf);
    // Parse our recordset
    // Parse our recordset
    *while*(rset.next()) {
    outfile.write("<posts>"+cLf);
    outfile.write("<postname>" + rset.getString("postname") +"</postname>"+cLf);
    outfile.write("<comments>" + rset.getString("comments") +"</comments>"+cLf);
    outfile.write("</posts>"+cLf);
    outfile.write("</Table>"+cLf);
    // Everything must be closed
    rset.close();
    stat.close();
    conn.close();
    outfile.close();
    catch( Exception er ) {
    %>

    Please state your problem that you are having more clearly so we can help.
    I looked at your code I here are a few things you might consider:
    It looks like you are putting freely typed-in comments from end-users into an xml document.
    The problem with this is that the user may enter characters in his text that have special meaning
    to xml and will have to be escaped correctly. Some of these characters are less than character, greater than character and ampersand character.
    You may also have a similiar problem displaying them on your JSP page since there may be special characters that JSP has.
    You will have to read up on how to deal with these special characters (I dont remember what the rules are). I seem to recall
    if you use CDATA in your xml, you dont have to deal with those characters (I may be wrong).
    When you finish writing your code, test it by entering all keyboard characters to make sure they are processed, stored in the database,
    and re-displayed correctly.
    Also, it looks like you are putting business logic in your JSP page (creating an xml file).
    The JSP page is for displaying data ONLY and submitting back to a servlet. Put all your business logic in the servlet. Putting business logic in JSP is considered bad coding and will cause you many hours of headache trying to debug it. Also note: java scriptlets in a JSP page are only run when the JSP page is compiled into a servlet by java. It does not run after its compiled and therefore you cant call java functions after the JSP page is displayed to the client.

Maybe you are looking for