Gil Li

Greenhorn
+ Follow
since May 27, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gil Li

hello people
i wrote a nested JSP custom tag file.when I compile the inner tag java file, it shows the compilation error as

C:\tomcat-4.1.29\webapps\examples\WEB-INF\classes\tagExamples\inTag.java:20: cannot resolve symbol
symbol : class nameTagHandler
location: class tagExamples.inTag
nameTagHandler parent =(nameTagHandler)findAncestorWithClass(this, nameTagHandler.class);

I have given below the inner tag java file. nameTagHandler file compiled successfully.both are in same tagExamples package.Help me.


package tagExamples;

import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;

public class inTag extends BodyTagSupport
{






public int doStartTag() throws JspTagException
{
try
{

JspWriter out=pageContext.getOut();
nameTagHandler parent =(nameTagHandler)findAncestorWithClass(this, nameTagHandler.class);

out.println(parent.getName());




}catch(Exception e){System.out.println("start "+e.toString());}
return(EVAL_BODY_INCLUDE);

}



}
17 years ago
JSP
Hello people
I heard that constructor doesnot return anything.But I tried the following code. I cant understand the real thing about constructor.Help me.


/*
This code compiles without any problems
*/

class sample {

public int sample()
{

return 5;
}


public static void main(String a[])
{

}

}
17 years ago
Hi

here the "int" will be printed because the ascii value will be passed. U can print the value i to know it ..
Thats it...


Thankyou Thomas...
hello people

I used bodycontent element in my TLD file to access the bodyContent of the custom tag. when I start my tomcat 4.1.29 webcontainer the server starts with exeception. I have given below the TLD file segment..
I did not use angled brackets here as javaRanch does not support that..


taglib
tlibversion 1.0 /tlibversion
jspversion 1.1 /jspversion
shortname ramtag /shortname
uri ramesh taglibrary /uri
info This is information about Ramesh tag Library /info

tag
name name /name
tagclass tagExamples.nameTagHandler /tagclass
info Returing Name Value /info
bodycontent JSP /bodycontent



attribute
name name /name
required false /required
rtexprvalue true /rtexprvalue

/attribute
/tag
/taglib


help me to know where is the problem....
[ September 21, 2004: Message edited by: Gil Li ]
17 years ago
JSP
Jyothi...

I am using the latest version mySQL 5.0 which supports stored procedure. But I am not able to invoke the stored procedure via JDBC...I dont know where is the problem....
hi
I have added a stored procedure in mySQL database. that stored funstion just gets the input integer and gives with adding number 10.When I execute in mySQL promt that works fine. I tried Java code to get the output. Here is the code. Here i got Exception like 'CallableStatements not Supported' . I dont know what is the problme here. Help me..


import java.sql.*;
import java.io.*;

public class proc
{
public static void main(String a[])
{
try
{

Class.forName("org.gjt.mm.mysql.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/jobsearch?user=root&password=");
CallableStatement cs = con.prepareCall("{? = call pr(?)}");


cs.registerOutParameter(1,Types.INTEGER);
cs.setInt(1,5);

cs.execute();

System.out.println(cs.getInt(1));


} catch(Exception e){ System.out.println(e);}



}
}
Hi

I cant see any problem in this code.The thing is type of mySQL storage Engine. The default storage engine is myISAM.This does not support transcation management. You have to change the type of storage engine into InnoDB or BDB. Refer mySQL manual to change the storage engine type. That will work fine..
Hello people..
I have set a value to System property like
System.getProperties().put("name","ram");

in one servlet and I got exactly the value of the key "name" in
another servlet by using..

System.getProperties().get("name");

But When I do this in normal java file and access the value in anotherjava file I did not get the value.It returns null.Actually when we set theSystem Property value that will be stored in JVM. So why that value is notget in ordinary java files.It works well in servlets.Please clear my doubt.
17 years ago
hello people..
I wrote a java code to know the transaction process. I clearly set the
AutoCommit into false. Then I forcibly disable the commit just for checking purpose.
But the database changes whenevewr the statement executes. I have given below the code.
It should not update the database .But it does.I dont know where I am missing the technical things..
Please Help me...



import java.sql.*;
import java.util.*;


public class tranc
{
public static void main(String a[])
{
try
{

Class.forName("org.gjt.mm.mysql.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/tech?user=root&password=");

con.setAutoCommit(false);


Statement st1=con.createStatement();
st1.executeUpdate("update topic_details set topic='ram' where tid=11");


Statement st2=con.createStatement();
st2.executeUpdate("update topic_details set topic='ram' where tid=9");




if(false)
{
con.commit();
System.out.println("success");
}else
System.out.println("fail");


} catch(Exception e){ e.printStackTrace();}



}
}
Thankyou Bibeault ....Hope this name matches with your rules....
Your site doing excellent job for Java aspirants....Best wishes and keep it up...
[ June 03, 2004: Message edited by: Gil Li ]
18 years ago
JSP
hai david..

I am just entry level to JSP and servlet.I could not understand the things what you told regarding class loaders.Can you please explain me in a simple way....?
18 years ago
JSP
hello people...
I have a doubt in web container design.When we use JSP ,that page
will be converted into servlet and executed.The web container executes the updated JSP without restarting web container.But when we use servlet most of the web containers need to be restarted(Eg : Apache Tomcat),Some servlet provieds indirect reloading operations (Eg : Blazix provides URL to update servlet class). what may be the resons that they cant provide automatic class updation while they provide for JSP(which will be converted in to servlets).Please let me know the things happening here. Thanks in advance.
18 years ago
JSP
Hello people..

is there any possibility to get a IP address of paticular website in Java.I have tried using InetAddress package in Java.net . But I did not get..Please give me idea
18 years ago