sentil kumar

Ranch Hand
+ Follow
since Oct 23, 2006
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sentil kumar

Hi Sunil,
Please give a reference link for the struts approach

Thanks in Advance.
is there any way to call argumented constructor using useBean?
file 1 : jsp1.jsp
<jsp:useBean id="objRef" class="java.lang.String" scope="application" />

objRef = "hello";

file 2 : jsp2.jsp

<jsp:useBean id="objRef" class="java.lang.String" scope="application" />

out.println("bean value"+objRef);

why jsp2.jsp is not printing the bean value hello.

Thanks in Advance.

<form action="handle.jsp" method="post">
FirstName<input type="text" name="fname">
<input type="submit">


out.println("<h1> page start</h1>");

String param = request.getParameter("fname");
for(int i = 0; i < 10000; i++){
application.log("servlet ..."+param+i);
out.println("<h1> page end</h1>");

i have requested the form.jsp

i have given hello as a value in the text field then submit the form and
again submit the form when the first request is still processing by server.

please run the above sample code and see the server is executing the same funtion for two same request.

how to avoid the second submit when the server is processing the first submit still.

the above two listener must be implemented by attribute value object(objects set in the session object), so we need not mention in it in the DD.

please correct me if i am wrong
i like to download a xml file using servlet program.
please give some idea about this.
14 years ago
is SCWCD 1.5 available.
what is the latest version in the SCWCD.

Thanks in Advance.
Thanks a lot to Java Ranchers and K&B book authors.

my simple tips is , write more sample codes and understand how and why that result is coming.

14 years ago
if the method is redefined then it will not take part in the run time polymorphism.

please see your sample output.
why animals.add(new Animal()) is not allowed ?

if animals is pointing to new ArrayList<Dog>() and try to add new Animal() will lead to run time exception.
only lower bound class object only can be added in the animals reference.
class A {
interface I{
void show();
I aa1 = new I(){
public void show(){
System.out.println("anonymous inner class one method");
I aa2 = new I(){
public void show(){
System.out.println("anonymous inner class two method");
public static void main(String[] a1){
A a = new A();;;


I is a inner interface.
aa is pointing to Object of anonymous class which implements I.

after compiling the above code, you see three class file
A$I(nested interface).class,A$1(anonymous class).class,A.class(enclosing class)

compile and run the above sample code
Vector v1 = new Vector();
Vector v2 = new Vector();
System.out.println(v1.getClass() == v2.getClass());
Class c = Vector.class;

is both getClass() and Vector.class literal represent the same object.

class will be loaded in first object creation of that class.
for the next object creation of that class, the class will not be loaded again.

the class literal is used to get the run time information about that class.
whether class literal has any other usage?
what is class loading and where the class is loaded into.
why clone(),finalize() method is defined with protected modifier.
please expain the reason for this.
interface Interface1{
int toString();

D:\jdk1.5.0\bin>javac toString() in Interface1 cannot override toString() in java.l
ang.Object; attempting to use incompatible return type
found : int
required: java.lang.String
int toString();
1 error

D:\jdk1.5.0\bin>javap Interface1
Compiled from ""
interface Interface1{

Interface1 is not having any relation with Object.
why it is giving compile time error.