'session' is undefined - javascript error in my JSF/JSP page

I have the following JSF/JSP page. In onLoad() I invoke a javascript function func(). In this method, I attempt to lookup an attribute from the Http Session. When I run my application, my page is loaded with but the icon on the lower left corner of the browser indicated that there was an error. When I viewed the error, it read : 'session' is undefined.
The 'session' variable is available in a JSP page.
So why does my code not work from within a JSF application.
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:ui="http://www.sun.com/web/ui">
    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>   
    <f:view>
        <ui:page binding="#{bean.page1}" id="page1">
            <ui:html binding="#{bean.html1}" id="html1">
                <ui:head binding="#{bean.head1}" id="head1">
                    </ui:head>
                <ui:body binding="#{bean.body1}" onLoad="func()" id="body1" style="-rave-layout: grid">
                    <ui:form binding="#{bean.form1}" id="form1">                       
                        <h:inputText binding="#{bean.inputText}" id="inputText"/>
                    </ui:form>
                </ui:body>
            </ui:html>
        </ui:page>
    </f:view>
    <script type="text/javascript">
        function func(){                  
                alert("in func()");
                var y = session.getAttribute("test");
                alert(y);
    </script>
</jsp:root>thanks,
tsc

Because :
Session.getAtrribute is java-code that can only run on the server
and
var y = session.getAttribute is javascript-code run on the client.

Similar Messages

  • Session in JSF JSP page

    Hi All,
    I am using JSF JSP pages. One such page is login.jsp I have backing object backing_login
    On successful login, listUser.jsp page is displayed. In this page, I have a HTML --- Commons Hyperlink component as follows.
      <tr>
                  <td height="17">
                    <a href="http://129.212.139.36:8991/GeminiLogin-ViewController-context-root/faces/listUsers.jsp">
                      Manage Users
                    </a>
                    <afh:script binding="#{backing_createModify.script1}"
                                id="script1"/>
                  </td>
                </tr>
    Now the question:---
    I do get to know the UserType in the backing_login object (either 'cma' or 'ea').
    Now, if it is cma I want the above link tobe dispalyed in listUser.jsp else DO NOT display the link.
    How can I do that ? I dont know, how to pass UserType information available in baking_login to the listUser.jsp and
    second, how can conditionally use that info to either hide or display that hyperlink ?
    Your help appreaciated.
    thanks in advance
    pp

    You can use an ADF Faces link component and condition the display attribute for it on the value of your backing bean
    There are some samples of conditional display in the posts from Grant here:
    http://groundside.com/blog/GrantRonald.php?m=200512

  • Create jsf jsp page / page implementation / third option is not visible

    The third option (check box) for page implementation settings in the create jsf jsp page is not visible. The window is not resizable.

    I see the option radio button and text "Automatically Expose UI Components in an Existing Managed Bean" that is disabled but i see only partially the label what is a disabled input text field i suppose just below the radio button.
    I see also the Directory input field and Browse button a little bit truncated at the bottom (1-2 pixels missing).
    I see also the Render in Mobile Device check box and combo box ... cutted by the half when i expand the page implementation part.
    As said the window is not resizable.
    Let me know a location i can send you a hard copy of the screen.

  • Error  while parsing JSF jspx page when including javascript  loops

    Hi All,
    I have a jspx document which contains jsf tags including trinidad tags. I have added a javascript function in the page, which contains a for loop statement, however when I run the page I get an error
    com.sun.facelets.FaceletException: Error Parsing /xAdvisorWeb/bundles/receivetask/manageinbox.jspx: Error Traced[line: 48] The content of elements must consist of well-formed character data or markup.
    at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)
    at com.sun.facelets.compiler.Compiler.compile(Compiler.java:104)
    at com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:192)
    at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:141)
    at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:93)
    at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:503)
    at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:553)
    at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:178)
    at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:995)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:930)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:326)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:290)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:213)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:90)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:761)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:673)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:498)
    at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
    Please note that normal javascript code has worked in my jsf page, this problem only occurs only when I add for loop or while loop in the javascript function. Can we not add javascript loops in a jsf page? Is there something else I need to include?
    This is the relevant code snippet :
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:tr="http://myfaces.apache.org/trinidad"
    xmlns:ch="http://www.chordiant.com/jsf"
    xmlns:chrd="http://chordiant.com/jsf/chrd">
    <f:view locale="#{preferLocale.locale}">
    <f:verbatim escape="true">
    <script>
    function validateInput(){
    for(int i=0;i<3;i++)
    alert('Hi');
    return false;
    </script>
    </f:verbatim>
    <tr:commandLink styleClass="ttmBtnCmdLink" onclick="return validateInput();"
    action="#{manageInbox.executeTaskForAssignedWorkItems}">
    <tr:outputText value="#{msgs.execute_btn}"
    styleClass="ttmBtnOutTxt" />
    </tr:commandLink>
    Any help will be much appreciated.
    Thanks in advance,
    Debajyoti

    M-Y wrote:
    replace "<" with "& l t ;"
    remove spaces in "& l t ;" when u paste it in ur code
    in my previous 2 replies i entered it with out spaces and it was getting converted to "<"The forum engine parses HTML entities. So just replace the & by its HTML entity &amp; and it will work: &lt;.
    But no, this is not going to work. JavaScript doesn't recognize HTML entities as operators.
    Follow the suggestion rlubke gave. Or, even better, put all Javascripts in its own .js file and include this file in the HTML head.

  • "getting a javascript error while validating a JSP"

    Hi folks,
    Someone help me out with this problem.
    I am getting a javascript validation error when I am trying to validate a JSP.
    if(eval("document.frmAdminSowAssignValues.chkSowEmployee"+i).checked)
    If I try to load a JSP page on a browser, it is giving a javascript error as
    "'checked' is null or not a object".
    Thanks.

    Hi Manoj,
    Thanks for posting here.
    I suggest you to clear all cookies and restart your IE. Let us know the results.
    Also, I suggest you to try lauching Azure portal on a different browsers such as Firefox, Safari etc.
    Girish Prajwal

  • Error when compiling JSF JSP

    I'm getting the following error when I try to compile an application containing a JSF JSP in JDeveloper 10.1.3. The error is:
    Error: java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
    I've checked the files in the classpath and the TagAttributeInfo class is located in <install>/j2ee/home/lib/servlet.jar. I decompiled the class and it does have a constructor that takes (String, boolean, String, boolean, boolean).
    The only change I made between when things worked and now is that I tried to add a JSF JSP that used the ADF classes. But once I started getting this compilation error, I removed the ADF classes from the project, so they shouldn't be causing any problems anymore.
    Any ideas what's wrong?
    Thanks

    Hello,
    May be that your classpath doesn't include that location ?
    Have you tried to put the TagAttributeInfo.class file into your current folder
    (or may be in ..\<your_project>\Classes\.. path ) ?
    To check if your classpath does actually include your path, you could run:
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Dummy JSP-CLASSPATH</title>
    </head>
    <body>
    <%
    out.println("<h1><em>JSP Showing your CLASSPATH</h1></em>");
    out.println("<hr></hr><p>");
    out.println(System.getProperty("java.class.path"));
    %>
    </body>
    </html>
    Hope this will help you.
    Stephan

  • Error While opening a JSP page from inside form window

    Hi,
    I am using Oracle EBS 12.0.4 and using IE 7 as my browser.
    Now when i am trying to open a jsp page form EBS Home page (after login) it is opening perfectly.The problem occurs when i tried to open jsp pages from inside form window.
    E.g. From the home page when i tried to open a jsp page "Control Purchasing Periods" which is assigned in one of our custom responsibility(Manager Systems-->PO Super User-->Set up-->Financials-->Accounting-->Control Purchasing Periods) it opens a new log in page for the EBS. When i logged in it is showing
    Error
    You have insufficient privileges for the current operation. Please contact your System Administrator. Same is happening when i am trying to open User Page form user management responsibility from inside a form window.Where as it is opening fine from home page.
    Please help.

    Hi, hueesin
    in error log i got this 4 new lines while performing the transaction from my host
    [Thu Dec 30 13:27:39 2010] [error] [client 172.16.6.144] [ecid: 1293695859:172.16.48.61:25634:0:8748,0] Directory index forbidden by rule: /dev02/KMCTEST/apps/apps_st/comn/java/classes/
    [Thu Dec 30 13:27:40 2010] [error] [client 172.16.6.144] [ecid: 1293695860:172.16.48.61:25328:0:8829,0] Directory index forbidden by rule: /dev02/KMCTEST/apps/apps_st/comn/java/classes/
    [Thu Dec 30 13:28:06 2010] [error] [client 172.16.6.144] [ecid: 1293695886:172.16.48.61:25654:0:9225,0] File does not exist: /dev02/KMCTEST/apps/apps_st/comn/java/classes/oracle/forms/engine/RunformBundle_en_IN.class
    [Thu Dec 30 13:28:06 2010] [error] [client 172.16.6.144] [ecid: 1293695886:172.16.48.61:25654:0:9226,0] File does not exist: /dev02/KMCTEST/apps/apps_st/comn/java/classes/oracle/forms/engine/RunformBundle_en_IN.propertieswhile in access log i got
    172.16.6.144 - - [30/Dec/2010:13:32:51 +0530] "POST /OA_HTML/OA.jsp?page=/oracle/apps/fnd/sso/login/webui/MainLoginPG&_ri=0&_ti=587084970&language_code=US&requestUrl=http%3A%2F%2Fkmctapp2.kmc.com%3A8005%2FOA_HTML%2FRF.jsp%3Ffunction_id%3D2014%26resp_id%3D50670%26resp_appl_id%3D7000%26security_group_id%3D0%26lang_code%3DUS%26params%3Df7B5hnH8rkFfR.idy0MT1JZrquJxVBy3CVpSV.GpXc0%26oas%3DAuZa28Bnhl7glqYyqXbjsg..&cancelUrl=http%3A%2F%2Fkmctapp2.kmc.com%3A8005%2FOA_HTML%2FAppsLogin&langCode=US&oapc=2&oas=rucHEnmoEQ25-3xRNnl0ZA.. HTTP/1.1" 302 708 1 "http://kmctapp2.kmc.com:8005/OA_HTML/RF.jsp?function_id=28636&resp_id=-1&resp_appl_id=-1&security_group_id=0&lang_code=US&params=Br702.NFW.nrlg1EodytbsK-Dc1k9ERgGeColziC.cPOIi7hiyjaPiR6AJ7.Lk4IUbiFt8MZ-sww1yPk9nLXIYqdPHfttMeywkt5IQhVsrG8Y9M-0CrrcAU8ZntmtaFjlkc2vXbUaot6TQpdqAPHJyaJn6YLsew516hhfiB2xemOmo6e-.WpPrlXfvBQG.XVr-Z8y-V4uRkwwHgWHTK.ju6jLsF35BmqTRszq39cgoHe38QZqjtonDRWgTFzvxooOAmX1EHPfxfMz88uKnVWnnzU-4996ZD8e3X0Dagp19gjOYgefJlT1fTUaFvMo3cP.-7Ypt0s4Cck.GhdFOnHRK1Ok6KdvnjFyjK-WHCy4ZHCvw3NZPREYBngqJc4gvnDziIu4Yso2j4kegCe-i5OCFG4hbfDGf7MMNcj5PZy1yFwJ8GIMHyNmCAg9Yo1bXn5cTHOy7xYWHyOD5.ax3JG6Q&oas=W0vxAqkroMB_7DgeNPZhYw.." "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)"
    172.16.6.144 - - [30/Dec/2010:13:32:51 +0530] "GET /OA_HTML/RF.jsp?function_id=2014&resp_id=50670&resp_appl_id=7000&security_group_id=0&lang_code=US&params=f7B5hnH8rkFfR.idy0MT1JZrquJxVBy3CVpSV.GpXc0&oas=AuZa28Bnhl7glqYyqXbjsg.. HTTP/1.1" 200 7534 0 "http://kmctapp2.kmc.com:8005/OA_HTML/RF.jsp?function_id=28636&resp_id=-1&resp_appl_id=-1&security_group_id=0&lang_code=US&params=Br702.NFW.nrlg1EodytbsK-Dc1k9ERgGeColziC.cPOIi7hiyjaPiR6AJ7.Lk4IUbiFt8MZ-sww1yPk9nLXIYqdPHfttMeywkt5IQhVsrG8Y9M-0CrrcAU8ZntmtaFjlkc2vXbUaot6TQpdqAPHJyaJn6YLsew516hhfiB2xemOmo6e-.WpPrlXfvBQG.XVr-Z8y-V4uRkwwHgWHTK.ju6jLsF35BmqTRszq39cgoHe38QZqjtonDRWgTFzvxooOAmX1EHPfxfMz88uKnVWnnzU-4996ZD8e3X0Dagp19gjOYgefJlT1fTUaFvMo3cP.-7Ypt0s4Cck.GhdFOnHRK1Ok6KdvnjFyjK-WHCy4ZHCvw3NZPREYBngqJc4gvnDziIu4Yso2j4kegCe-i5OCFG4hbfDGf7MMNcj5PZy1yFwJ8GIMHyNmCAg9Yo1bXn5cTHOy7xYWHyOD5.ax3JG6Q&oas=W0vxAqkroMB_7DgeNPZhYw.." "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)"
    172.16.6.144 - - [30/Dec/2010:13:32:51 +0530] "GET /OA_HTML/cabo/images/swan/t.gif HTTP/1.1" 304 0 0 "http://kmctapp2.kmc.com:8005/OA_HTML/RF.jsp?function_id=2014&resp_id=50670&resp_appl_id=7000&security_group_id=0&lang_code=US&params=f7B5hnH8rkFfR.idy0MT1JZrquJxVBy3CVpSV.GpXc0&oas=AuZa28Bnhl7glqYyqXbjsg.." "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)"
    172.16.6.144 - - [30/Dec/2010:13:32:51 +0530] "GET /OA_HTML/cabo/images/swan/errorl.gif HTTP/1.1" 304 0 0 "http://kmctapp2.kmc.com:8005/OA_HTML/RF.jsp?function_id=2014&resp_id=50670&resp_appl_id=7000&security_group_id=0&lang_code=US&params=f7B5hnH8rkFfR.idy0MT1JZrquJxVBy3CVpSV.GpXc0&oas=AuZa28Bnhl7glqYyqXbjsg.." "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)"
    172.16.6.144 - - [30/Dec/2010:13:32:51 +0530] "GET /OA_HTML/cabo/images/swan/navBarUnderTopTabsBg.gif HTTP/1.1" 304 0 0 "http://kmctapp2.kmc.com:8005/OA_HTML/RF.jsp?function_id=2014&resp_id=50670&resp_appl_id=7000&security_group_id=0&lang_code=US&params=f7B5hnH8rkFfR.idy0MT1JZrquJxVBy3CVpSV.GpXc0&oas=AuZa28Bnhl7glqYyqXbjsg.." "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)"
    172.16.6.144 - - [30/Dec/2010:13:32:51 +0530] "GET /OA_HTML/cabo/images/swan/footerBg.gif HTTP/1.1" 304 0 0 "http://kmctapp2.kmc.com:8005/OA_HTML/RF.jsp?function_id=2014&resp_id=50670&resp_appl_id=7000&security_group_id=0&lang_code=US&params=f7B5hnH8rkFfR.idy0MT1JZrquJxVBy3CVpSV.GpXc0&oas=AuZa28Bnhl7glqYyqXbjsg.." "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)"

  • Error while running a jsp page : "jasper run time error"

    hii
    I'm facing trouble while running some jsp page . the error is as follows:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:414)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK
         org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:106)
         org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
         org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
    Apache Tomcat/5.0.28
    The set up in my system (path set up is as follows):
    Catalina home: C:\ apache software foundation\Tomcat 5.0
    Classpath: %java_home%;C:\j2sdk1.4.2_03\bin;
    Javahome: C:\ j2sdk1.4.2_03\jre;
    path: C:\ j2sdk1.4.2_03\bin
    <there are other variables available in path, along with that I have added the j2sdk1.4.2_03\bin in path".
    So if u have any way out for it please let me know.

    I think you only need to add: c:\j2sdk1.4.2_01
    you have specified jre on the end of your path, it is not the jre that is required, but the jdk.
    If you are using startup.bat and shutdown.bat (or .sh on Linux) you can amend the files with a text editor (open the startup.bat in notepad), like so:
    @echo off
    set JAVA_HOME=c:\j2sdk1.4.2_01
    if "%OS%" == "Windows_NT" setlocal
    I this will start Tomcat with the correct settings, regardless of your environment settings.

  • Error when deploy a jsp page which includes customizable component

    Hi all,
    I add a customizable component to my jsp page. It works fine on local but when I deploy it and run the deployment I get the error below:
    500 Internal Server Error
    OracleJSP:
    JSP Error:
    Request URI:/islistesi/DevamEdenIsler.jspx
    Exception:
    java.lang.IllegalStateException: ClassLoader "islistesi.web.islistesi:0.0.0" (from <web-module> in /oc4j/webcenter/j2ee/home/applications/islistesi/islistesi/): This loader has been closed and should not be in use.
    anyone who has an idea?
    thanks a lot in advance

    Did you define a web.xml and application.xml file for the deployment of your application?
    Are you using deployment profiles to configure your application on a standalone OC4J?

  • JSP on BEA  Weblogic: random error when loading a jsp page that uses a Bean

    Hi!
    I wrote a simple jsp page that stores a String in a JavaBean, and then forwards to another jsp page to display that String. The jsp pages are deployed on a BEA Weblogic 6 Server, but I get a weird behaviour when loading the page into my browser. Usually I get an error message:
    /Response.jsp(9): class 'query.jsp.QueryBean' could not be loaded
    probably occurred due to an error in /Query.jsp line 9:
    <jsp:useBean id = "queryBean" scope = "request" class = "query.jsp.QueryBean" />
    But the funny thing is that after reloading the page a few times it eventually works. The bahaviour seems to be totally random - sometimes it works, sometimes it claims not finding the JavaBean class.
    Anyone experienced something similar?
    Thank you very much,
    Charlie

    Is QueryBean.class located under '<appname>/Web_inf/query/jsp/'?
    If it is please try changing the package name to something else like com.myclass or something like that.

  • Error when run a jsp page in tomcat

    I carefully follow all instruction to install and config j2sdk1.4.2 and Apache Tomcat/5.0.28. After completing, I can run all sample applications about JSP and Servlet in Tomcat manager. I also test my own servlet application and it also works.
    But I fail to run a very simple jsp page. Although I already set environment variables such as CATALINA_HOME, JAVA_HOME, CLASSPATH as directed but it seem to not be able to compile jsp page.
    ( I can compile other java classes in command line. )
    Below is the error i receive . This error takes me lots of time to consider.
    I look for your help ( please describe as clear as goog ). Thanks a lot.
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:414)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK
         org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:106)
         org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
         org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    If you are sure you've installed the JDK (as opposed to just a JRE, which doesn't come with the compilation tools that are required to compile JSPs), then your JAVA_HOME is probably set incorrectly. Ensure JAVA_HOME is pointing to the JDK directory, and not to the JRE directory.

  • How to insert a date picker input text field in a JSF Jsp page

    Hi,
    I have to develop an application using generic facets, unfortunately I am not supposed to use ADF Faces components given by Oracle.
    Now my requirement is, on JSP page an input text field which holds a DATE value is required, it should also have a Date Picker Calendar adjacent to it.
    Could you pls shed some light on this issue and help me out.
    Thanks
    ~Siva(ji)

    <HTML>
    <script language="JavaScript" type="text/javascript">
    <!--
    var pUpWidthc = 300; //Change the pUpWidthc to your requirements.
    var scrAvailc = 400;     //Change to your available screen width. You see in
    //this eBooks' middle frame, the frame width is
                                                                //equal to 410 . So whether your using frames or
                                                                //or a full 800 pixel screen, you must calculate
                                                                //your available screen width.
    var PopUpC = document.getElementById("pUpc");
    document.write('<div id="pUpc" style="visibility:hidden;z-index:4;width:'+pUpWidthc+';position:absolute;"></div>');
    function cstmPup(objC,c){
    popUpC = document.getElementById("pUpc");
    popUpC.innerHTML = c.innerHTML
    popUpC.style.left = getPos(objC,"Left");
    var scrNeedc = getPos(objC,"Left") + pUpWidthc;
    if (scrNeedc > scrAvailc){
    //The number 10 below is an extra offset x value applied when the
    //definitional popup box positions beyond your screen width. You
    //can change this number to fine tune your "beyond screenwidth" positioning.
    var scrOffsetC = getPos(objC,"Left") + pUpWidthc - (scrAvailc);
    popUpC.style.left = getPos(objC,"Left") - (scrOffsetC - 0);
    popUpC.style.top = getPos(objC,"Top") + objC.offsetHeight;
    popUpC.style.visibility = 'visible';
    fill();
    function fill()
         var noOfRows=7,noOfCols=7,i=0,j=0,day=1,x;
    var d1=FirstDayOfWeek(7,2008);
    //40     
         for(i=1;i<noOfRows;i++)
              x=document.getElementById('myTable').insertRow(i);
              for(j=0;j<noOfCols;j++)
                   var y=x.insertCell(j);
                   if( ( i==1 && j<d1))
                   y.innerHTML="";
                   else if(day<=DaysInMonth(7,2008)){
                   y.innerHTML=day;
                   day++;
    //document.write(FirstDayOfWeek(7,2008));
    function FirstDayOfWeek(m,y)
    var i;
    var dow = 6;
    //document.write("Hello");
    for (i=1583; i<y; i++)
    dow += (LeapYear(i)) ? 2 : 1;
    for (i=1; i<m; i++)
    dow += DaysInMonth(i,y);
    return dow % 7;
    function DaysInMonth(m,y)
    // m is the month number (1,2,3,...12), y is the year number (four digits)
    switch (m)
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12: return 31;
    case 2: if (LeapYear(y))
    return 29;
    else
    return 28;
    default: return 30;
    function LeapYear(y)
    return (y % 4==0) && ((y % 100!=0) || (y % 400==0));
    function getPos(objC,sPos){
    var iPos = 0;
    while (objC != null) {
    iPos += objC["offset" + sPos];
    objC = objC.offsetParent;}
    return iPos;
    function hPopUpc(){
    popUpC = document.getElementById("pUpc");
    popUpC.style.visibility = 'hidden';
    //-->
    </script>
    <BODY
    <button id="c1" onclick="cstmPup(c1,pUpCstm)">Custom PopUp</button>
    <'div' id="pUpCstm" style="display:none;">
    <'div' id="myid" align="left" style=" width:100%; height:100%; background:#cccccb; border:1px solid black; border-top:1px solid white; border-left:1px solid white; padding:10px; font:normal 10pt tahoma; padding-left:18px "> <b>Rich Message Boxes</b>
    <hr size="1" style="border:1px solid black;">
         <div style="width:220px; font-family:tahoma; font-size:80%; line-height:1.5em"><br>
              <table border ="1" id="myTable">
                   <TR>
                        <TD> SUN </TD>
                        <TD> MON </TD>
                        <TD> TUE </TD>
                        <TD> WED </TD>
                        <TD> THU </TD>
                        <TD> FRI </TD>
                        <TD> SAT </TD>
                   </TR>
              </table>
         <br><br>
         </div>
         <br>
         <div>
    <button tabindex="-1" onclick="hPopUpc()" style="border:1px solid black; border-left:1px solid white; border-top:1px solid white; background:#cccccc ">Close Message</button>
    </div>
    <?BODY
    </HTML>
    Message was edited by:
    mchepuri
    Message was edited by:
    mchepuri
    Message was edited by:
    mchepuri

  • Javascript is not called in jsp page

    Hi,
    I have jsp page which actually redirect to another jsp page....
    I need to run some javascript code before redirecting to another page
    But it seems script got skipped & it goes to desired page
    code snippet:
    <%@ taglib uri="/ABCTaglib" prefix="AA" %><%response.setContentType("text/xml");%><AA:sitemap pagename="test" />
    <script type="text/javascript">
    alert("testing");
    </script
    String answerid = request.getParameter("answerid");
    String url = request.getParameter("url");
    response.sendRedirect(url);I am expecting an alert "testing" before redirect to another page.
    Thanks in advance

    Javascript is not java.
    Java/JSP runs on the server.
    javascript runs on the client, when the browser loads the page.
    As far as the server is concerned, all that javascript you have there is just template text to be echoed out in its response.
    A redirect will cancel the current response, and send a "redirect" response to tell the client where to go.
    Any output written to the response up until the redirect is discarded.
    If you want to pop up an alert, you actually have to return a response web page, with that javascript embedded in it, and then have that page navigate onwards to where you want to go (potentially using a meta refresh tag)

  • Error message when using JSP pages

    Version 6.0
    The error I'm getting is as follows:
    trying to POST headerFragment.html, internal-redirect reports: no way to service request for headerFragment.html
    All I'm trying to do is a jsp:forward on JSP page 1 to JSP page 2 which, at the top of it, has a jsp:include (the headerFragment.html page mentioned in the error).
    Any thoughts on how to remedy this problem would be appreciated.
    Thanks,
    Mark

    By default, the server will not serve static files in response to POST requests, even when using jsp:include.
    This bug was addressed in 6.0 SP2, but instances created in an earlier release will continue to exhibit the problem even after upgrading. To fix the problem, locate the following line in the obj.conf configuration file:
    Service method=(GET|HEAD) type=*~magnus-internal/* fn=send-fileChange the above line so it reads as follows:
    Service method=(GET|HEAD|POST) type=*~magnus-internal/* fn=send-file

  • Methodaology to use a commom JSF/JSP page for both PDA and PC Browser

    hello,
    I am planing to write an application that should work on both PDA(Windows CE 4.2 Client) and PC(Desktop).I choosed JSF as it supports Rendering.Is there any methodology so that i can use a common JSF/JSP for both the client.
    As the PDA browser space constrint i can not use the same page for both.
    One way as i know is Conditional Component display whre there are ceparate components for PDA & PC ..But i need a methadology where in i can use same component for both PDA & PC .
    I came to know about the XML rendering capability of JSF can this be used?..
    can anybody please hep me in this regard.
    thanks & regards
    ullas kumar

    Firefox Mobile sends "Android" in its browser identification. If the site is checking for that, then you should get a mobile page. If the site requires more, e.g., Chrome, Webkit, or some other text, then that's a problem because Firefox doesn't use those terms. With server-based redirection, you cannot see what the site is checking for.
    For testing, or to work around sites not knowing about Firefox Mobile, you could try the Phony extension: https://addons.mozilla.org/en-us/mobile/addon/phony/

Maybe you are looking for

  • Cannot send email to bcc: list without an address in to:

    I've been trying to figure out how to send an email from my iPhone (3G) that only has recipients in the bcc: field, not in the to: field, but the send button stays grayed out until I enter an address in the to: field. I tried just entering "null" for

  • Problem with displaying BLOB images on JSP page using a servlet

    hi. I have a big problem with displaying BLOB images using JSP. I have a servlet that connects to the oracle database, gets a BLOB image , reads it, and then displays it using a BinaryStream. The problem is , this works only when i directly call that

  • TRUNC() giving wrong data in different versions of Oracle DB

    Hi All,        I have two oracle data base versions. I need to insert into one temp table with select statement. When i use the same query in both environment am getting different results. Can you please help me on that. Version:1 Oracle Database 10g

  • New field to be added in the Decision Operation for the feature WEBMO

    Hi, I want to Add a new field in the Decision Operation for the feature WEBMO. Currently following fields are available for Decision Operation such as APPID, MOLGA, PERNR, TRFAR, TRFGB, TRFGR, TRFST, BUKRS, WERKS, PERSG, PERSK, VDSK1, GSBER, BTRTL, J

  • Sentense as an output

    Below is my program which takes a file as an input and output the same file but with a word in each line. e.g this is an example //start import java.io.*; import java.util.*; import java.util.StringTokenizer; class FileReaderDemo { public static void