hep me

Alles, was den Apache betrifft, kann hier besprochen werden.

hep me

Postby anynomouses » 04. November 2006 05:04

i write a file.

import java.util.*;

public class UserDataTable
protected static Hashtable userData = new Hashtable();
protected static Random keyGenerate = new Random();
public static String createUserData()
String userKey = ""+keyGenerate.nextLong();
userData.put(userKey,new Hashtable());
return userKey;
public static Hashtable getUserData(String userKey)
if(userKey==null) return null;
return (Hashtable)userData.get(userKey);
public static void clearUserData(String userKey)
if(userKey==null) return;

and i used it same a library.
and write a file login.jsp:

<%@page language="java" import="java.util.*" %>

String userName = request.getParameter("username");
String passWord = request.getParameter("password");
String userKey = UserDataTable.keyGenerate();
Hashtable userData = UserDataTable.getUserData(userKey);
Welcome! <%=userName%><br>
<form action="/webdir/bookservlet">
<input type="hidden" name="userKey" value="<%=userKey%>"><br>
Please enter your favorite book:
<select name="book">
<option value="C">C/C++</option>
<option value="java">Java</option>
<option value="XML">XML</option>
<option value=".NET">.NET</option>
<input type="submit" name="submit" value="Choose Book">

2 file put in directory ROOT of TomCat
but when i used tomcat to run login.jsp.
notice error :
E:\Program Files\Apache Software Foundation\Tomcat 4.1\work\Standalone\localhost\_\login_jsp.java:46: cannot find symbol
symbol : variable UserDataTable
location: class org.apache.jsp.login_jsp
String userKey = UserDataTable.keyGenerate();

hepl me.
Posts: 1
Joined: 04. November 2006 04:52

Return to Apache

Who is online

Users browsing this forum: No registered users and 5 guests