File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

login page connectivity

 
Arpit Badaya
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understood now....
But could you please tell me where i'm doing mistake .!!!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 179
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic