File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes login page connectivity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "login page connectivity " Watch "login page connectivity " New topic
Author

login page connectivity

Arpit Badaya
Greenhorn

Joined: Oct 28, 2011
Posts: 4
Hello.................I'm new at this platform so please help me to develop this code.
i wrote a basic jsp page for login purpose and give forward action to the servlet...but servlet is not responding anything after compiling and running that JSP file...JSP file does not have any error

I'm writing my servlet code here...please help me out.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61449
    
  67

Have you read through the ServletsFaq? There's an entry that addresses servlets not responding. One of the most likely reasons is failing to put the servlet in a package other than the default.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61449
    
  67

And here a few more things to help you and your code along:

Arpit Badaya wrote:Hello.................

English sentences terminate with a single period character, not 16.

i wrote a basic jsp page for login purpose and give forward action to the servlet

Are you really forwarding from a JSP to servlet, or submitting a form to the servlet? If the latter, be sure to be precise. Programming is all about accuracy and precision. This should extend to your speech about it.

public class admincheck extends HttpServlet {

Class names should always follow expected conventions; so AdminCheck, not admincheck.

protected void processRequest(HttpServletRequest request, HttpServletResponse response)

This likely means that you are treating GET and POST the same. Bad practice.

String a=request.getParameter("user");//Username for my JSP page
String b=request.getParameter("pass");//Password for a JSP page

Surely you can come up with better variable names than a and b?

out.println("<html>");

Emitting HTML from a servlet is also not a great practice. Your servlet should do it's work then let a JSP create the view.
Arpit Badaya
Greenhorn

Joined: Oct 28, 2011
Posts: 4
I understood now....
But could you please tell me where i'm doing mistake .!!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61449
    
  67

Your action is wrong. See the ServletsFaq as advised. Your action should start with the context path, which should be followed by the servlet path (that was mapped in the web.xml).
Arpit Badaya
Greenhorn

Joined: Oct 28, 2011
Posts: 4
Currently i'm using Netbeans tool for developing purpose.
SO there are few tags which came automatically in the code file.
I've done all the possible ways to short out this problem but couldn't succeed.
Can you please tell me step by step, it's a request please
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61449
    
  67

I already told you what you need to do to make the action correct. More information is available in the ServletsFaq.

if you can't figure out how to change code for yourself without an IDE generating it for you, you're not ready to be writing servlets.
Arpit Badaya
Greenhorn

Joined: Oct 28, 2011
Posts: 4
I did all the changes,whatever you told me to do but here after that thing is not working out
showing "error 500" by the servlet
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61449
    
  67

A 500 error does not mean a connectivity error, -- t means that another exception was thrown while the servlet was processing.

Please include the details of the error with he exact wording of the error and the relevant portion of the stack trace.
Vishal Shaw
Ranch Hand

Joined: Aug 09, 2012
Posts: 179
Hi Arpit,

Please quote the error from log as Bear suggested that would make life simpler for all of us. Also you can go on adding tracker in your servlet and checking the log entry for those trackers for finding out the line which is causing the trouble.

Regards,
Vishal.


Programming is about thinking, NOT coding
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: login page connectivity