Basic JSP doubt

Hi all,
I tried developing a simple login application from one of the tutorials available on NET. I have a login.jsp page which takes the Username and password as input and the corresponding form action is done by a login Servlet. But i get the following error
The requested resource (/onjava/servlet/com.onjava.login) is not available.
Here is my login.jsp page:
<html>
<head>
<title>OnJava Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" onLoad="document.loginForm.username.focus()">
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td>
<img src="/onjava/images/monitor2.gif"></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<form name="loginForm" method="post"
action="servlet/com.onjava.login">
<tr>
<td width="401"><div align="right">User Name: </div></td>
<td width="399"><input type="text" name="username"></td>
</tr>
<tr>
<td width="401"><div align="right">Password: </div></td>
<td width="399"><input type="password" name="password"></td>
</tr>
<tr>
<td width="401"> </td>
<td width="399"><br><input type="Submit" name="Submit"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>
Here is my web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
'-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'
'http://java.sun.com/j2ee/dtds/web-app_2_3.dtd'>
<web-app>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>com.onjava.login</servlet-class>
</servlet>
<taglib>
<taglib-uri>/onjava</taglib-uri>
<taglib-location>/WEB-INF/lib/taglib.tld</taglib-location>
</taglib>
</web-app>
I have copied the login.class to WEB-INF/classes/com/onjava/ folder. But still i get the same error. Am i doing anything wrong. Please clarify.

So the tutorial you used is an old one that used the invoker servlet to be able to call un-mapped servlets via /servlet/<class-name>
This pracice is discouraged now, and most of the time the invoker servlet is turned off.
Add this to your web.xml after the <servlet> definition:
        <servlet-mapping>
            <servlet-name>login</servlet-name>
            <url>/login</url>
        </servlet-mapping>then change your form tag to have the action="login". This will map the servlet to a url you want to use. You then invoke that url (when the form is submitted) and get the servlet to run.

