Anas Nashroel

+ Follow
since May 21, 2008
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 Anas Nashroel

I hope that I post in the right forum.
I took SCJP 1.4 examination in 2006 and I lost the certificate a couple of months ago. I need this certificate to apply for a job.

I tried to contact oracle university in my country a couple of days ago and I haven't gotten any reply yet from them.

Do any of you have similar experience ?
Any help would be greatly appreciated.
I don't know if I post on the right forum. I've heard about server side java scripting called rhino ....
I try to assign a button in a html/jsp page that will execute rhino java script (because I want to access java code)
How can I do this ?? Is it the usual way of handling onClick button event to our js code embedded in the html/jsp page ?
Thanks in advance
Hi, I installed jdk 1.4 and 1.5 on windows. I set JAVA_HOME to refer to jdk 1.5 installation folder. When I type java -version, it refers to jdk 1.5 installation.
and then, I downloaded and installed jdk 1.6. When the installation was finished, I type java -version in command prompt, and it refers to jdk 1.6 version. But strangetly, I looked at path environment variables, and I couldn't find path that leads to jdk 1.6 installation folder. The path is to jdk 1.5 installation folder.
So, how can i set the java version to use in windows ??
Thanks in advance
9 years ago

I develop simple web application. I have a problem with the login/logout page.

Here's my logout.jsp page:

This logout page includes navigation file (navigation.jsp) that contains menus that a user can acess. Here's the navigation.jsp file:

The problem is, I wanted to show the login link once a user has logged out. I used this logic in my navigation.jsp file:

I invalidate session in my logout.jsp file, so the session should be null. This meets the condition required in the "if logic" above (session == null), so the login link should be displayed. But somehow, it is not displayed..

Any help would be appreciated..

Dev. Environment
Windows XP sp2
Tomcat 5.5
JRE 1.5.0_15
9 years ago

Can you connect to the DB using the exact same code from a desktop application?

I haven't tried this...

have you enabled TCP/IP support on your server instance

I have read the manuals about How to manually enable TCP/IP on Windows XP sp 2 for SQL Server 2000
I added an open TCP port 1433 and name it SQL Server. I also added an open UDP port 1434 and name it SQL Server UDP.. However, the problem remains..
When I open command prompt and type netstat -an, both ports are not on the listening list. I also open the browser and go to the throws the same error..

Have you configured your server to allow SQL Server authentication?

How can i do this ??
I have a problem with using SQL Server 2000 with my application.
Here's the data access code:

and here's the error messages:

I have dropped jdbc driver (msbase.jar, mssqlserver.jar, msutil.jar) to the webapp lib folder
Are there any issues regarding connection to SQLServer 2000 through java application ??

Thanks in advance,

My spec:
Windows XP Professional
Tomcat 5.5
JRE 1.5.0_15
Thanks Prasad for a quick response...
I did manage to pass the request to the controller, and this controller passes the job to another method to do some processing (querying the database to select all students).
I then tried to forward the request object which contains studentColl attribute. This attribute contains the collection of student objects queried from the database.

I found no error until I tried to access this attribute from jsp page, student-list.jsp.
It throws these error:

here's the student-list.jsp code:

It seems that, when I tried to access the studentColl, it throws NullPointerException

Is the way I pass object/bean from controller to the jsp correct ??
If it isn't , how can I pass the beans from controller to a jsp page ??

9 years ago
I develop a dummy mvc2 web application for school administration. I created a jsp welcome page (index.jsp)that contains a link to list all student.
From this link, we will be directed to the controller servlet, namely SisdikController.
How can i create this link so the controller servlet gets called ??

Here's my controller servlet:

and here's my web.xml:

In the controller, the request will be routed according to the request parameter given. In this case, i want the request param value to be 1 (VIEW_ALL_STUDENTS). How can I pass this value in my anchor tag ??

Is this form of anchor tag a correct one ??

My development machine:
Windows xp
Tomcat 5.5
JRE 1.5
Thanks in advance..
9 years ago
Here's my file:

log4j.logger.solmit=ALL, A, A

log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

The problem is already solved, Ben...
Actually, I followed the instruction on log4j docs..
I created initialization servlet, Log4jInit.class, that initializes log4j and loaded on startup...
This initialization class looks like this:

public class Log4jInit extends HttpServlet {

void init() {
String prefix = getServletContext().getRealPath("/");
String file = getInitParameter("log4j-init-file");
// if the log4j-init-file is not set, then no point in trying
if(file != null) {

void doGet(HttpServletRequest req, HttpServletResponse res) {

and adding this entry to web.xml file:




In the class above, the static method configure(java.util.Properties properties) of PropertyConfigurator class is called to initialize log4j

When the tomcat starts, the logs are printed to stderr_20080522.log
I put it in <my-web-app>/WEB-INF/classes on my web application
Hi Ben,
Thanks for the reply. After I changed as what you said, I managed to display the output from the servlet. But, the error log4j configuration still remains..and no debug messages appear on my log file.
Error from stderr_20080522.log:

log4j:WARN No appenders could be found for logger (org.apache.catalina.startup.Embedded).
log4j:WARN Please initialize the log4j system properly.

How do we actually setup log4j in our web apps ??
Does anyone have the same experience ??
Hi all, I'm a beginner to web application
I tried to create a simple web application, namely WebTest. It only contains one servlet, like this:

package solmit;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;;

public class WebTest extends HttpServlet {
private static Logger log = Logger.getLogger(WebTest.class);

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
log.debug("anas: about to enter doGet");
PrintWriter writer = response.getWriter();

writer.println("<html><head><title>Simple Web Application</title></head>");
writer.println("<body><h1>A Simple Web Application</h1>");
writer.println("Here's some text...<br>...and a bit more text");
log.debug("anas: about to leave doGet");

My web.xml file looks like this:

I also created file in <web-app>/WEB-INF/classes directory. It contains the following code:

I packaged this application into WebTest.war.
When I dropped this package into my Tomcat (Tomcat 5.5), and tried to access web app using this url :http://localhost:8080/WebTest/start-web-test
I got error messages on my stderr_20080522 log:

Oh, I've also dropped log4j-1.2.13.jar and commons-logging-1.0.4.jar on Tomcat/common/lib
I've read tomcat documentation on logging.. but it seems that it doesn't give me some clue to use log4j logging in my application ("http://localhost:8080/tomcat-docs/logging.html")
I've also already read the documentation about log4j on ""
Could someone give an insight on this ??
Any help would be appreciated
Tomcat 5.5
Jre 1.5.0_15
Windows XP Prof edition