Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Anudeep Pat

Greenhorn
+ Follow
since Apr 09, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anudeep Pat

Ranchers need some help.

I am given a project in MVC with Swings.

I should develop a system's front end where the user is asked for his username and password. When he enters them correctly then he's asked a random question from a database which if he answers correctly will be logged in.

I have already done them using Swings but without MVC.( I hide the 1. Login page when the username and password and display 2. Random Question Page)

1. Login Page



2. Random Question




As I have started converting it to MVC I created a View, Controller and Model files for the login page.

I have created a second View file for the Random Question page and am planning to use the same controller and model file.( I dont know if its ok do it)

My questions are ,
a. Can I some how refresh the 1. Login Page and display 2. Random Question in the same window or do I have to use second View file?
b. How to add actionlisteners for radio buttons in MVC?
c. How to call the second view file and from where?

Code
View file:


Controller:


Model:


The program is not complete, but when I run I am displayed 1. Login page when I enter the correct username and password, it hides view1 but a NULL pointer error is shown and wont display 2. Random question view.

Any help/suggestion is welcome.
Thanks in advance!
11 years ago
Just got it, by declaring a String variable in the class and putting the answer into it and then sending it to the actionPerformed function where it can be compared to the selected value!!!

Here's the link that'll give you a rough idea!!!

http://forums.sun.com/thread.jspa?threadID=372477
11 years ago
I know that actionPerformed wouldnt return any value but I was wondering if there's a way around that.

Anyways, my concern here is that I want to compare the value selected from radio buttons against the one in the database!
11 years ago
Ranchers, need some help.

I am creating a Multiple choice Questionnaire using Java Swings connected to MySql.

And am trying to get actionPerformed return the value selected from a Radio Buttongroup because I am trying to validate if the chosen value of the radio button is right.

I put the answer field from the database into a label(if that helps). I dont even know if this is the right way to do it.

Suggestions please!!!
11 years ago
thanks a lot for the help!!

Hope it'll work!
11 years ago
JSP
Everything is compiling but I guess there's a problem comparing the value of the radiobutton selected to the hidden value am sending in the answer field
11 years ago
JSP
OK, thanks for the advice,

Removed the capitalization, but cannot move the javacode out of the JSP right now, so please give it a look!

Have a deadline to meet.
11 years ago
JSP
Hi,

I am a novice and am trying to create a login page. The flow is:

1.User enters username and password.

2. He is then asked a question from database which has radio buttons

3. The selected value should be checked against a radio button selected to allow the user to login.

The login part is ok, have a problem getting the answer for the question, also the answer which I took as the hidden value is displayed

Code for Question.jsp


And the code for Welcome.jsp


I am exhausted searching for the errors, can someone please help me!!!
11 years ago
JSP