Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9205969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:04:46+00:00 2026-06-18T00:04:46+00:00

I have this little java project in which I have to use jsp files.

  • 0

I have this little java project in which I have to use jsp files.
I have an html with a login button that triggers the following function:

var loginCall = "user/login";
var logoutCall = "user/logout";
var signupCall = "user/signup";

function login() {
var login = baseUrl + loginCall + "?";

var loginFormElements = document.forms.loginForm.elements;

login = addParam(login, USER_NAME, loginFormElements.userName.value, false);
login = addParam(login, PASSWORD, loginFormElements.password.value, true);

simpleHttpRequest(login, function(responseText){

    var status = evalJSON(responseText);

    if (status.errorCode == 200) {
        var res = status.results;
        var sessionId = res[0].sessionId;
        setCookie(SESSION_ID,sessionId);
        window.location="http://localhost:8080/"+baseUrl+"/main.html";
    } else {
        showError(status.errorCode, "Username or password was incorrect.")
    }

}, function(status, statusText){console.log('z');    
    showError(status, statusText);
});
}

As far as I can see a httpRequest is made and sent with data to baseUrl + loginCall, meaning localhost/something/user/login?name=somename&pass=somepass

This is where I’m stuck, do I have to make a java file somewhere somehow, that takes the request information, works it up with the database and returns an answer?
If so, where, how? Do I have to name it login/user.java?

Can anyone point me to the right direction, if not give me some code example or explanation of what I have to do next?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:04:47+00:00Added an answer on June 18, 2026 at 12:04 am

    You need to have another look at the JSP MVC
    The jsp page should hold the html and javascript and java code. If you want to call a separate .java class, you need to write that class as a servlet then call it.

    So in your .jsp you have you html and javascript just like you have it there, then any java you include in these brackets <% %>

    Have a look at the tutorials here http://www.jsptut.com/

    And i see your doing a login page. I used this brilliant tutorial for creating a log in system which helped me understand how jsp and servlets worked.
    http://met.guc.edu.eg/OnlineTutorials/JSP%20-%20Servlets/Full%20Login%20Example.aspx

    Also check out this image which should help you understand the concept. Remember servlets are pure java classes, used for mostly java but can also output html, jsp’s are used for mostly html (& javascript) but can include jsp. So the servlets do the work, then the jsp gets the computed values so that they can be utilized by JavaScript. that’s how i think of it anyway, may be wrong
    http://met.guc.edu.eg/OnlineTutorials/static/article_media/jsp%20-%20servlets/LoginExample%20%5B4%5D.jpg

    All the best

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this little problem, that I cannot figure out which arguments to pass
I have this nice little MSBuild-based daily build setup that I use on my
so I have this project in java that uses a jni .dll i wrote
I have this little question that's been on my mind for a while now.
I have this little NetStream movie (which I'm not allowed to show, sorry) set
I have this little script that shows one wisdom each day. so I have
have written this little class, which generates a UUID every time an object of
I have this easy little form in my JavaFX application. I want to use
I have a little Java project where I've set the properties of the class
I have a little Android project going on which involves some IPC where client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.