2

I am new to apache tomcat. I am running apache tomcat in my windows machine.I am having a html containing file upload control.Using that i should allow others to upload documents.I am having another div in same html to list the uploaded files. While listing the files, i want to display the ip address from where its uploaded. Note the uploaded documents should store in my local drive. Guide me in doing this..

I want to know how to add servlet and jsp in apache tomcat and how to call it form html. Thanks in advance...

2 Answers 2

1

you can get ip in servlet by

// This method is called by the servlet container to process a GET request.
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // Get client's IP address
    String addr = req.getRemoteAddr(); // 123.123.123.123

    // Get client's hostname
    String host = req.getRemoteHost(); // hostname.com
}

and you can show in html page, you can save in database as wel

Sign up to request clarification or add additional context in comments.

Comments

1

Hints:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.