Similar Messages

  • Basic FICO doubt regarding posting expenses....

    Hi,
    I am an ABAPer. I have a basic FI doubt. We are using Project system in our company. Now for expenses, the employee enters the data in third party systems. Th third party systems then provide us with the data file which will be posted in SAP.
    The business says that if a given expense by an employee, has Project status released, then the amount for that expense should be posted to cost center otherwise the amount for that expense should be posted to the project(WBS).
    Now what does business people mean by posting expense amount to cost center or posting expense amount to Project (WBS). Where in FI can I see the option of posting amount to cost center versus posting amount to project ? Is there any transaction we can do that ?
    Regards,
    Rajesh.

    when you post to wbs element it is a cost collector which can be settled later, where as cost center is a department. When you have a project, it has on going expenese instead directly posting to a cost center , you are collecting costs in a wbs element and settling it later to cost center. you can post to the wbs element same way as cost center.

  • Basic jsp and servlet question (JSP Model 2)

    Hi
    I want to make an website where i use JSP Model 2 architecture. However I got a basic question
    1. I need to separate business logic from presentation with the use of jsp and servlets. Meaning I want no html code in the servlet. Can you give a simple example of how this can be done? If I map my implementation of httpServlet to a jsp page in web.xml and override doPost() and doGet(). The calls to the jsp page comes to the servlet as it should. I want to process some methods (calling sessionbeans or similar which in turn calls entitybeans) and then show the jsp page.
    How do I show the jsp page without mixing html in the servlet as I've done below:
    doGet(HttpServletRequest req, HttpServletResponse res)
    PrintWriter p = response.getWriter();
    p.print("<html><body>Hello world</body></html>"); //I dont want to do //this, I want to display the JSP site
    doPost(HttpServletRequest req, HttpServletResponse res)
    //doSomething
    }Message was edited by:
    CbbLe

    You should treat your servlet class much like a controller, where you can then use JSP as the view. The way you achieve this is to use the forward() method in RequestDispatcher.
    Say you've got a servlet class org.yoursite.controller.YourController:
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
      //Set some value for use in the JSP file associated wth me
      req.setAttribute("greeting", "Hello world!");
      //Done with our business logic, off we go to the JSP file
      ServletContext app = getServletContext();
        RequestDispatcher disp;
        disp = app.getRequestDispatcher("/some/jsp/file.jsp);
        disp.forward(req, resp);
    }Now in your JSP file:
    <h1>Example</h1>
    <div>
      I just want to say <%= request.getAttribute("greeting") %>
    </div>Going to that servlet now executes business logic and then points to the JSP file for the view. You can forward from servlet to servlet too if needs be. The string you pass to forward() is whatever would be in the URI of the request so any <servlet-mapping> configurations in web.xml are used ;)
    There is some pretty in-depth documentation on the J2EE blueprints website, namely service-to-worker and front-controller patterns. I dare say if you're looking for this sort of code you'll want to look at the composite view pattern too (also on blueprints).

  • Basic jsp UNIX setup question

    Hi folks,
    We have just installed 9iAS 1.0.2.1 on HPUX 11.0
    Everything works fine except for the JSP demos like hello user, lottery, etc.
    They all fail with the same general error. I suspect it is an environmental issue but cannot be sure as I have found nothing i the docs. Any insight is appreciated. It is important that I fix this as we are planning on installing the JPDK.
    Here is the error log we receive in the browser when we run the "hello user" sample:
    JSP Error:
    Request URI:/demo/basic/hellouser/hellouser.jsp
    Exception:
    java.lang.NoClassDefFoundError: sun/tools/javac/Main
    Here is the error log we receive in the browser when we run the "lottery" sample:
    JSP Error:
    Request URI:/demo/basic/lottery/lotto.jsp
    Exception:
    java.lang.NoClassDefFoundError: sun/tools/javac/Main
    Thanks,
    Fred

    Add your java tools.jar file to the classpath for JServ (assumiing you are using JServ in 9iAS). The file is usually in your jdk home directory under lib.
    John H.

  • Basic ABAP doubts

    Hi Experts,
    got some basic doubts..hope ppl can help me tackle them..
    1. y is sapscript client-specific when smartforms are     cross-client ?
    2. why exactly are reference fields required for Currency n Quantity Fields ?
    3. In SE93, while creating a transaction for an executable program, no variant comes in F4 even wen we have created one for the program, n wen we type in the variant, it says the Transaction is inconsistent.. is it because transaction is cross-client whereas variant is not ??
    4. where is DDIC placed?? i mean is it in database or Application server ?
    5. why do we need to have a Value table ?
    Please dont copy & paste from existing sources..it wud be great if u cud explain in ur own wrds...
    all answers wud be appropriately rewarded..
    thanks.
    bikash

    thanks for the reply guys..
    Andreas,it wud ve been better if u explain ur answers.
    pawan.
    1. smartform when activated generates a function module which becomes part of DDIC. so client-independent ... ( arent transparent tables part of DDIC ??? they are client-dependent though )...
    2. bcoz when u say amounts like 1000 rupees, 1000 refers to amount and rupees refers to currency unit.
    thats ok pawan, but how does it matter if it is rupees or USD or EURO..its anyway a field with lets say 13 digits n 2 decimals..n also the field contains only 1000, not the rupees, that part anyway can be got from the currency field.....
    3. did u test in a multiple-client system?? ie, it comes in IDES over here too, i think dats because IDES doesnt have multiple client..
      Also, if it has come in a multiple client system, wat ll happen if u run that transaction in a client in which that variant is not there..it ll throw an error right??
    4. wat my doubt is that anything that is there, also the definitions has to be stored someweher right?? so isnt the database where everything including the dictionary is stored??
    awaiting ur useful responses...
    Message was edited by: Bikash  Agarwal

  • Basic JSP question

    Hi,
    I'm starting to use JSP, and I have a few basic questions. I've found some tutorials online, such as the J2EE tutorial, and some others through Google, that have been helpful. However, after reading some tutorials, I still have a basic question:
    If I have a Java class file, can I access that class' methods through my web page using JSP, and then retrieve information from that class?
    For example, if I have a class MyClass, a method myMethod, and an ArrayList<String> arr, would I be able to do something like this from my web page?
    MyClass.myMethod();
    MyClass.arr.get(0);If anyone can give me some advice, or possibly link me to a tutorial that will explain this, I will be very appreciative.

    Yes you can, here is a quick example of how you could do that.
    <%@ page language="java" contentType="text/html"
        pageEncoding="ISO-8859-1"%>
    <jsp:useBean id="myObject" scope="session" class="mypackage.MyClass" />
    <html>
    <body>
    <%
         myObject.myMethod();
    %>
    <%= myObject.arr.get(0) %>
    </body>
    </html>

  • Basic Sensor Doubts

    Hi all,
    I am having some basic doubts regarding the functionality of the sensor.
    case 1
    Assume that sensor is in inline mode.Then
    1) By default "stop" atomic attacks
    2) By default "stop" attacks that span multiple packets
    3) By default block IP address or network addresses without "blocking" being configured?
    In the above case how is "stoping" an attack differnet from blocking it?
    case 2
    Assume that sensor is in promiscous mode
    1) By default "stop" atomic attacks
    2) By default "stop" attacks that span multiple packets
    3) By default block IP address or network addresses without "blocking" being configured
    Also in this case how is "stoping" an attack different from "blocking" an IP or network address?
    Thanks in advance
    MD

    Doesn't blocking actually drop all traffic from that IP for a specified period while dropping or stopping means it drops the packets as they are triggered?

  • Basic jsp design question

    I did this with a servlet and now I'm trying to figure out how to do this with a jsp.
    I have a screen that displays data
    If there is no data you get a message saying no data
    So I think that would be 2 jsps.
    If you hit the edit or save button you get a new screen that allows you to input data. If you hit save or cancel you go back to the 'display data' screen. I also need the ability to do next and previous on the display data screen.
    I have this done in servlets, I am having trouble figuring out how to design this for servlets. I am figure the following.
    1. jsp for display data screen
    2. jsp for the display data screen with no data
    3. jsp for the add/cancel screen
    Ok that is the html part. How do I manage the logic? can I do an 'action=''> and pass this to a javabean? then have the java bean act as a dispatcher with all my logic in it? I can't figure out how I write a class to manage all my logic for the jsps. How do I call the dispatcher class? how do i have the dispatcher class then call a jsp page?

    have a look at frameworks like Struts

  • Basic EJB doubts

    Hi,
    According to the EJB Specification,
    - Entity beans are shared access to the clients. What is it mean?.
    - What is Conversational State in Stateful Session Bean?.
    - Where and when should i use session bean?. Where and when shouldn't i use session bean?.
    - Where and when should i use Entity bean with CMP?.
    - Where and when should i use Entity bean with BMP?.
    Can anyone explain with example?.
    Plz.
    Regards,
    Senthamizh

    Hi,
    It has taken me a year to understand the concept of ejb and still I am not sure whether I should use it or not,In fact I had read the orielly's EJB many times and read the basics again and again then I realized how well it was explained in the Orielly.So if the basics are through the orielly is best for undestanding....
    - Entity beans are shared access to the clients.
    nts. What is it mean?.If you see the forums definition of EJB it says ---->
    The EJB platform handles things like transaction and state management, multithreading, resource pooling, and simple searches while you concentrate on writing business logic..
    The resource pooling explains the shared access point......
    - What is Conversational State in Stateful
    eful Session Bean?.Please refer the Orielly Ejb as it would be very vast to explain.Any way in short the conservational state means the state of the object which is being stored for the particular client...If you still did not understand please get back to me.....
    - Where and when should i use session bean?.
    an?. Where and when shouldn't i use session bean?.
    - Where and when should i use Entity bean with
    with CMP?.
    - Where and when should i use Entity bean with
    with BMP?.Please go through the Orielly and if still you dont get I will try my best to explain......Read the book
    cooly it is easy to understand if you are good at basics....
    regards vickyk

  • Basic bw doubt

    Hi,
    First of all excuse me for asking basic questions.
    assuming i've a ff and i'm trying to load to ods and then onto a cube from the ods. my ff is of this order:
    custid, matid, quantity.
    i;m first loading values like
    cust01 mat01 49
    after loading this i'm loading again with values
    cust01 mat01 83
    how will the records look in ods and in cube
    during reporting how will it look like.
    ~rahul

    Hi,
    as Andrzej already mentioned, your question is a bit unclear but here what I understood.
    You load
    cust01 mat01 49
    and then
    cust01 mat01 83
    to your ods and after that into the cube.
    Now I assume, that custid and matid are the keyfields of your ods and quantity the only data field. If you set the update mode for quantity to overwrite you will see
    cust01 mat01 83
    after both records.
    If you set the update mode to addition you will see
    cust01 mat01 132
    after both records.
    You will see this in your ods as well as in your cube. Basically you might see 49 and 83 if you report also on requestid of your cube. Without requestid it will be just 132.
    Hope this helps!
    regards
    Siggi

  • Basic Java doubt

    Hi,
    I have a small doubt bugging me...
    Can anyone clarify doubt on the exact meaning of Distributed application in java?
    For suppose I have a EJB Application.
    When i can say that my EJB Application is distributed?
    Regards,
    Sivanand

    yawmark wrote:
    gcameo wrote:
    when ur application is devided into components...
    [Ur applications|http://en.wikipedia.org/wiki/Ur] are quite old. Ancient, one might say.
    I think you will find that gcameo it talking about [wild ox|http://en.wikipedia.org/wiki/Ur_(rune)] and components are steaks and oxtail soup.
    Unless you have a very large oven you will need to distribute the load.

  • Basic extraction  doubts sap SAP R/3 to SAP BI

    IN SBIW which radio button i should select if i am extracting the Table in R/3  with 77 fields into sap BI ?
    1) Transaction  or
    2)Master data attributes
    3)texts data
    please tell me ...
    and after that If i want to  use the table for reporting in SAP BI, To which is the best data target to create in SAP BI?
    a)Infocube
    b)DSO
    and please tell me the steps to do in SAP BI system?
    I am asking all these because i am new to sap BI ?
    please do write me...thank you !!!!!!1

    Hi,
    i suppose you need transaction data. We could be sure if you post the table which you want to extract.
    The infoprovider you need is dependent from the data you need for reporting. Pls. search in SDN or in the help.sap.com for modelling help.
    Regards
    Edited by: Zoltan Both on Aug 20, 2008 1:14 PM
    Edited by: Zoltan Both on Aug 20, 2008 1:16 PM

  • Jsp doubt

    ANY ONE CAN HELLP MEEEEEE
    i have 20 records in my table .how to display 5 records in each page when i click on the next button??????
    Message was edited by:
    suvarnasivabhavan

    Hi.
    Regarding the navigation , U need to handle it in ur code.
    Or else while fetching it from the database , fetch 5 records at a time.but u need to keep thrack of the records fetched.....
    hope this helps

  • Basic sql doubt

    hi all
    observe the below query
    SELECT RTRIM(XMLAGG(xmlelement (e,ename,',')).EXTRACT('//text()')) a
    FROM EMP
    group by deptno
    it gives output as below
    A
    KING,MILLER,CLARK,
    JONES,ADAMS,SMITH,FORD,SCOTT,
    BLAKE,JAMES,TURNER,MARTIN,WARD,ALLEN,
    CF_TYPE,CF_TYPE,CF_TYPE,
    in the above output fourth row is having duplicate names
    but i need to avoid duplicates and print all distinct as below
    A
    KING,MILLER,CLARK,
    JONES,ADAMS,SMITH,FORD,SCOTT,
    BLAKE,JAMES,TURNER,MARTIN,WARD,ALLEN,
    CF_TYPE,Please help me on this.
    am using oracle Application Express 4.0.2.00.08thanks for all in advance

    Hi,
    WITH data AS
         SELECT deptno, ename, DENSE_RANK() OVER (PARTITION BY deptno ORDER BY  ename) rn
         FROM   emp
         SELECT DISTINCT deptno, LTRIM(SYS_CONNECT_BY_PATH(ename,','),',') ename 
         FROM   data
         WHERE  CONNECT_BY_ISLEAF = 1
         CONNECT BY PRIOR rn + 1 = rn
         AND PRIOR deptno = deptno
         START WITH rn = 1
         ;

  • Basic BSP Doubt

    There are few standard keywords available in pages used in the BSP Application "HAP_DOCUMENT" in the HR Module.
    Keyword 'application' used in 'document_todo.htm' refers to a class 'CL_BSP_HAP_DOCUMENT_UI'
    I am unable to trace where exactly this class is being instantiated and assigned to the key word 'application'
    Regards,
    Bharath Mohan B

    application class is assigned to BSP application. se80 double click on the application name and  go to properties tab. there you will find a field called application class and this class will be entered there.
    BSP runtime is responsible for instantiate this class.
    Raja

