NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How to run servlet in netbean 6.8

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
pinga123



Joined: 12 Nov 2009
Posts: 4

PostPosted: Tue Aug 03, 2010 2:29 pm    Post subject: How to run servlet in netbean 6.8 Reply with quote

I m trying to run a simple servlet but it seems my browser is not able to connect with glassfish server.
Since this is my first attempt to run servlet i know very little about the configuration.
i have created html file under.
WebApplication2
WEB PAGES
>>>>WEB-INF
>>>>>>>newhtml.html
content of newhtml.html
Code:

<html>
<head>
<title> First Servlet Attempt </title>
</head>
<body>
<form method = get action="http:\\localhost8080\example\servlet\NewServlet">

enter no :<input type=text  name=txtNo>
<input type="Submit" value ="submit">
</form>
</body>
        </html>

Servletcode is written under
WebApplication2
WEB PAGES
>>>>Source packages
>>>>>>>>Default packages
>>>>>>>>>>>NewServlet.java
content of NewServlet.java
Code:
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;

public class NewServlet extends HttpServlet
{
    public void doGet(HttpServletRequest  req,HttpServletResponse res)throws IOException,ServletException
    {
        PrintWriter pw=res.getWriter();
        res.setContentType("text/html");
        pw.println("Hello");
        pw.close();
    }

}


My problem is when i right click on html file and say run file it opens my internet explorer with following address
http://localhost:8080/WebApplication2/newhtml.html
but Error comes as "The webpage is unavailable because you are offline".
When tried using mozilla another error message occurs.
Also when i uncheck work offline from internet explorer and refresh the same url it says .
Quote:
The webpage cannot be found
HTTP 400
Most likely causes:
•There might be a typing error in the address.
•If you clicked on a link, it may be out of date.

What you can try:
Retype the address.


Go back to the previous page.

Go to and look for the information you want.



connection setting for explorer is set as automatically detect.
Please suggest as admin page of glassfish uses 4848 port .
Im confused what to do?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo