ERRor:Requested Source not available

Reply

Join Date: Jun 2008
Posts: 142
Reputation: ishlux is an unknown quantity at this point 
Solved Threads: 0
ishlux ishlux is offline Offline
Junior Poster

ERRor:Requested Source not available

 
0
  #1
Sep 2nd, 2009
Hi,

I have deployed my folder called Library in web apps tomcat5.5, i can find my folder in the tomcat manager, but when i click its showing this error: requested source in not available (Library)
As i am new to this i dont know how to proceed please help me out.


i given my code below.
in folder library
i have created 2 more folder WEB-INF and html file
In WEB-INF- src,classes,web.xml
  1.  
  2. so in html file the fallowing code is written
  3. <html>
  4. <head><title>Login Page</title></head>
  5. <body>
  6. <form method=get action="/servlets/login">
  7. <table>
  8. <tr>
  9. <td>Name: </td>
  10. <td><input type="text" Name="name"></td>
  11. </tr>
  12. <tr>
  13. <td>Password:</td>
  14. <td><input type="password" Name="password"></td>
  15. </tr>
  16. <tr>
  17. <td><input type ="submit" value="submit"></td>
  18. <td>&nbsp;</td>
  19. </tr>
  20. </table>
  21. </body>
  22. </html>
in src file the following code is written
  1. import java.io.*;
  2. import javax.servlet.*;
  3. import javax.servlet.http.*;
  4. public class valid extends httpservlet
  5. {
  6. public void doGet(HttpServletRequest res, HttpservletResponse res)throws IOException, ServletException
  7. {
  8. res.setcontent type("text/html");
  9. PrintWriter out = res.getWriter();
  10. String name = req.getParameter("name");
  11. String password = req.getParameter("password");
  12. out.println("<html>");
  13. out.println("<head>");
  14. out.println("<title> login page </title>");
  15. out.println("<body>");
  16. out.println("Name "+ name);
  17. out.println("<br>");
  18. out.println("your password is " + password );
  19. out.println("</body>");
  20. out.println("</html>");
  21. out.close();
  22. } //end of service
  23.  
  24. } //end of class
in web.xml the fallowing code is written
  1. <web-app>
  2. <servlet>
  3. <servlet-name>firstservlet</servlet-name>
  4. <servlet-class>valid</servlet-class>
  5. </servlet>
  6. <servlet-mapping>
  7. <servlet-name>firstservlet</servlet-name>
  8. <url-pattern>/login</url-pattern>
  9. </servlet-mapping>
  10. </web-app>
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: ERRor:Requested Source not available

 
0
  #2
Sep 2nd, 2009
That happens because when you click on your web application directly from tomcat, it goes to the ROOT of your web application and unless you have a set a welcome page in your web.xml ( or enabled directory listing) you are bound to get that error.

So to actually display your html page in your browser you would have to type "http://localhost:8080/<webappfolder>/<htmlpage>"
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC