no probs with anything else but with POST it seems.
try get.
see the sample code.
Madhavi

package UserProfile;


import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;

        public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
        {

                ResultSet rs = null;
                Connection con = null;
                PreparedStatement pstmt = null;
                String result[] = new String[20];
                int user_id=1;

                //HttpSession session = req.getSession(true);
                res.setContentType("text/vnd.wap.wml");
                PrintWriter out = res.getWriter();
                }
                try
                {
                        con=DriverManager.getConnection("jdbc:odbc:mbis");

                        pstmt = con.prepareStatement("Select * from
UserMaster where User_id = ?");
                        pstmt.setInt(1,user_id);

                        rs = pstmt.executeQuery();


                        while(rs.next()){
                                for(int i=1;i<18;i++)
                                {
                                        result[i]=rs.getString(i);
                                }

                        }

                        out.println("   <?xml version=\"1.0\"?>");
                        out.println("   <!DOCTYPE wml PUBLIC
\"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_
1.1.xml\">");
                        out.println("   <wml>");
                        out.println("   <template>   <do type=\"prev\" label
= \"Back\"><prev/></do>   </template> ");
                        out.println("   <card id=\"EditUserProfile\"
title=\"mBIS\"> ");
                        out.println("   <do type=\"prev\"
label=\"Back\"><prev/></do>     ");

                        out.println("   <p align=\"left\">      ");
                        out.println("   <b>Current User Profile</b>     ");

                        out.println("   <table columns = \"2\"> ");
                        out.println("   <tr><td><b>UserId:</b></td><td>" +
result[1] + "</td></tr> ");
                        out.println("   <tr><td><b>UserName:</b></td><td>" +
result[2] + "</td></tr> ");
                        out.println("   <tr><td><b>EmailId:</b></td><td>" +
result[9] + "</td></tr> ");
                        out.println("   <tr><td><b>Address:</b></td><td>" +
result[3] + "</td></tr> ");
                        out.println("   <tr><td></td><td>" + result[4]
+"</td></tr>    ");
                        out.println("   <tr><td><b>City:</b></td><td>" +
result[5]+ "</td></tr>  ");
                        out.println("   </table>        ");
                        out.println("   </p>    ");



-----Original Message-----
From: SUBSCRIBE SERVLET-INTEREST Lucy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 8:49 PM
To: [EMAIL PROTECTED]
Subject: wap-wml-parameters to database servlet


Hi
I've adapted a servlet I use OK for database access, from html to wap.  It
collects parameters input by the user sends to database servlet and returns
data.  I've rechecked the servlet coding and I'm sure it's OK, but I'm
wondering whether my normal servlet approach can be causing problems for
wap.  I use "PreparedStatement" and underscore_ in parameter (variable)
names.  I've tested without the underscore_ but have got no improvement.

The .wml file is obviously accessing the servlet as it returns the
correct title from the out.println object, but none of the parameters.  I've
checked wap articles (eg Mahmoud) but they don't cover this, and wasted 30
quid on new book Evans & Ashworth (useless) it amazingly deals with only
flat files and glosses over any intracacies.
1.  Can I use PreparedStatements in servlets/database/wap?
2.  Do database rows with underscore_ in parameter_name upset wap?
3.  Is it my wml that's dodgy? The user has to physically input some text
which is then sent to servlet to search the database.
4.  Can anyone recommend any decently pitched articles/book?

Dodgy wml?:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml";>

<wml>
  <card id="MyCard" title="Enter search">
     <p>
      Enter Search name:
      <input type="text" name="search" />
  </p>

    <do type="accept" label="Enter">
      <go href="http://localhost/servlet/MyDBServlet"; method="post">
  <postfield name="search" value="$(search)"/>
   </go>
    </do>
 </card>
</wml>

Thanks for any help.  Cheers, Lucy

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to