473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help with using a bean with a servlet

Hi...

I have written the java bean below to use with my login servlet but I can't seem to find out where to retrieve my hash table results..

Expand|Select|Wrap|Line Numbers
  1.  
  2. import java.lang.String;
  3. import java.util.Hashtable;
  4. public class Log{
  5.  
  6. protected Hashtable Details = new Hashtable();
  7.  
  8. private String Email ;
  9. private String Password;
  10.  
  11. public Log(String E, String p){ Email=E; Password=p;}
  12.  
  13. public void addDetails(String Email, String Password) {
  14.  
  15.         if (Details.containsKey(Email)) {
  16.  
  17.             String[] tmpEmail = (String[])Details.get(Email);
  18.             String[] tmpPassword = (String[])Details.get(Password);
  19.          }
  20.  
  21.         else { String[] Member = {Email, Password};
  22.  
  23.             Details.put(Email, Member);
  24.             Details.put( Password, Member);
  25.             }
  26. }
  27.  
  28.  
  29.  
  30.  
  31.  
  32. }
  33.  
Thanks in advance...
Feb 22 '07 #1
1 1335
r035198x
13,262 8TB
Hi...

I have written the java bean below to use with my login servlet but I can't seem to find out where to retrieve my hash table results..

Expand|Select|Wrap|Line Numbers
  1.  
  2. import java.lang.String;
  3. import java.util.Hashtable;
  4. public class Log{
  5.  
  6. protected Hashtable Details = new Hashtable();
  7.  
  8. private String Email ;
  9. private String Password;
  10.  
  11. public Log(String E, String p){ Email=E; Password=p;}
  12.  
  13. public void addDetails(String Email, String Password) {
  14.  
  15.         if (Details.containsKey(Email)) {
  16.  
  17.             String[] tmpEmail = (String[])Details.get(Email);
  18.             String[] tmpPassword = (String[])Details.get(Password);
  19.          }
  20.  
  21.         else { String[] Member = {Email, Password};
  22.  
  23.             Details.put(Email, Member);
  24.             Details.put( Password, Member);
  25.         }
  26. }
  27.  
  28.  
  29.  
  30.  
  31.  
  32. }
  33.  
Thanks in advance...
Your question is not very clear. If you want to use this to add emails when form is submitted to servlet, then you retrieve the values from the servlet.

I don't see why you are using a Hashtable with arrays.
Just Hashtable<String email, String password> can store the emails and their corresponding passwords.
Feb 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Grant Collins | last post by:
Hi I am writing a web based application as part of a small project that I am undertaking using servlets beans and jsp. I already have one servlet - bean - jsp page working and I have written...
9
by: Russ Perry Jr | last post by:
I'm using "ID" and "Value" in the generic sense here... Let's say one page I had a <html:select> with a collection like this: <html:options collection="items" property="key"...
0
by: brent | last post by:
Hi there... I have a stateless Session Bean issuing a select for a BLOB column. This bean is using a CachedRowSet. It seems to work for all other columns types other than a BLOB. Selecting a...
2
by: peterkay | last post by:
MyBean bean = new MyBean(categoryForm, PriceForm); request.setAttribute("valid", bean); System.out.println(bean); List vids =MyBean.getVideos(categoryForm, PriceForm); I have a servlet...
1
by: prasath03 | last post by:
I'm new to JSP, and am trying this sample code for instantiating a bean for use in a disconnected ResultSet, i placed the rowset.jar under WEB-INF/lib directory but i get the following error: ...
0
by: jaisi | last post by:
What iam exactly trying to do is..saving the resultset in a bean.....and calling the bean in a servlet and forwarding it to jsp by setting the bean in the request scope; Now i have only one record...
1
by: hostel | last post by:
HTML PAGE <html> <body> <form action="second.jsp" method="get"> YOur name <input type=text name="name"> <input type=submit > </form> </body> </html>
2
by: vijaykumardahiya | last post by:
Hello Sir, I have a simple Issue but It is not resolve by me i.e input parameter are not store in Ms-Access. I store the input parameter through Standard Action <jsp:useBean>. jsp:useBean call a...
9
by: mjahabarsadiq | last post by:
Hi I have created a servlet that is to be started at the server startup. And I got it. In that I have created a object of another class and set it as a session attribute. What I am trying is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.