JSP with useBean beginner problems need help

I start to learn JSP and now I am facing a problem which cannot be solved for a whole day.
I make a simple JSP and want to use a my defined class to make some logic outside JSP file. It can be built by "ant build".
But there is always an error-message when I see through browser. Also, I have already "ant deploy" to copy all classes in WEB-INF/classes/...
Besides, my tomcat can run JSP without importing external class or javaBean.
Please help. I really have no idea. Thanks.
The simple Converter.class in Test.Beans package
package Test.Beans;
import java.math.*;
public class Converter {
     static BigDecimal yenRate = new BigDecimal("131.7800");
     static BigDecimal euroRate = new BigDecimal("0.0084");
public BigDecimal dollarToYen(BigDecimal dollars) {
BigDecimal result = dollars.multiply(yenRate);
return result.setScale(2,BigDecimal.ROUND_UP);
public BigDecimal yenToEuro(BigDecimal yen) {
BigDecimal result = yen.multiply(euroRate);
return result.setScale(2,BigDecimal.ROUND_UP);
public Converter() {}
The simple JSP:
<%@ page import="java.math.*" %>
<jsp:useBean id="c" class="Test.Beans.Converter" scope="page"/>
<html>
<head>
     <title>Converter</title>
</head>
<body bgcolor="white">
     <FONT SIZE=+1>
     <h1><center>Converter</center></h1>
     <hr>
     <p>Enter an amount to convert:</p>
     <form method="get">
     <input type="text" name="amount" size="25">
     <br>
     <p>
     <input type="submit" value="Submit">
     <input type="reset" value="Reset">
     </form>
     <%
     String amount = request.getParameter("amount");
          if ( amount != null && amount.length() > 0 ) {
          BigDecimal d = new BigDecimal (amount);
     %>
     <%= c.yenToEuro(d) %> Euro.
     <%
     %>
     </FONT>
</body>
</html>
Here is the error message:
org.apache.jasper.JasperException: /main.jsp(2,0) The value for the useBean class attribute Test.Beans.Converter is invalid.
     org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.apache.jasper.JasperException: /main.jsp(2,0) The value for the useBean class attribute Test.Beans.Converter is invalid.
     org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
     org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
     org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
     org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)
     org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
     org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
     org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
     org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
     org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
     org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
     org.apache.jasper.compiler.Generator.generate(Generator.java:3304)
     org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
     org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Message was edited by:
BillyHui

Works fine for me, copied and pasted exactly.
Try recompiling your java class again, to make sure it is valid.
Check that the class file is copied into the correct place by your ant build.
Should be WEB-INF/classes/Test/Beans/Converter.class

Similar Messages

  • I have a 160GB Hard Drive in my MBP and use VMWare Fusion and had a 60GB Virtual Machine running Windows XP. Deleted the Virtual Machine and CANNOT find the 60GB space I desperately need!  Anybody out there with a similar problem?  Help!

    I have a 160GB Hard Drive in my MBP and use VMWare Fusion and had a 60GB Virtual Machine running Windows XP. Deleted the Virtual Machine and CANNOT find the 60GB space I desperately need!  Anybody out there with a similar problem?  Help!

    Thanks - Of Course the first thing I checked and did.
    Disc Utility reads as follows:
    Capacity : 159.18 GB (159,182,127,104 Bytes)
      Format : Mac OS Extended (Journaled)  Available : 11.47 GB (11,472,896,000 Bytes)
      Owners Enabled : Yes  Used : 147.71 GB (147,709,231,104 Bytes)
      Number of Folders : 139,540  Number of Files : 511,832
    Activity Monitor(Disc Usage) shows something quite interesting.  Mac HD and Ramanan (Main User) - My hard drive is only 160GB!  Would the retired engineer gentleman please note as well.  Many thanks. Rams

  • After entering the redemption code from Adobe Photoshop CC, I keep getting an error saying "This card was purchased in a country that does not match your Adobe ID. You can try signing in with a different Adobe ID or get in touch with us if you need help."

    Hi. I'm a Mac user. After entering the redemption code from Adobe Photoshop CC, I keep getting an error saying "This card was purchased in a country that does not match your Adobe ID. You can try signing in with a different Adobe ID or get in touch with us if you need help." What should I do?

    Did you purchase the software in another country than where you live?

  • Problem with changing flash content - Need help

    I need help in changing  the flash content. Here is my proble,
    1) I bought a flash template (I will call this Original) from a website and paid some money to customize my menu,logo and background color.
    2) After they finished it they sent me several files. Like 1) index.html, .swf, psd, .fla. In all the files .html,.swf (the video) and .psd I am seeing my customize changes (logo,menu and background color). But the .fla file they sent me is still shows everything from original template. It doesn't have my logo, menu or background color.
    3) I asked their technical support and they walk me through. a) Open the .fla file in flash pro. b) Change the content c) Hit Ctrl+Enter and it will export the new .swf file to the flash folder. d) Make sure I delete the video from flash folder and replace the name with the one I created.
         I did all these steps. But the problem is the .SWF that i generated is showing everything from the orignal template. It did change the content but I don't see any of my customize request. (Menu, logo or color)
    4) Then I open the index.html and I DID NOT see any of the changes in the content.
    My feeling is they did not provide me the correct .FLA file. I really need your help.
    My confusion is a) Have they provide me the correct .FLA file or I am doing something wrong. b) When I generated the new .swf video and renamed it properly why it didn't reflect in the index.html file.
    I am really going back and forth with them since last 15 days and its not going anywhere. I really appreciate any help.
    Thanks,
    Jessy

    Unfortunately, if you have not enough knowledge about using Flash, and do not want to pay to have this done for you, the folks who did this for you are likely going to be the only ones who can help you resolve it.  They should be able to provide the edited fla and the new swf if they are in any way a credible/reliable business.... which at this point sounds like they are not.

  • Still stuck with the same old producer consumer weight problem need help

    Hello All,
    This is the problem I am stuck with right now.
    I have two array lists one producer array list and one consumer array list denoted by a and b
    P1 P2 P3 P4 P5
    5 6 7 8 9
    C1 C2 C3 C4 C5
    2 3 4 5 6
    Now we find all those producer consumer pairs which satisfy the criteria Pi>=Ci
    We have the following sets
    (5,2)(6,2)(7,2),(8,2),(9,2)
    (5,3)(6,3)(7,3),(8,3),(9,3)
    (5,4)(6,4)(7,4),(8,4),(9,4)
    (5,5)(6,5)(7,5),(8,5),(9,5)
    (6,6)(7,6)(8,6),(9,6)
    Let us done each of them with Si
    so we have S1,S2,S3,S4,S5
    we assign a third parameter called weight to each element in Si which has satisfied the condition Pi>=Ci;
    so we we will have
    (5,2,ai),(6,2,bi),(7,2,ci)....etc for S1
    similarly for S2 and so on.
    We need to find in each set Si the the pair which has the smallest weight.
    if we have (5,2,3) and (6,2,4) then 5,2,3 should be chosen.We should make sure that there is only one pair in every set which is finally chosen on the basis of weight.
    Suppose we get a pair (5,2,3) in S1 and (5,2,3) in S2 we should see that (5,2,3) is not used to compare to compare with any other elements in the same set S2,
    Finally we should arrive at the best element pair in each set.They should be non repeating in other sets.
    Given a problem
    P0 P1 P2 P3 P4
    9 5 2 2 8
    6 5 4 5 3
    C0 C1 C2 C3 C4
    we have So as (P0,C0) and (P4,C0)
    assuming that the one with the smaller index has lesser weight PO is selected.In the program I have used random weights.from set S1 we select the pair PO,CO
    S1 =(P0,C1),(P1,C1) and (P4,C1)
    since P0 and P4 are already used in previous set we dont use them for checking in S1 so we have (P1,C1) as best.
    S2=(P0,C2),(P1,C2) and (P4,C2) so we dont use P0,C2 and P1 and C2 because PO and P1 are already used in S1.
    So we choose P4,C2
    in S3 and S4 ae have (P0,C3),(P1,C3),(P4,C3) so we dont choose anything
    and same in S4 also.
    So answer is
    (P0,C0),(P1,C1) and (P4,C2).
    My program is trying to assign weights and I am trying to print the weights along with the sets.It doesnt work fine.I need help to write this program to do this.
    Thanks.
    Regards.
    NP
    What I have tried till now.
    I have one more question could you help me with this.
    I have an array list of this form.
    package mypackage1;
    import java.util.*;
    public class DD
    private  int P;
    private  int C;
    private int weight;
    public void set_p(int P1)
    P=P1;
    public void set_c(int C1)
    C=C1;
    public void set_weight(int W1)
    weight=W1;
    public int get_p()
    return P;
    public int get_c()
    return C;
    public int get_x()
    return weight;
    public static void main(String args[])
    ArrayList a=new ArrayList();
    ArrayList min_weights_int=new ArrayList();
    ArrayList rows=new ArrayList();
    ArrayList temp=new ArrayList();
    Hashtable h=new Hashtable();
    String v;
    int o=0;
    DD[] d=new DD[5];
    for(int i=0;i<4;i++)
    d=new DD();
    for(int i=0;i<4;i++)
    d[i].set_p(((int)(StrictMath.random()*10 + 1)));
    d[i].set_c((int)(StrictMath.random()*10 + 1));
    d[i].set_weight(0);
    System.out.println("Producers");
    for(int i=0;i<4;i++)
    System.out.println(d[i].get_p());
    System.out.println("Consumers");
    for(int i=0;i<4;i++)
    System.out.println(d[i].get_c());
    System.out.println("Weights");
    for(int i=0;i<4;i++)
    System.out.println(d[i].get_x());
    for(int i=0;i<4;i++ )
    int bi =d[i].get_c();
    ArrayList row=new ArrayList();
    for(int j=0;j<4;j++)
    if( d[j].get_p() >=bi)
    d[j].set_weight((int)(StrictMath.random()*10 + 1));
    row.add("(" + bi + "," + d[j].get_p() + "," +d[j].get_x() + ")");
    else
    d[j].set_weight(0);
    row.add("null");
    rows.add(row);
    System.out.println(rows);
    int f=0;
    for(Iterator p=rows.iterator();p.hasNext();)
    temp=(ArrayList)p.next();
    String S="S" +f;
    h.put(S,temp);
    String tt=new String();
    for(int j=0;j<4;j++)
    if(temp.get(j).toString() !="null")
    // System.out.println("In if loop");
    //System.out.println(temp.get(j).toString());
    String l=temp.get(j).toString();
    System.out.println(l);
    //System.out.println("Comma matches" + l.lastIndexOf(","));
    //System.out.println(min_weights);
    f++;
    for(Enumeration e=h.keys();e.hasMoreElements();)
    //System.out.println("I am here");
    int ii=0;
    int smallest=0;
    String key=(String)e.nextElement();
    System.out.println("key=" + key);
    temp=(ArrayList)h.get(key);
    System.out.println("Array List" + temp);
    for( int j=0;j<4;j++)
    String l=(temp.get(j).toString());
    if(l!="null")
    System.out.println("l=" +l);
    [\code]

    In your example you selected the pair with the greatest
    distance from the first set, and the pair with the least
    distance from the second. I don't see how the distance
    function was used.
    Also it's not clear to me that there is always a solution,
    and, if there is, whether consistently choosing the
    furthest or the closest pairs will always work.
    The most obvious approach is to systematically try
    all possibilities until the answer is reached, or there
    are no possibilities left. This means backtracking whenever
    a point is reached where you cannot continue. In this case
    backtrack one step and try another possibility at this
    step. After all possible choices of the previous step,
    backtrack one more step and so on.
    This seems rather involved, and it probably is.
    Interestingly, if you know Prolog, it is ridiculously
    easy because Prolog does all the backtracking for you.
    In Java, you can implement the algorithm in much the same
    way as Prolog implementations do it--keep a list of all the
    choice points and work through them until success or there
    are none left.
    If you do know Prolog, you could generate lots of random
    problems and see if there is always a solution.

  • Problem with Quicktime...need help...

    I used to visit "VirusRadio.com" frequently and listen to old Opie and Anthony shows online, and never had a problem. Here lately (after installing XP Pro, I've noticed) I've been totally unable to stream content off this website. When I had Home Edition, I just downloaded quicktime and this site loaded perfectly, yet this isn't so on XP Pro. Maybe some of my firewall/Internet settings aren't correct, or maybe it's a quicktime issue...but I need help. I'm losing my mind trying to figure this out. Any help would be much appreciated. Thanks!

    These software conflicts could be due to some inconsistency the Leopard upgrade caused in the System folder. Doing a clean "Archive & Install" of Leopard will probably fix your problems.

  • Problem with My photo stream need help.

    Hi.I just use my photo stream with icloud control panel.First it's work,my pictures upload automatically to my pc but now when I take new photos,they are not sent.
    It was happened after I had deleted all my photo stream but my setting still same. I don't know the reason and need help.Thank regards.

    In my iPhone,at first my photo stream still uploaded but now when I took a photos,it didn't upload to my photo stream.

  • Gps problem with 5.0.1 NEED HELP

    Hello everyone.
    My Iphone 3gs New bootrom is updated to ios 5.0.1And now my gps has hugh problems.
    if i start navigon of tom tom he find me for a sec then iam gone and he cant find it.
    tried reinstalling it, network reinstalled, ios 5.0.1 reinstalled jailbreaked it and unjailbreak it.
    Nothing works, when i cal my carrier t-mobile they say send it to us and you pay fore the cost but iam not going to pay fore something i dindt broke right?
    read it in several forums and its a world wide problem. So called apple in holland the just say cal your carrier. Apple this stinks so what are you going to do?
    what can i do ??
    NEED HELP

    I think your iPad is a candidate for restoring via recovery mode. Read this article for instructions.
    http://support.apple.com/kb/ht1808

  • Re: Having some problems with the 8350i. Need Help Please!

    Everyone I talk to hears echo's. I also don't get text messenges until sometimes a full day after they're sent. I wonder if our geographic area dictates why this is happening..  if you search the forum for "echo" there's quite a few people with the same problem. I'm in Florida.

    How are you receiving the sms manually?
    If your device is new, proceed to change the device. 
    If I help you with any inquire, thank you for click kudos in my post.
    If your issue has been solved, please mark the post was solved.

  • Problem with my WLAN(N93)- need help.

    Hello guys,
    just recently with WLAN got problem. each time i want to start web browsing this message pop-up.. 'web:already in use'. actually what is the problem?

    In my iPhone,at first my photo stream still uploaded but now when I took a photos,it didn't upload to my photo stream.

  • Congiguring jsps with oracle8i,urgent reply needed

    Beginner for oracle8i ---need ur help
    I have installed oracle8i database server8.1.5 on winNT workstation which has Jserver to run java components.
    Please tell me how to run jsps with oracle8i.
    Ihave written certain jsp files but don't know where to put them and how to start the server to test them.This is an urgent requirement for my client,if anybody can help.
    A great thanks in advance.
    null

    Do you refer to the 9i AS Metadata Repository / iasdb?
    then,
    1) yes, if mid-tier components (like Reports) metadata is stored there
    2) do you consider your apps important?
    Also note that Infra. and Mid-tier installs should be backed up sync'd (both at same time). There is a paper on OTN about this.

  • Zen Vision:M problem, NEED HELP!

    My zen vision:m is starting to run slowly. It started right after my player froze and i reset it.Now its really slow and barely even switches screens sometimes.Right now its just a black screen with the keypad lit up.Whats wrong with it'sI NEED HELP!

    johnnnyp wrote:
    hi, i have a problem with my creative vision m. i wanted to watch a movie and it froze. i tried to shut it down but it wouldnt respond, and now is frozen. please help me if you can!
    You know its kinda rude to derail XBenzinoFla thread with your own problems, make your own thread next time.
    But to the both of you especially XBenzinoFla, try putting your ZVM in rescue mode and run scan disk to see if it hel
    ps.

  • Iphoto update is messed how, i do i fix it. Photos that i try to sync aren't showing up in my "Last Import" or "Last Month" What's wrong with it? I need help a.s.a.p

    please i need help on this. I really need to fix this

    Remember: we cannot see your machine. There are 9 different versions of iPhoto and they run on 8 different versions of the Operating System. The tricks and tips for dealing with issues vary depending on the version of iPhoto and the version of the OS.  So to get help you need to give as much information as you can. Basic things like :
    - What version of iPhoto.
    - What version of the Operating System.
    - Details. As full a description of the problem as you can. For instance: 'iPhoto won't export' is best explained by describing how you are trying to export, and so on.
    - History: Is this going on long? Has anything been installed or deleted?
    - Are there error messages?
    - What steps have you tried already to solve the issue.
    - Anything unusual about your set up? Or how you use iPhoto?
    Anything else you can think of that might help someone understand the problem you have.
    Posts that consist of "iPhoto doesn't work. Help" or "iPhoto won't print" or "Suddenly I have no photos!!!!!!!!!!" mean that any helper is simply guessing. More information means you get better assistance.

  • Header with 3 backgroud images, need help

    Hi! I'm learning Dreamweaver CC atm, and i am confused in building my header, i need help, if you got time for a beginner.
    First, i made a Wrapper Div, added an header div inside that include 3 more div. Each of those 3 div inside my header have a backgroud image: left side, middle side and right side. They are both relative, left and right have a fixed size. The right one float right of the screen. I have trouble with the middle div: it's a 1px width backgroup that reapeat on x. I cant find the way to make it reapeat up to the right div. How can i do it?
    I want my page width to adjust to the user screen.
    (sorry for my bad english, second language )
    Thx for your time and help!

    Copy & paste this code into a new, blank document.  SaveAs test.html and preview in browsers.
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>HTML5, Responsive Header</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <style>
        /**put this into your CSS Reset**/
        box-sizing: border-box;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
    #wrapper {width: 98%; margin:0 auto}
    header {
        width: 100%;
        margin: 0 auto;
        min-height: 50px;
        color: #FFF;
        text-align: center;
    #col-1 {
        width: 10%;
        float: left;
        background: #333;
        min-height: 50px;
    #col-2 {
        float: left;
        width: 80%;
        background: #A200A2;
        min-height: 50px;
    #col-3 {
        width: 10%;
        float: left;
        background: #333;
        min-height: 50px;
    .gradient {
    background: #000333;
    background: -moz-linear-gradient(left,  #000333 0%, #a200a2 16%, #a200a2 84%, #000333 100%);
    background: -webkit-gradient(linear, left top, right top, color-stop(0%,#000333), color-stop(16%,#a200a2), color-stop(84%,#a200a2), color-stop(100%,#000333));
    background: -webkit-linear-gradient(left,  #000333 0%,#a200a2 16%,#a200a2 84%,#000333 100%);
    background: -o-linear-gradient(left,  #000333 0%,#a200a2 16%,#a200a2 84%,#000333 100%);
    background: -ms-linear-gradient(left,  #000333 0%,#a200a2 16%,#a200a2 84%,#000333 100%);
    background: linear-gradient(to right,  #000333 0%,#a200a2 16%,#a200a2 84%,#000333 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000333', endColorstr='#000333',GradientType=1 );
    </style>
    </head>
    <body>
    <div id="wrapper">
    <h3>WITH FLOATED DIVS</h3>
    <header>
    <div id="col-1">10%</div>
    <div id="col-2">80%</div>
    <div id="col-3">10%</div>
    </header>
    <h3>WITH CSS BACKGROUND GRADIENT</h3>
    <header class="gradient">
    <h3>Heading 3</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.  Mauris vitae libero lacus, vel hendrerit nisi!  Maecenas quis velit nisl, volutpat viverra felis.  Vestibulum luctus mauris sed sem dapibus luctus.</p>
    </header>
    </div>
    </body>
    </html>
    Nancy O.

  • JSP/Servlet form processing problem - please help

    I'm using the apache.commons.fileupload library to process a form that will ultimately insert an image into an Oracle database. At the moment, I'm not even at the database stage although I have code to do it. I'm just trying to validate that all the form fields are filled out. A JSP page posts a form to a Servlet which then checks that each field contains something. If the field is null/empty, then I use a RequestDispatcher object to forward back to the JSP with the form on it.
    Here is the problem... If I intentionally leave the form empty then the Servlet does indeed send the user back to the JSP. However, if I then complete all fields in the form after being returned to the JSP and submit the form, I am forwarded back to the JSP rather than executing the next statement in the Servlet. It's as though once I have filled out the form the null entries are being retained and the new entries are being ignored.
    Can anyone help? Perhaps I am not understanding the request/response model properly as I am used to PHP programming?

    Can you double check? Suppose you just go to the JSP. Fill in all the fields as you did before. Submit the form. Does it go to the next statement in the servlet?

Maybe you are looking for