aspose file tools*
The moose likes Servlets and the fly likes Help with servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Help with servlets" Watch "Help with servlets" New topic
Author

Help with servlets

Eassam Ashraf
Greenhorn

Joined: Oct 17, 2008
Posts: 5
Hi,

I am required to do the following tasks as part of a small project for a hotel I am working on currently and I need some help on how to go about doing them:

The requirements are:

-register and login facilities for different users. (Have done the register servlet, need help with the login.)

-Provide facilities to allow different levels of security for users access.

-Hotel staff have administration access and can view a secure part of the website to :
-Log on to site using password facility
-View, insert, update customer, room bookings and service bills related to the Best West database
-Delete customer room bookings

-A facility to randomly pick customers to receive special gift packs for using the site and notify these customers of their gift

-A ticker tape facility which scrolls hotel service information and promotions (accessed dynamically from the database) across the website at regular intervals

Any help would be appreciated on this.

Also I have created a booking servlet with the register one and it seems both of them dont seem to do anything once I press the submit button on the designated page, how can I have multiple servlets functioning from the one project.

I am using Netbeans 5.5 with Tomcat.

PS. I am happy to provide any code required.
[ October 17, 2008: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

So what's your question? What has you blocked? Sounds like you know what you need to do -- start writing the code and come here for help with problems you run into.

If you are waiting for someone here to do your work for you, well, that's just not going to happen.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eassam Ashraf
Greenhorn

Joined: Oct 17, 2008
Posts: 5
Well here is what I have done so far:

HTML pages:






Java classes:


















My servlets:





Now as you can see I have done the register and the booking part of it for the customer, what I want to know is how to make multiple servlets work as when I only had the register servlet it was working as soon as I created the booking one, both of them dont work:

here is my web.xml:


From there Login servlet should suffice how do I go about creating one?

Also I have no clue how to do the different security levels and the ability to do the random awards and ticker tape..I need an example to get me going.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

OK, showing us pages and pages of code, and then asking vague questions isn't going to get you far.

Do you really expect people to take the time to read through all that code? In a forum such as this, you can ask for ideas, or you can ask for specific answers to specific questions, but posting an entire application and saying "now what?" isn't going to help you much.

Please ask specific questions or ask for guidelines on how to think about a particular problem.

Pick the next part of the application that you will work on, figure out what has you blocked, and we can take it from there.
Eassam Ashraf
Greenhorn

Joined: Oct 17, 2008
Posts: 5
Okay..I can see where you are coming from as I am taking the discussion in different places at once, lets focus on one problem.

I need an idea so that I can create a different levels of security for access. What methods and parameters do I have to include in order to achieve this?
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
I think that you are looking for "DoItFOrMeRanch" not JavaRanch
Eassam Ashraf
Greenhorn

Joined: Oct 17, 2008
Posts: 5
:roll:

I am not asking anybody to do it for me..I just need an example to work with. I was hoping someone would provide that example..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

Originally posted by Eassam Ashraf:
I need an idea so that I can create a different levels of security for access. What methods and parameters do I have to include in order to achieve this?

Well, you might want to look into the container-managed authentication and roles provided by the Servlet Specification.

Personally, I find that too limiting and build my own authentication and role system from scratch.

The basics of what I set up:
  • There are a number of "permissions" that grant thr right to perform a certains task. For example: "can delete records", or "can adminsiter users".
  • Roles are a collection of permissions that make logical sense as a group. For example: "Adminstartor", "Power user", or "Guest".
  • Users can be assigned to one or more roles.
  • If applicable, users can also be assigned to groups, which can be assigned roles.

  • It's not a trivial task to set up such a system. I know of no off-the-shelf solutions.
    Eassam Ashraf
    Greenhorn

    Joined: Oct 17, 2008
    Posts: 5
    Thanks, that's what I was looking for!
    asdf lkjh
    Greenhorn

    Joined: Oct 17, 2008
    Posts: 12
    This is indeed not-so-easy to implement task. You will need to create 3 separate entities in the system:
    1) User Group:
    2) Permissions:
    3) User:

    Then, define/assign permissions to each user group, and assign user to the group. You can at the time of log-in set the user group into the session and perform the checks based on that. I have implemented such a system and know the pain of it. I would be glad to help you further. wish you all the luck
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60991
        
      65

    "Shuki", please check your private messages for an important administrative matter.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Help with servlets