Maybe you are looking for

  • I try to create a game, but i got problems yet

    Hello, thus I has again times tries a play to program. And I want to bring that also times to the end. It is stop a play like we it all from the Intro of Ridge Racer 1 or also from our Nokia Handy. Evenly, a play, in which one must settle other ships

  • Moving average price  has become Zero in Material Master

    Hi, Can you please help us , if you have any ...this kind of situation in your projects. Scenerio: We are using Workflow mechanism for creation material in Master data client 01. After creation of Material, it will go for approval (to six departments

  • Re: OS Command Line.

    emss wrote: I need to run a utility called TKPROF. This is executed via an OS Command Line. What has me puzzled, and can not find any internet help yet, is: What is an OS Command Line? I have SSH Client, SQL*Plus, WinZip, and SQLDeveloper....but can

  • SOAP: call failed: java.io.EOFException: Connection closed by remote host

    Hi folks, my friday crusher: We have a sync RFC-PI-SOAP scenario. All is working fine in Dev system. After moving into Test following error is displayed as the SOAP response message: - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP

  • LCD Burn-in?

    I am having an issue with my 20" LCD Cinema display (older plastic surround model, 2 years old). I am now noticing that after I have any window open for longer than a few minutes, when closed, I can see a ghostly remant of it on the Desktop. Same goe