• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Username and Password to match "Select" code

 
Luis Cardenas
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys I am new to this place,
I have 2 simple questions (Java Newbee here) I have a database named school.
1. What I want to do is when I enter a certain username and password it shows me my grades (Like math, history bla bla) and which
classes I'm in according to my current grade (6th grade, 7th grade) my database is connected and that and If the username and password is
in the db I can enter the next page, but how can I show those values? The same thing goes with teacher that he enters with a username and
password and he, according to his class can put up grades to his students (only the ones that are in that class)

PS: I already did the foreign key thingy and they are already related

2. My second question is the same thing for grades, but with class attendance

Hope you guys can help this newbee!
 
Dave Tolls
Ranch Hand
Posts: 2095
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question 1 covers a lot of areas.

Start from the beginning.
Given a username and password can you check it is valid?

Don't worry about other data or paging or any of that.
No point thinking too deeply on that side of things if you can't even log on...
 
Campbell Ritchie
Sheriff
Posts: 51368
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... and welcome to the Ranch
 
Knute Snortum
Bartender
Pie
Posts: 2897
62
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you need help with the SQL or the Java code or both?  If you've written any Java code, can you post it?  (And please UseCodeTags.)
 
Luis Cardenas
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, idk how to personally reply hahaha

Dave Tolls - I can log in, I put my username and password and it does verify and that, I have that good to go

Campbell Ritchie - Thanks man I think I am going to learn a lot from the big guys!

Knute Snortum - the SQL I got it good, I need help frist trying to, when I log in it shows my grades and classes I have for that student that logged in
 
Dave Tolls
Ranch Hand
Posts: 2095
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK.
So the next step is to read the data you want to display for that log in.
Have you got Java code that works with that?

That would (IMO) involve having a class model that represents the data.
 
Luis Cardenas
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:OK.
So the next step is to read the data you want to display for that log in.
Have you got Java code that works with that?

That would (IMO) involve having a class model that represents the data.


Yeah but that is in a new JSP, like my Login.jsp, I log in with a username that I have, for example
Username: 'a10001'
Password: 'heythere'

and In my new jsp, let's say Info.jsp, I don't know how to import the username I logged in ('a10001'), so that I can do
a "select 'bla bla bla' from student, logger where usernameStudent = 'a10001') something like that, like I don't know how to use
the same variable that I correctly matched the login
 
Knute Snortum
Bartender
Pie
Posts: 2897
62
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't you do that in the JSP page?  (I could be wrong; I'm not a JSP expert.  I added this thread to the JSP forum.)
 
Dave Tolls
Ranch Hand
Posts: 2095
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At the moment this has nothing to do with JSP pages.
I'm just trying to see which parts of your question you actually have issues with.

OK, so you can log in via your servlet.
So store the User id that is logged in into the Session.
That way you can access the id each time a new request comes in.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic