|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Hi, i am doing my project in wap technology. I am struck up in initial stage. I am trying to get username and password from wml page and directing it to servlet. But my browser says
" Cannot load http://localhost:8080/LoginServlet(Http 404 Error)" Here is my code: Login.wml <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "(URL address "> <wml> <card id="card1" title=" Semester Grade Enquiry System Login Form"> <p> <big></big>Semester Grade Enquiry System Login Form<br/> Notice: Fields with * are required.<br/><br/> <b>$(errorMsg)</b><br/> * User name:<br/> <input name="username"/><br/> * Password (min. 5 characters):<br/> <input type="password" name="password"/><br/> <a href="validateloginform.wmls#validate()">Submit Form Data</a> </p> </card> </wml> validateloginform.wmls <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "url address"> <wml> <card id="card1" title="Success"> <do type="accept" label="enter"> <go href="/LoginServlet.java"/> </do> </card> </wml> LoginServlet.java import java.io.*; import java.sql.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.servlet.*; import javax.servlet.http.*; public class LoginServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException { Connection con = null; Statement stmt = null; ResultSet rs = null; res.setContentType("text/vnd.wap.wml"); PrintWriter out = res.getWriter(); String username2=req.getParameter("username"); String password2=req.getParameter("password"); out.println("<?xml version=\"1.0\"?>"); out.println("<!DOCTYPE wml PUBLIC " + "\"-//WAPFORUM//DTD WML 1.1//EN\" " + "\"(URL address )\">"); out.println("<wml>"); out.println("<card id=\"new\" title=\"login\">"); out.println(" <p> Login </p>"); try { Class.forName("oracle.jdbc.driver.OracleDriver"); con = DriverManager.getConnection("jdbc racle:thin:@rccadv33:1521 rcl", "scott", "tiger");stmt = con.createStatement(); rs = stmt.executeQuery("select * from login"); while(rs.next()) { if (username2.equals(rs.getString("username")) && password2.equals(rs.getString("password"))) { out.println("<p>Login Successful<p>"); res.sendRedirect("success.wml"); } else { out.println("<p>Please check the entries!<p>"); } } } catch(ClassNotFoundException e) { out.println("Couldn't load database driver: " + e.getMessage()); out.println("hi"); } catch(SQLException e) { out.println("SQLException caught is: " + e.getMessage()); out.println("<p>hi</p>"); out.println("</card>"); out.println("</wml>"); } finally { try { if (con != null) con.close(); } catch (SQLException ignored) { } } } } Can anyone help me in solving this issue. Thanks in advance. |
|
#2
|
|||||
|
|||||
|
Quote:
I would guess it indicates a problem with the servlet mapping specified. Quote:
I seriously doubt that you should be using the .java there, unless you have actually specified the mapping URL in that manner (in your web.xml). Quote:
Post your web.xml which indicates the servlet mapping. Also, use the code tag to preserve code formatting.
__________________
|
|
#3
|
|||
|
|||
|
Quote:
I have removed that .java extension . Is there any wml editors and editors to write my java code? |
|
#4
|
||||
|
||||
|
Quote:
If you are looking for editors (or IDE in specific), I personally prefer Eclipse. It has a WML editor in Web Tools plugin. |
|
#5
|
|||
|
|||
|
Quote:
Yes , after removing it, it is working. Thank you so much annie. one more issue, its working in nokia simulator but not in openwave. If i download eclipse, should i configure any settings for that?? |
|
#6
|
||||
|
||||
|
Quote:
I'm not very conversant with WML myself. You might want to search for some documentation. http://developer.openwave.com/dvl/support/documentation/technical_notes/sampleservlet.htm |
|
#7
|
|||
|
|||
|
Quote:
Have you done any projects on wap/wml? |
|
#8
|
||||
|
||||
|
Quote:
|
|
#9
|
|||
|
|||
|
Quote:
Hi I downloaded eclipse IDE . I am using Apache Tomcat Server. How to connect this server with my IDE? |
|
#10
|
||||
|
||||
|
Quote:
|
|
#11
|
|||
|
|||
|
Quote:
Thank you so much annie.. I configured it. |
|
#12
|
|||
|
|||
|
Quote:
For the above mentioned code, sometimes i get java.lang.NullPointerException at LoginServlet.doGet???? Why this error occurs?? |
|
#13
|
||||
|
||||
|
Quote:
|