New to jsp

Hi
Would u please have a look at the following files and tell me why the jsp is not working properly?
thanks,
C
Names.java
package tjo;
import java.util.*;
public class Names {
String answer;
boolean success;
String hint;
int numGuesses;
public Names() {
reset();
public void setGuess(String guess) {
numGuesses++;
String g;
try {
g = guess;
catch (Exception e) {
g = "invalid";
if (g ==answer)
success = true;
else
hint = "c";
public boolean getSuccess() {
return success;
public String getHint() {
return "" + hint;
public int getNumGuesses() {
return numGuesses;
public void reset() {
answer ="Lucy";
success = false;
numGuesses = 0;
//End of Names.java
Naming.jsp
<%@ page import ="tjo.Names" %>
<jsp:useBean id="namehandler" class="tjo.Names" scope="session"/>
<jsp:setProperty name="namehandler" property="*"/>
<html>
<head>
<title>Guess my name</title>
</head>
<body>
<font size =5>
<% if(namehandler.getSuccess()==true ){ %>
Congratulations! You got it!<p>
<% namehandler.reset(); %>
Care to try again?
<% }else if(namehandler.getNumGuesses()== 0){ %>
Welcome to the guessing game. <p>
Can you guess what my name is? <p>
<form method = get>
What's your guess?<input type=text name=guess>
<input type=submit value="Submit">
</form>
<% }else { %>
Good guess, but no.Try <b><%= namehandler.getHint() %></b>
You have made <%= namehandler.getNumGuesses() %> guesses. <p>
What's my name? <p>
<form method = get>
What's your guess?<input type=text name=guess>
<input type=submit value="Submit">
</form>
<% } %>
</font>
</body>
</html>
//End of Naming.jsp

Hello Countess,
Lets start with Name.java:
There is no need to import java.util package as you don't seem to use any classes in it.
You do not need the try-catch block as an exception will never be thrown in this situation (both g and guess are strings, and you don't call any methods on them), in fact use the parameter variable directly (it's more efficient memory usage), ie.
public void setGuess(String guess) {
numGuesses++;
if (guess.equals(answer)) {
success = true;
else {
hint = "c";
Also, hint is a string so there's no need to append it to an empty string in getHint(), ie.
public String getHint() {
return hint;
Now for Name.jsp:
There is no need for the import directive,
<jsp:useBean id="namehandler" class="tjo.Names" scope="session"/>
does the importing for you.
<jsp:setProperty name="namehandler" property="*"/> ??
This action will cause you more problems than anything.
Your class has four variables (answer, success, hint, and numGuesses). However your jsp can only see success, hint, and numGuesses because of the get methods you've declared in your class (which return these variables).
In fact, your jsp will assume there is another property called guess as you have also declared the setGuess method (it is not important that this property does not actually exist).
So calling the jsp:setProperty method will raise an exception, as you do not have a property (variable in your class) called '*' (I don't think you can use an asterix for a variable anyway) More importantly though you do not have a set method for that property, ie.
public void setGuess(String g) can be invoked in your jsp by
<jsp:setProperty name="nameHendler" property="guess" value="Lucy"/>
(cut the set or get of the front of the method, and this is what ths jsp thinks it is acting on. It will still do what ever you write in the method)
Looking at your jsp more closely, it seems you are trying to retrieve a request parameter. In which case you must type,
<jsp:setProperty name="namehandler" property="guess" param="guess"/>
The param value you give here is the name of the input element in the form from the preceeding page, but in this case this page, ie.
What's your guess?<input type="text" name="guess"/>
And instead of writing,
Good guess, but no.Try <b><%= namehandler.getHint() %></b>
You have made <%= namehandler.getNumGuesses() %> guesses.
try,
Good guess, but no. Try
<b><jsp:getProperty name="nameHandler" property="hint"/></b>
You have made
<jsp:getProperty name="nameHandler" property="numGuesses"/> guesses.
Also try putting font settings in the style attribute of the body tag, ie.
<body style="font-size: 5px">
Hope this helps. I am watching this topic so if you still cant get you app to work post another message and I'll try help.
Darren ;-p

Similar Messages

  • Pls help!  Creating a new simple jsp iView...

    Hi, I would like to create a totally new iView JSP project from scratch.  I currently have NetWeaver and EP 6.0.  This is what I have done so far on NetWeaver: <b>File > New > Project > Select Portal Application > click 'Next' > Type in Project name and root folder > click 'FINISH'</b>.  Now, I think I have a project ready?  I have some basic iView JSP code already.   so now can someone provide me with detailed steps on what modifications and steps I need to make on my new project in order for my iView jsp to display on the EP 6.0?  Any files like 'portalapp.xml' that I have to modify?
    Thank you so much for your help,
    Baggett.
    What I know so far: I have looked at an example where I created one using an existing par.  I know how to export .par file to EP 6.0, it's the steps before that I don't know.  Thanks again.

    Hi, I think I found a little solution to my problem but now I have a new issue.  I think I "solved" my problem by doing:  <b>File > New > Project > Select Portal Application > click 'Next' > Type in Project name and root folder > click 'FINISH'.  Now, I do:
    File > New > Other > Portal Application > Create a new Portal Application Object > Select my Project > Portal Component/JSPDynPage (is this the 'easy' one to pick b/c it seems to update the portalapp.xml file, creates a jsp file (myFirstJSP.jsp) and bean for me) > I type in all the textfields for file name, package name, ... > click 'FINISH'. </b>
    Is this a correct/good way of starting a JSP project(I don't really know what a JSPDynPage is)
    Now I have a new issue.  I open up myFirstJSP.jsp and NetWeaver highlights all the code (pasted below) in yellow and there is no error displayed:
    <b><hbj:content id="myContext" >
      <hbj:page title="PageTitle">
       <hbj:form id="myFormId" >
       </hbj:form>
      </hbj:page>
    </hbj:content></b>
    So I try to paste this line into myFirstJSP.jsp: <b><%@ taglib uri="tagLib" prefix="hbj" %></b>and also paste this line onto portalapp.xml:
    <b><component-profile>
            <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
    </component-profile>    </b>
    Now, I get an error saying: <b>"JSP Parsing Error:File "/dist/PORTAL_INF/pagelet/tagLib" not found"</b>
    Why is this?  How can I fix it?
    Thanks so much,
    Baggett.

  • New to jsp, login page errors

    Hi
    I'm totally new to using jsp and as part of a project I need to create a login page which compares the
    entered email and password with those contained in a database.
    I've created the java code and jsp pages, there's no obvious errors (to me anyway) but everytime I try to run it I get the same error.
    The code for the login page is:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <body>
    <form action="validate.jsp" method="POST">
    email address - <input type="text" name="emailAddress">
    <br>
    password - <input type="password" name="passWord">
    <input type="submit" value="Submit">
    <input type="reset" value="Reset">
    </form>
    <br>
    new customer? To sign up <a href="new%20customer.jsp">Click here</a>
    </body>
    </html>The validation page code is:
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="java.util.*" %>
    <jsp:useBean id="idHandler" class="org.login" scope="request">
        <jsp:setProperty name="idHandler" property="*"/>
    </jsp:useBean>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <body>
                <%
                String username=(String) session.getAttribute("username");
                String password = (String) session.getAttribute("password");
                String emailAddress = request.getParameter("emailAddress");
                String passWord = request.getParameter("passWord");
                if (idHandler.authenticate(emailAddress, passWord)) {
                    response.sendRedirect("index.jsp");
                } else {
                    response.sendRedirect("login.jsp");
                %>
        </body>
        </head>
    </html>and the java code is:
    package org;
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;
    public class login {
        private DataSource getJdbcConnectionPool() throws NamingException {
            Context c = new InitialContext();
            return (DataSource) c.lookup("java:comp/env/jdbc/connectionPool");
    //method that is called from validateuser.jsp and this checks for the authentic user and
        public boolean authenticate(String emailAdd, String pass)
                throws SQLException, IOException, IOException, NamingException {
            String emailAddress = null, Password = null;
            // connection instance
            Connection connection = null;
            try {
                DataSource dataSource = getJdbcConnectionPool();
                connection = dataSource.getConnection();
                String sql = "SELECT emailAdd, pword FROM customer WHERE emailAdd='" + emailAdd + "'" + "AND pword='" + pass + "'";
                PreparedStatement ps = connection.prepareStatement(sql);
                ResultSet rs = ps.executeQuery();
                if (rs.next()) {
                    emailAddress = rs.getString("emailAdd");
                    Password = rs.getString("pword");
                if (emailAddress != null && Password != null && emailAddress.equals(emailAddress) && pass.equals(Password)) {
                    return true;
                } else {
                    return false;
            }finally  {
                // close the connection so it can be returned to
                // the connection pool then return the list           
                connection.close();
    }finally the error message I get is:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    root cause
    java.lang.NullPointerException
         org.login.authenticate(login.java:56)
         org.apache.jsp.validate_jsp._jspService(validate_jsp.java:76)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.26 logs.
    help?

    login.java:56 is:
    connection.close();right? So, it looks like the call to getJdbcConnectionPool within authenticate throws an exception and control is passed to the finally block where connection is still null, resulting in the NPE. You should probably catch any exceptions thrown by the lookup for your datasource so you can see what the "real' error is.

  • New on JSP

    Hello,
              I am new on JSP, and I want some good and free help/tutorial for JSP.
              Is JSP the same language-script for WebLogic, WebSphere, Tomcat, Apache,
              etc. or it has some standards, which is the same for all servers &
              platforms.
              Does WebLogic work on Windows-XP ? What platform is the best for web-Logic ?
              Thanks :)
              

              "Mr. x" <[email protected]> wrote:
              >Hello,
              >
              >I am new on JSP, and I want some good and free help/tutorial for JSP.
              >
              >Is JSP the same language-script for WebLogic, WebSphere, Tomcat, Apache,
              >etc. or it has some standards, which is the same for all servers &
              >platforms.
              >
              >Does WebLogic work on Windows-XP ? What platform is the best for web-Logic
              >?
              >
              >Thanks :)
              Hi      
              You can Check www.javasoft.com and www.javaworld.com for Free JSP tutorials
              Weblogic will work on Windows -XP.
              If u are particular with Window environment the best Platform for Weblogic is
              Windows NT WorkStation
              For any application the best platform to work would be Sun Solaris
              or Any unix based O/S would offer a good support
              Thanks
              Rajkumar
              

  • Setting environment for a new custom JSP

    Hi All,
    I have created a new custom jsp,Calling teh API is not working as apps initialization is not happening. When we printed the user id,application id etc it was coming as null. How to initialize apps in JSP.
    Thanks,
    Shreya

    Below code might be useful.
    <%@ page language="java" errorPage="OAErrorPage.jsp" contentType="text/html"
    import="oracle.apps.fnd.common.WebAppsContext"
    import = "java.io.File"
    import = "oracle.apps.fnd.framework.webui.OAJSPHelper"
    import = "oracle.apps.fnd.framework.webui.URLMgr"
    import = "oracle.apps.fnd.common.WebAppsContext"%>
    <%! public static final String RCS_ID = "$Header: test_fwktutorial.jsp 115.5 2003/05/05 10:20:28 gmallesh noship $"; %>
    <jsp:useBean id="sessionBean" class="oracle.apps.fnd.framework.CreateIcxSession"
    scope="request"></jsp:useBean>
    <%
    response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1
    response.setHeader("Pragma", "no-cache"); // HTTP 1.0
    response.setDateHeader("Expires", -1); // Prevent caching at the proxy server
    response.setStatus(HttpServletResponse.SC_RESET_CONTENT); // HTTP 1.1. Only way to force refresh in IE.
    String dbcFullPathName = oracle.apps.fnd.framework.webui.OAJSPHelper.getWebAppContextInitParameter(pageContext, "DBC_FULL_PATH_NAME");
    System.out.println("dbcFullPathName: "+dbcFullPathName);
    String userName = "fnd_user_name";
    String userPassword = "pwd";
    String appShortName = "product short code";
    String responsibilityKey = "RESP_KEY";
    String dbcName = "DBName";
    String sessionid = sessionBean.createSession(request, response, dbcFullPathName, userName, userPassword, appShortName, responsibilityKey);
    String transactionid = sessionBean.createTransaction(sessionBean.mRespInfo[0], sessionBean.mRespInfo[1], sessionBean.mRespInfo[2], dbcFullPathName);
    //Use flowing webAppsContext to call the API
    WebAppsContext wctx = sessionBean.getWebAppsContext();
    %>
    Regards,
    Peddi.

  • Plz help me out new to jsp

    package abc;
    class UserDetails
    // i have used this class basically for declaration of variables.
    public class BulkSmsFunctions
    BulkSmsFunctions()
    {// constructor}
    // in this class i have 5-6 functions      
    public static void amin(String args[])
    // i have left my psvm as empty.
    }BulkSmsFunctions uses objects of UserDetails to assign various variables.
    now i have a jsp page which has to create an object of BulkSmsFunctions and call the various functions.
    i have the following code for the jsp page:
    <%@ page import = "java.util.*"%>
    <%@ page import = "java.lang.*"%>
    <%@ page import = "java.io.*"%>
    <%@ page import = "abc.*"%>//importing the package
    <html>
    <body>
    <%
    String PROVISIONING_LOG_PATH="C:\\bulksmsfolder";
    String USERS_ACTIVE_DETAILS_FILE="CountDetails";
    String USERS_PACKAGE_SUBSCRIPTION_LOGS_FILE="ServiceLog";
    String SERVICE_SUBSCRIPTION_PACKAGES_MASTER_FILE="PacksMasterFile";
    BulkSmsFunctions objBulkSms= new BulkSmsFunctions();
    try
    boolean SmsCountFlag = objBulkSms.processSmsCountDetails(PROVISIONING_MODULE_LOG_PATH,USERS_ACTIVE_SMSCOUNT_DETAILS_FILE);
    if(SmsCountFlag == false)
            out.println(" No file contents");
         catch (Exception e)
         out.println(" Exception in main     :" + e.toString());
    %>
    </body>
    </html>i am getting the following error.
    An error occurred at line: 7 in the jsp file: /jsp/natasha/hello.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\jsp\natasha\hello_jsp.java:56: tcs.BulkSmsFunctions is not public in tcs; cannot be accessed from outside package
         BulkSmsFunctions objBulkSms= new BulkSmsFunctions();
    ^
    An error occurred at line: 7 in the jsp file: /jsp/natasha/hello.jsp
    Generated servlet error:
    C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\jsp\natasha\hello_jsp.java:56: tcs.BulkSmsFunctions is not public in tcs; cannot be accessed from outside package
         BulkSmsFunctions objBulkSms= new BulkSmsFunctions();
    ^
    An error occurred at line: 7 in the jsp file: /jsp/natasha/hello.jsp
    Generated servlet error:
    C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\jsp\natasha\hello_jsp.java:56: BulkSmsFunctions() is not public in tcs.BulkSmsFunctions; cannot be accessed from outside package
         BulkSmsFunctions objBulkSms= new BulkSmsFunctions();
    ^
    An error occurred at line: 7 in the jsp file: /jsp/natasha/hello.jsp
    Generated servlet error:
    C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\jsp\natasha\hello_jsp.java:60: processSmsCountDetails(java.lang.String,java.lang.String) is not public in tcs.BulkSmsFunctions; cannot be accessed from outside package
              boolean SmsCountFlag = objBulkSms.processSmsCountDetails(PROVISIONING_MODULE_LOG_PATH,USERS_ACTIVE_SMSCOUNT_DETAILS_FILE);
    ^
    4 errors

    try
    modify constructor of BulkSmsFunctions to public as in
    public BulkSmsFunctions() { etc etc                                                                                                                                                                                           

  • Error "_blank is undefined" for a new popup jsp page opening from a button

    Added a new button, by personalization to a self service page. The new button on click should open a new jsp page. The jsp page is opening properly on the same page if I remove the blank from the target frame property. For opening the jsp page on a new window, on specifying blank property, getting page error as "_blank is undefined". Also the appearance of the new button added by personalization is different from other buttons. Please help me as I am clueless regarding what might be the cause of such java script(page error).

    If your button appears as a normal html button then your display server might not be generating the image properly, check the logs after turning on logging to see if there are any errors thrown from the display server. Secondly the images generated at runtime are cached in $OA_HTML/cabo/images/cache/en folder, check to see if that folder has proper write permissions for the display server to write the image there.
    What is the OAf version you are using ? Setting _blank on the target frame is the right approach, once you get the above problem rectified try it again.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Database error ??? anyone can help me .......i'm NEW to JSP

    Hi ,
    anyone can help me check wat's the following error means? my program can query and update movies & movie reviews to/from the database. When i tried to query either the movie or the movie reviews, the program works fine but when i try to update review also no problem . However, when i try to update new movies to the database, this error appears(the database already had data inside and i had make sure tat the table name n etc is correct):
    Database Error
    An Operation on the Movie Database Failed!
    org.apache.jasper.JasperException: Cannot find any information on property 'movie' in a bean of type 'db.UpdateMovies'
         at org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:363)
         at org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:306)
         at org.apache.jsp.jdbc2_jsp._jspService(jdbc2_jsp.java:76)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Unknown Source)
    Anyone have any idea wat's went wrong? Please advice .......& Thanks alot for yr help
    Regards,
    huiqin

    from what you're saying, it would sound like a duplicate entry of key constraint violation
    your stack trace is simply saying that there is a problem with the bean being null or not initialized, and this is likely due to the database failing
    you need to get the database specific error and/or error code, this JSP error won't help in debugging the problem

  • Compile a new created jsp

    hi all,
    i developed a par package and deployed it in EP successfully. in this project, i need to create a new jsp file under the path 'PROJECT_NAME\dist\PORTAL-INF\pagelet' when the program has already running, and i have done this.
    now, the problem is, this new jsp file seems can't be complied automatic. and how can i do? thanks.
    kevin

    Hi,
    If you have one component and using more than one jsp file means you have to set state(use switch case) in component(java file). You can do it doProcessBeforeOutput() in jave file.
    switch (state)
    case 1:this.setJspName("jsp name")
    break
    default :this.setJspName("jsp name")
    Regards,
    Senthil K.

  • Please help me !  new to jsp

    I am getting null pointer exception when i am trying to execute one combox to populate the other combo box. I am not able to understand where i am doing wrong. if anybody can guide me will be greatly appreciated,
    My code in the servlet is
    resultSet = statement.executeQuery("SELECT * from kiosk_hitcount where kiosk_name like 'Altoona%' and l_category ='" + request.getParameter("category") + "' group by l_categoryb order by l_categoryb asc");
    Vector data = new Vector();
    while(resultSet.next())
    String rowdata= resultSet.getString("l_categoryb");
    data.addElement(rowdata);
    request.getSession().setAttribute("data", data);
    RequestDispatcher rd = getServletContext().getRequestDispatcher("/MyKiosk/CategoryTest.jsp");
    rd.forward(request,response);
    in jsp page:
    <tr><td><Font size='2'><H3>Local Sub-Category:</H3></Font></td>
    <td><SELECT name="bcategory">
    <%
    Vector data = new Vector();
    data = (Vector)request.getSession().getAttribute("data");
    for(int i = 0; i< data.size(); i++)
    String catb = (String)data.get(i);
    %>
    <OPTION value="<%= catb%>" ><%= catb%></OPTION>
    <%
    %>
    </SELECT></TD></TR>
    Thank you ,
    Mary

    Here is the stackTrace for the Exception
    java.lang.NullPointerException
    at MyKiosk._0002fMyKiosk_0002fCategoryTest_0002ejspCategoryTest_jsp_82._jspService(_0002fMyKiosk_0002fCategoryTest_0002ejspCategoryTest_jsp_82.java:176)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
    at org.netbeans.modules.web.tomcat.JspServlet.service(JspServlet.java:91)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
    at org.apache.tomcat.core.Handler.service(Handler.java:286)
    at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
    at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
    at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
    at java.lang.Thread.run(Thread.java:484)

  • New to JSP-How to run a .jsp file

    I Have just begin to learn JSP. I downloaded the JSP developer kit from java.sun.com. However I dont know how to proceed. I have seen references to'the container'. what is it and how do I start it? and the same for the server which I have in the form a batch file. How do I configure the environment? Are there any prerequisites to using this kit wrt software? Please do help me, since I am absolutely clueless
    Regards,
    Sweta

    Hi Sweta,
    Please use any editor like eclipse or netbeans or you create one jsp page(assumes you know jsp).
    and then create two folders web-inf inside which create classes and lib folder and web.xml is created, and meta-inf inside which context.xml is created. And use tomcat container to deploy.
    Apache tomcat is container which would receive the client request from browser that will route to servlet/jsp.
    whereas Apache webserver is different it provides the request to container if it exists then we can replace localhost:8080 by user defined.
    JSP is nothing but Dynamic web page creator which embed java program in html.
    JSPinit initializes and while running converts to servlet and will be processed according to the java code embed and display as per the html tags.
    But you should use struts framework why it is constructed upon MVC architecture and purely object oriented.
    So struts is nothing but the execution calls are drived by configuration xml files.
    If anything you need to know in details, pls msg me to [email protected]
    Thanking you
    Charles v c

  • New to Jsp. Jsp and java bean not running

    hi
    i have created a simple jsp file and using a java bean. but it is showing errors. my file directory structure in tomcat4.1 is:
    aptechsamples:
    index.jsp
    WEB-INF/classes:
    myPackage:
    Counter.class
    i have no web.xml file i dont know how to use it or not. i need it or not.
    the index.jsp file:<html>
    <head><title> A Simple JSP Bean </title></head>
    <body>
    <%@ page language ="java" %>
    <%@ page import ="mypackage.Counter" %>
    <jsp:useBean id="id_counter" scope="session" class ="Counter"/>
    <jsp:setProperty name="id_counter" property="count" param="count" />
    <jsp:getProperty name="id_counter" property="count" />
    </body>
    </html>the Counter.java file is: package mypackage;
    public class Counter{
         String msg;
         public Counter(){
              msg = "Hello World";
         public String getCount(){
              return msg;          
         public void setCount(String c){
              msg = c;
    }please help me and tellme what the hell is wrong with it or me. im getting an error:
    exception
    org.apache.jasper.JasperException: Cannot create bean of class Counter

    Java is already telling you what is wrong: it cannot create an instance of your Counter class. The reason being: it can't find it.
    What do you mean by "myPackage"? Before you can use any class in your JSP's or servlets, they MUST be stored in a package. If you don't know what that is, I highly suggest you lookup "java package" and "java classpath" using google.
    Let's say your Counter class is in a package mypackage (so it starts with the line package mypackage;). Then you have to store the .class file as:
    WEB-INF/classes/mypackage/Counter.class
    If done correctly, the error message should disappear.

  • New to JSP - what do i need

    Is there a step-by-step guide to setting up an environment for running JSP pages. I can't seem to get my pages to work, they fall over with the syntax error when declaring variables. I'm using IIS.
    Also, does anyone know what the extension .do is used for. We are using SAP crm and it uses JSP pages, but they seem to have a similiar file with a .do extension.
    cheers,
    steven.

    Maybe, you want to start from
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro.html.
    IIS wont understand .JSP unless you have a JSP filter for IIS. For trying out try using Tomcat.
    .do - I beleive, its part of Struts. I don't know much abt it.
    HTH.

  • Hi I am new to Jsp,Please help me.

    This is my Jsp Program:
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class login extends HttpServlet {
    private String target = "/welcome.jsp";
    private String getUser(String username, String password) {
    // Just return a static name
    // If this was reality, we would perform a SQL lookup
    return "Frodo";
    public void init(ServletConfig config)
    throws ServletException {
    super.init(config);
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    // If it is a get request forward to doPost()
    doPost(request, response);
    public void doPost(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    // Get the username from the request
    String username = request.getParameter("username");
    // Get the password from the request
    String password = request.getParameter("password");
    String user = getUser(username, password);
    // Add the fake user to the request
    request.setAttribute("USER", user);
    // Forward the request to the target named
    ServletContext context = getServletContext();
    RequestDispatcher dispatcher =
    context.getRequestDispatcher(target);
    dispatcher.forward(request, response);
    public void destroy() {
    when i compile this i got this error:
    cannot find symbol:
    setAttribute()
    request.setAttribute("USER",user);
    cannot find symbol:
    class RequestDispatcher
    RequestDispatcher dispatcher =
    context.getRequestDispatcher(target);

    Hey no need of that . you can use request scoped attributes too.
    and remember this is not JSP. it's a SERVLET
    your code is completely correct. there are no errors in it. i am pasting your code. just check it.
    It's working properly. no compile time errors occured.
    import java.io.IOException;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class login extends HttpServlet {
         private String target = "/welcome.jsp";
         private String getUser(String username, String password) {
    //          Just return a static name
    //          If this was reality, we would perform a SQL lookup
              return "Frodo";
         public void init(ServletConfig config)
         throws ServletException {
              super.init(config);
         public void doGet(HttpServletRequest request,
                   HttpServletResponse response)
         throws ServletException, IOException {
    //          If it is a get request forward to doPost()
              doPost(request, response);
         public void doPost(HttpServletRequest request,
                   HttpServletResponse response)
         throws ServletException, IOException {
    //          Get the username from the request
              String username = request.getParameter("username");
    //          Get the password from the request
              String password = request.getParameter("password");
              String user = getUser(username, password);
    //          Add the fake user to the request
              request.setAttribute("USER", user);
    //          Forward the request to the target named
              ServletContext context = getServletContext();
              RequestDispatcher dispatcher =
                   context.getRequestDispatcher(target);
              dispatcher.forward(request, response);
         public void destroy() {
    }Let me know where you are getting issues exactly.
    Diablo

  • New to JSP, where to start?

    Hi all,
    I decided to take a look at JSP and was wondering what things I need to install/configure to get an environment running. What are your recommendations for a webserver, editor, online resources etc.
    I'm fairly experienced with PHP and ASP programming and have 2-3 years background in OOP.
    thanks for your time!
    regards,
    Christophe

    I decided to take a look at JSP and was wondering
    what things I need to install/configure to get an
    environment running. What are your recommendations
    for a webserver, editor, online resources etc.(1) Download the Tomcat servlet/JSP engine from Jakarta Apache:
    http://jakarta.apache.org/tomcat
    (2) Download the JSP Standard Tag Library, also from Jakarta Apache (you'll want version 1.1 to go with Tomcat 5.5):
    http://jakarta.apache.org/taglibs
    (3) Go buy Hans Bergsten's JSP book from O'Reilly. I think it's the best, because it uses JSTL from the first page. That's the proper way to learn how to write JSPs.
    %

Maybe you are looking for