Deenesh,

3 tips, for what they are worth:

1) follow the JavaBean specifications when creating a JavaBean. The
class should be serializable, for example.

2) naming conventions: bean properties should start with a lowercase
character. In your bean, setRollNo is the setter for property rollNo.
Also look at naming conventions for classnames etc (usually start with
uppercase).

3) usually it works well but setting ints, longs, etc from a JSP page is
counter-intuitive to me. After all, all a JSP form sends in its request
is text/Strings. That's why I write my setters and getters so that they
accept/return Strings, with parsing contained in the method. So
something like this:

private int RollNo;

public void setRollNo(String num){
        this.RollNo=Integer.parseInt(num);
}
public String getRollNo(){
        return String.valueOf(RollNo);
}

As for your error: there probably is a root cause in your stacktrace
that should tell you more specifically what went wrong (like a
NullPointerException or some other kind of exception). In any case, it
has nothing to do with Tomcat if you ask me.

Tom
 

-----Original Message-----
From: Dinesh Keesara [mailto:[EMAIL PROTECTED] 
Sent: jeudi 23 septembre 2004 13:12
To: [EMAIL PROTECTED]
Subject: small but complex problem -jsp.error.badaction when accessing a
bean from a jsp 




Hey can anyone solve this ......

I am using Tomcat 4.1.30 on IE
I am Getting following error :

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: /idcard.jsp(5,5) jsp.error.badaction
at 
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHand
ler.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.parseAction(Parser.java:671)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:803)
at org.apache.jasper.compiler.Parser.parse(Parser.java:122)

and  blah blah blah ..........

the jsp file looks as follows:

<html>
<head>
</head>
<body>
<@page import="com.dinesh.idcard" >
<jsp:usebean id="myidcard" scope="page" class="com.dinesh.idcard">
<jsp:setProperty name="myidcard" property="RollNo" value="123" />
<jsp:setProperty name="myidcard" property="Name" value="Harikiran" />
</jsp:usebean>
<%=myidcard.getName()%>
<br>
<%=myidcard.getRollNo()%>
</body>
</html>

and the bean file looks as follows:

package com.dinesh;
public class idcard{
private int RollNo;
private String Name;
public void setRollNo(int num){
this.RollNo=num;
}
public int getRollNo(){
return RollNo;
}
public void setName(String Name)
{
this.Name=Name;

_________________________________________________________________
The new MSN toolbar! Your shortcut to the internet! 
http://toolbar.msn.co.in/ Access a world of convenience!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to