R separate personalization classes reqd 4  jsps managed by servlet portlet?

My portlet is a servlet which manages multiple jsps. This servlet manages the session data as well as navigation between the pages. At the moment, I have separate personalization classes for each of the jsps. Each personalization class extends NameValuePersonalizationObject. The content on each of the jsps has to be managed within the portal.
Do I need to have separate personalization classses or is it better to have one personalization class for all the jsps within my portlet ?
Any help would be great, Thanks,
Tara

Hi,
After going through your application scenario, i think you should use just one Personalization Class. A single class would suffice all the four JSPs.
But, as you might be aware, a Preference Store can only store basic data types like String, boolean etc. Complex Data Types like Properties etc. cannot be stored directly using NameValuePersonalizationObject. If you are storing complex types, then you will have to extend this class & define methods to store & fetch data from this complex object into the Personalization Store.
You might want to go through the following article which talks about Information Storage using Web Providers.
http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/articles/overview.information.storage.html
If there are any further issues, please get back.
Regards,
Abhinav

Similar Messages

  • Using normal classes in a JSP

    I have written a library of classes for use in a standard application. In a completely separate project I need to use these classes in a JSP page. Under %tomcat/webapps/myproject is the JSP file. Where do I place the "normal" class files and how do I reference them in the JSP page? Do I need to import them or add them to the classpath and should they be pre-compiled ?
    All help most appreciated
    Thanks
    Bob

    Where do I place the "normal" class files and how do
    I reference them in the JSP page?Just like you use any other class in a JSP.
    Do I need to import them or add them to the classpath and should they be pre-compiled ?Yes, yes and yes. The first thing is something you need to do for your stuff to compile (technically, you don't need to do it, but it's better than always using the fully qualified class names in the code). The second is something the servlet container will do for you when you deploy your WAR. The this is something you need to do with classes anyway. You don't need to do it for JSPs because the container will do it later, but that's all the difference there is.

  • How to access variables declared in java class file from jsp

    i have a java package which reads values from property file. i have imported the package.classname in jsp file and also i have created an object for the class file like
    classname object=new classname();
    now iam able to access only the methods defined in the class but not the variables. i have defined connection properties in class file.
    in jsp i need to use
    statement=con.createstatement(); but it shows variable not declared.
    con is declared in java class file.
    how to access the variables?
    thanks

    here is the code
    * testbean.java
    * Created on October 31, 2006, 12:14 PM
    package property;
    import java.beans.*;
    import java.io.Serializable;
    public class testbean extends Object implements Serializable {
    public String sampleProperty="test2";
        public String getSampleProperty() {
            return sampleProperty;
    }jsp file
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="java.sql.*,java.util.*"%>
    <html>
    <head>
    <title>Schedule Details</title>
    </head>
    <jsp:useBean id="ConProp" class="property.testbean"/>
    <body>
    Messge is : <jsp:getProperty name="msg" property="sampleProperty"/>
    <%
      out.println(ConProp.sampleProperty);
    %>
    </body>
    </html>out.println(ConProp.sampleProperty) prints null value.
    is this the right procedure to access bean variables
    thanks

  • How to use self-defined class in a jsp page

    Hello:
    I defined a class for displaying purpose, which is in the different folder(WEB-INF/classes) from my JSP page.
    In my JSP page, I want to create an instance of my class and display something, while I get the following error: "
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 12 in the jsp file: /htmls/templateIntro.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    /home/jiao/jsp_webserver/tomcat/work/Standalone/localhost/syllabus/htmls/templateIntro_jsp.java:72: cannot resolve symbol
    symbol : class Display
    location: class org.apache.jsp.templateIntro_jsp
    Display display=new Display(out);"
    How can I solve this problem? Should I redefine my classpath or there are some other actions I should take.
    T.I.A.
    Oriental Spirit

    Here is what I have done:
    1) in Display.java, add one line "package tools;" on the top, and compile it to
    create Display.class.
    2) create a new folder at
    /home/jiao/jsp_webserver/tomcat/webapps/syllabus/WEB-INF/classes
    named tools and then put the Display.class into the newly created folder.
    3) in my jsp page, add " import="tools.*"
    But it still doesn't work.
    Any ideas? T.I.A.

  • Import java classes in a JSP

    hallo
    I have craeted aPackage "TestPackage" as subdirectory in the order
    tomcat\webapps\ROOT\WEB-INF\classes\TestPackage
    in this package ther ist the class Test
    I try to imort this class in the jsp
    <%@ page language="java" import="TestPackage.*"%>
    <jsp:useBean id="app" scope="page" class="Test"/>
    <%
    for(int i=0; i< 10; i++){
    %>
    <h1><%= app.getName()%></h1>
    <%
    %>
    error:
    [javac] C:\tomcat4\work\Standalone\localhost\_\test_jsp.java:43: cannot resolve symbol
    [javac] symbol : class Test
    [javac] location: class org.apache.jsp.test_jsp
    [javac] Test app = null;
    who ist the Problem ???
    thanks

    Hi Orient,
    Actually <jsp:useBean /> takes fully qualified class name.
    so your code for <jsp:useBean /> should be like this
       <jsp:useBean id="app" scope="page" class="TestPackage.Test"/>
      For more details please refer http://java.sun.com/products/jsp/tags/11/syntaxref1115.html
    Regards
    Goodieguy

  • Unable to import a java class in a jsp file

    Hi,
    I am trying to import a java class in my jsp.
    ------------------jsp---------------
    <jsp:useBean id="form" class="com.company.portlets.searchApps.object.SearchOBJ" scope="request" />
    <jsp:setProperty name="form" property="*" />
    <input type="TEXT" name="projectID" value='<%= form.getProjectID() %>'>
    When I run the above JSP, it says that class 'com.company.portlets.searchApps.object.SearchOBJ' cannot be found.
    Why?
    My project structure looks like this:
    Project
    +Application Sources
    ++com.company.portlets.searchApps.object
    +++SearchOBJ.java
    +Web Content
    ++htdocs
    +++searchappsportlet
    ++++SearchAppsPortletShowPage.jsp
    ++WEB-INF
    +++index.jsp
    +Resources
    ++SearchApps.deploy
    Please advice...thanks!

    The way that JDeveloper organized the files was like this:
    C:\jdev1012\jdev\mywork\WksSearchApps\Project\classes\com\company\portlets\searchAPPS\object\SearchOBJ.class
    I am assuming that JDeveloper puts the file where they are suppose to be...if not, how do I change that?
    thanks,
    hussain

  • How to use Classes stored in "Classes" folder in JSP with tomcat ?

    Hello friends
    im using tomcat as server and MySQL as a Backend. now i am using the date calculation in Diff.class files which i have stored in catalina_home/webapps/prj_dev/Prj_files/classes/diff/DIff.class.
    now i am getting error that :
    Generated servlet error:
    Only a type can be imported. diff.Diff resolves to a package
    wht i have to do ?

    I don't include the "classes" word in my import anymore.. Waa.. I'm going nuts.. T.T
    Now, I'm trying to use the class through useBean..
    this is how my application looks like:
    /webapps
    -----/hangman-jsp
    ------------index.jsp
    ------------/WEB-INF
    -------------------web.xml
    -------------------MysteryPhrase.java
    -------------------/classes
    ---------------------------/beans
    ----------------------------------MysteryPhrase.class
    -----------/images
    -------------------hangman.gif
    This is what is in my MysteryPhrase:
    package beans;
    import java.lang.String;
    import java.lang.StringBuffer;
    public class MysteryPhrase {
         private String answer;
         private StringBuffer mysteryPhrase;
         private int guesses;
         private char[] alphabet;
         public MysteryPhrase () {
         this.alphabet = new char[26];
    public void setMysteryPhrase (String mysteryPhrase) {
         this.answer = mysteryPhrase;
         this.mysteryPhrase = new StringBuffer(mysteryPhrase.length());
         for (int i = 0; i < mysteryPhrase.length(); i++) {
              this.mysteryPhrase.setCharAt(i, '_');
    public void setGuess (char guess) {
         for (int i = 0; i < answer.length(); i++) {
              if (answer.charAt(i) == guess) {
                   mysteryPhrase.setCharAt(i, guess);
         guesses++;
    public String getMysteryPhrase () {
         return mysteryPhrase.toString();
    public String getAnswer () {
         return answer;
    public int getGuesses () {
         return guesses;
    This is what is in my index.jsp (It is not yet finished..I just started..)
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <jsp:useBean id="phrase" class="beans.MysteryPhrase"/>
    <jsp:setProperty name="phrase" property="MysteryPhrase" value="Hello!"/>
    <html>
         <head>
              <title>JSP/JSTL Implementation of Hangman</title>
              <style type="text/css">
                   div {
                        color: white;
                        background-color: gray;
                        position: absolute;
                        border-style: solid;
                        border-width: thin;
                        width: 20%;
                        height: 30%;
                        text-align: center;
                   #guessBoard {
                        top: 28%;
                        left: 42%
                   #mysteryPhraseBoard {
                        top: 50%;
                        left: 25%;
                        z-index: 2;
                   #statisticsBoard {
                        top: 57%;
                        left: 58%;
                        z-index: 2;
                   #categoryBoard {
                        top: 23%;
                        left: 10%
                   #hangman {
                        top: 7%;
                        left: 70%;
                   #char {
                        width: 20px;
                   body {
                        background-color: black;
              </style>
         </head>
         <body>
              <div id="categoryBoard">
                   <form method="post">
                        Please choose a category:
                        <select name="category">
                             <option>Category 1</option>
                             <option>Category 2</option>
                             <option>Category 3</option>
                             <option>Category 4</option>
                             <option>Category 5</option>
                             <option>Category 6</option>
                             <option>Category 7</option>
                             <option>Category 8</option>
                        </select>
                        <input type="submit" value="Change"/>
                   </form>
              </div>
              <div id="mysteryPhraseBoard">
                   The mystery phrase is
              </div>
              <div id="guessBoard">
                   <form method="post">
                        Enter a letter: <input id="char" type="text" name="letter"/>
                        or
                        Enter a word: <input type="text" name="word"/>
                        <input type="submit" value="Guess"/>
                   </form>
              </div>
              <div id="statisticsBoard">
                   Guesses: 0
                   Remaining Letters: 8
              </div>
              <div id="hangman">
                   <img src="images/hangman.gif"/>
              </div>
         </body>
    </html>

  • How use class file in jsp(very urgent)

    i have class file called birds (birds is actually a xslt file transformed to java class file) now this class file i have to use in my jsp file. how can i use them. if possible can any one give me sample code please very urgent
    can any one help me

    java files
    import org.w3c.dom.*;
    import javax.servlet.http.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import java.io.*;
    public class XmlParser
         public String XmlParser()
              try
    String strXML= "employee.xml";
                   String xslFile = "employeeId.xsl";
                   TransformerFactory tFactory = TransformerFactory.newInstance();
                   StreamResult theTransformationResult = new StreamResult( new ByteArrayOutputStream() );
                   Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
                   transformer.transform(new StreamSource(new StringReader(strXML)), theTransformationResult);
                   String output = theTransformationResult.getOutputStream().toString()
              catch(Exception e)
                   System.out.println(" ***** XmlParser.XmlParser ERROR ***** " + e);
    return output;
    using class files in jsp
    <%@ page import="com.qqqq.aaaa.XmlParser"%>
    <%
         XmlParser xmlParser          =     new XmlParser();
    out.println(xmlParser.XmlParser());
    %>
    i think it will help you.

  • How to include a java-class in a JSP.

    I have the following code in a jsp:
    <jsp:include page = "http://test1.testing.com:81/TestClass" />
    I throws the following error:
    Servlet failed with Exception
    java.io.IOException: Nested 404 error
    If I copy paste the url (http://test1.testing.com:81/TestClass) directly on the browser address, it successfully runs the class.

    Copy the servlet class file in the servletclasses folder in the weblogic server then give the code like this
    <jsp:include page="servlet/servletclassfiles" flush="true" />
    this will include the class file to your jsp page
    what ever server better put the servlet class file in the servlet class invoking area

  • Importing class in a jsp using Tomcat

    Hello All,
    Using Tomcat:
    I have class here:
    examples/WEB-INF/classes/ package/myclass.class
    I have a .jsp here:
    examples/JSPFolder/myjspfile.jsp
    I want to import the class into the jsp.
    I have tried the following combinations of importy lines based on previous posts on these boards and each have failed with same error:
    Unable to load class for JSP
    <%@ page import="myclass" %>
    <%@ page import="myclass.*" %>
    <%@ page import="package.myclass" %>
    <%@ page import="package.myclass.*" %>
    <%@ page import="WEB-INF/classes/package/myclass%>
    I have seen a number of posts for this same problem, and have tried those solutions as well, but none work. I am sure that this is simply a problem of finding the right directory, as I can successfully run the .jsp file iwhen I remove the import line.
    Can someone please help?

    There is a folder for shared packages
    tomcat_root\lib; or
    tomcat_root\common
    also most versions have a lib or common folder for each webapp for packages that are not to be shared.
    tomcat_root\webapps\appname\web-inf\lib
    Agreed that it is strange to allow servlets to import from the classes foler but not JSPs. It should make no difference but it is convension to place single classes in the same folder as the app's directory and packages (especially jar's) in the lib directory.

  • RE:How to call a constructor or a .class file using jsp?

    try like this:
    <%@page import="folder_name.*%>
    <jsp:useBean id="info" class="folder_name.class_name"
    />
    now use your code:
    <%info.method_name()%>But my GetInfo class reside in this following folder!!!
    GetInfo.class location:
    D:/jakarta-tomcat-4.1.24/webapps/chart/WEB-INF/classes/GetInfo.class
    Configuration.jsp location
    D:/jakarta-tomcat-4.1.24/webapps/chart/Configuration.jsp
    This effectively means that I do not have a folder!!
    So I put in this
    <jsp:useBean id="info" class="GetInfo" />
    <%info.SetElement("VISUAL");
    info.startXML();
    String Visual = info.ReturnVISUAL();%>
    <%=Visual%>
    and get the following error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: -1 in the jsp file: null
    Generated servlet error:
    [javac] Since fork is true, ignoring compiler setting.
    [javac] Compiling 1 source file
    [javac] Since fork is true, ignoring compiler setting.
    [javac] D:\steve\jakarta-tomcat-4.1.24\work\Standalone\localhost\chart\Configuration_jsp.java:60: cannot resolve symbol
    [javac] symbol : class GetInfo
    [javac] location: class org.apache.jsp.Configuration_jsp
    [javac] GetInfo info = null;
    [javac] ^
    [javac] D:\steve\jakarta-tomcat-4.1.24\work\Standalone\localhost\chart\Configuration_jsp.java:62: cannot resolve symbol
    [javac] symbol : class GetInfo
    [javac] location: class org.apache.jsp.Configuration_jsp
    [javac] info = (GetInfo) pageContext.getAttribute("info", PageContext.PAGE_SCOPE);
    [javac] ^
    [javac] D:\steve\jakarta-tomcat-4.1.24\work\Standalone\localhost\chart\Configuration_jsp.java:65: cannot resolve symbol
    [javac] symbol : class GetInfo
    [javac] location: class org.apache.jsp.Configuration_jsp
    [javac] info = (GetInfo) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "GetInfo");
    [javac] ^
    [javac] 3 errors
    at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
    at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
    at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
    at ConfigurationServlet.service(ConfigurationServlet.java:80)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:536)
    then I put in this code:
    <%@page import="GetInfo.*"%>
    <jsp:useBean id="info" class="GetInfo" />
    <%info.SetElement("VISUAL");
    info.startXML();
    String Visual = info.ReturnVISUAL();%>
    and get the following error:
    org.apache.jasper.JasperException: /Configuration.jsp(19,21) equal symbol expected
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:428)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:126)
    at org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:169)
    at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:136)
    at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:149)
    at org.apache.jasper.compiler.ParserController.figureOutJspDocument(ParserController.java:254)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:173)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:227)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
    at ConfigurationServlet.service(ConfigurationServlet.java:114)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:536)

    Okay, Tomcat doesn't like it when you don't use packages in the WEB-INF/classes folder, don't ask me why, it's just the way it is.
    Rewrite your class so it exists in a package:package myclasses;
    public class GetInfo { ... }Compile it and put it in the WEB-INF/classes directory so you should have:
    WEB-INF/classes/myclasses/GetInfo.class
    Your import statement should be:<%@ page import="myclasses.GetInfo" %>and continue coding as before.
    Let me know how it goes.
    Anthony

  • How to reference a DatabaseHandler servlet class from a jsp file in Tomcat

    Trying to create a database connection in the jsp file in webapps\project folder by referencing the DatabaseHandler class in webapps\project\WEB-INF\classes.
    Here is the code in the jsp to make the connection:
    DatabaseHandler db = new DatabaseHandler() ;
    String sql = "SELECT password FROM cms_users WHERE user =" + userName ;
    java.sql.ResultSet rs = db . selectQuery( sql ) ;
    Here is the DatabaseHandler class:
    import java.sql.*;
    public class DatabaseHandler
         // instance variables - replace the example below with your own
    private Connection connection;
         * Constructor for objects of class DatabaseHandler
         public DatabaseHandler()
    String url = "jdbc:odbc:javadatabase";
    // Load the driver to allow connection to the database
    try
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
    connection = DriverManager.getConnection( url );
    catch ( ClassNotFoundException cnfex )
    System.err.println( "Failed to load JDBC/ODBC driver." );
    cnfex.printStackTrace();
    System.exit( 1 ); // terminate program
    catch ( SQLException sqlex )
    System.err.println( "Unable to connect" );
    sqlex.printStackTrace();
    public ResultSet selectQuery( String query )
    Statement statement;
    ResultSet resultSet = null ;
    try
    statement = connection.createStatement();
    resultSet = statement.executeQuery( query );
    catch ( SQLException sqlex )
    sqlex.printStackTrace();
    System . exit( 1 ) ;
    return resultSet ;
    Here is the error i am getting when i try to run the jsp script:
    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
    An error occurred at line: 2 in the jsp file: /ValidateLogon.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\cms\ValidateLogon_jsp.java:47: cannot find symbol
    symbol : class DatabaseHandler
    location: class org.apache.jsp.ValidateLogon_jsp
    DatabaseHandler db = new DatabaseHandler() ;
    ^

    Just like in the class file you need to import any classes that you want to access in the JSP.
    http://java.sun.com/products/jsp/tags/11/syntaxref11.fm7.html

  • Importing classes into a jsp

    I have created a class file called BindListener.java and put it in my root directory in my web module. I cannot however get the import statement for the jsp right, my root directory is called JBuilder. I have tried putting it in the WEB-INF classes folder also but still when I try to execute thr jsp it dosent work.
    There is no package declared in the classs file and it does not extend any other class, however it implements the HttpSessionBindingListener interface.
    I can call servlets from my JSP in the WEB-INF classes dir using /JBuilder/ServletName
    I am mondo confused please help

    I have created a class file called BindListener.java
    and put it in my root directory in my web module. I
    cannot however get the import statement for the jsp
    right, my root directory is called JBuilder. I have
    tried putting it in the WEB-INF classes folder also
    but still when I try to execute thr jsp it dosent
    work.
    There is no package declared in the classs file and
    it does not extend any other class, however it
    implements the HttpSessionBindingListener interface.You have to put the class in a package, then put the .class file in a package directory under WEB-INF/classes. So for example:
    package beans;
    public class BindListener ...
    //goes into this directory structure
    <APP_ROOT>/
      *.jsp
      WEB-INF/
        web.xml
        classes/
          beans/
            BindListener.class
    //And is imported into your JSP using one of the following
    // -- EITHER --
    <%@ page import="beans.BindListener" %>
    <%
      BindListener bl = new BindListener();
    %>
    // -- OR --
    <jsp:useBean id="bl" class="beans.BindingListener"/>>
    I can call servlets from my JSP in the WEB-INF
    classes dir using /JBuilder/ServletName
    I am mondo confused please help

  • Using class method in JSP

    Is it possible to use method from ordinary .class file in jsp file?
    If it is, please explain.

    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
         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)

  • How to instantiate a .class from a JSP?

    Hi,
    probably it's a simple problem, byt I'm new in JSP and I couldn't work it out.
    I'm converting a SSJS Netscape Application to JSP. My needing is to write a Java .class containing only static methods, to call them from the JSP pages.
    For trying, I wrote a simple class that I call from a JSP page, but I get this error:
    Error: 500
    Location: /JSP24H/cap01/Simple2.jsp
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile class for
    JSPC:\tomcat\work\localhost_8080%2FJSP24H\_0002fcap_00030_00031_0002fSimple_00032_0002ejspSimple2_jsp_0.java:80:
    Incompatible type for =. Can't convert void to java.lang.String.
    v = GenFunction.messaggio();
    ^
    This is the JSP instantiating the Java class:
    <HTML>
    <HEAD><TITLE>A Simple JSP</TITLE></HEAD>
    <BODY>
    <FONT COLOR="blue" FACE="Trebuchet">
    <CENTER>
    <%@ page import = "GenFunction" %>
    <% out.println("My name is Charly !" + "<br>"); %>
    <%
    String v = " ";
    v = GenFunction.messaggio();
    out.println( v );
    %>
    </CENTER>
    </FONT>
    </BODY>
    </HTML>
    And this is the class instantiated from JSP:
    public class GenFunction {
    public static void main (String args[]) {
    public static String messaggio() {
    String a;
    a = " Hello world !";
    return a;
    In order to be sure about what I'm doing, I opened a DOS window and I called the class within the following:
    public class call_Class {
    public static void main (String args[])
    String v;
    GenFunction x = new GenFunction();
    v = x.messaggio();
    System.out.println(v);
    When I instantiate the class from DOS it's all right, why not from JSP. It seems to be returning a void value (I tried with casting too but without success).
    Thanks !

    Do you have multiple versions of classes in the server CLASSPATH somehwhere? If you have changed the class, and not bounced the server, try bouncing the server(may be using cached class)
    -Mak

Maybe you are looking for

  • Don't want to view previous items in month view

    Hi guys, I don't use iCal for much, but I'm trying to make a simple calendar of events. There are several events, and they last for a month and a half or so each. I've created the event and I'm having it repeat until the specified date. Let's say the

  • Iphone 5s loses the network,writes search

    iPhone 5S loses the network,writes search,Sometimes does not help full reset,can be included in a day

  • Cursor keys do not properly change to next/previous image

    Since a few days, one of my two Lightroom-computers shows a permanent, quite annoying bug, regarding the curser left/right key: It happens in loupe view: When I press the cursor-right key, Lightroom doesn't change to the next image Instead, it doesn'

  • Setting "Segment Templates" on tables in physical model

    Yesterday I set different "segment templates" to corresponding tables and indexes. It worked fine but, today, DDL generator does not apply them. Is it possible? Apparently, segment templates are easy to define and simple to set. Thank you. Bernat Fab

  • 11g - Encrypt Payload shown in Audit Trail

    How to encrypt payload that's shown in Audit Trail of Composite in 11g ? I want to encrypt information like SSN, that's coming as input to my composite service, so that its protected from support teams monitoring the logs and audit trail through EM c