×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    2

    Error 500 using /w Internet Toolkit 3.1

    Hi all, I am using Tomcat Apache 4.1 /w Nokia Internet Toolkit 3.1 to test some jsp and wml pages. Basically trying to do what this tutorial suggest: http://www.javaworld.com/javaworld/javatips/jw-javatip123.html

    I am able to load the wml with the simulator page after putting all the files in my Apache ROOT directory. However, when I try to select one of the phone book name and tries to "Get number" it comes back with Error 500 even though the Session data shows that the name I selected is represented in the location string.

    Connection setting for the device is set to use address "localhost", Connection-Oriented Port "9201", why the toolkit connection setting is not using any proxty at all.

    Can someone tell me how to debug this? Do I need to add any lines in the server xml file in Apache Tomcat for the response.setContentType("text/vnd.wap.xml&quot in the jsp file??

    JSP file
    =========

    <%@ page import="java.io.*,java.util.*" %>
    <% response.setContentType("text/vnd.wap.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 title="PhoneBook JSP" >
    <p>Phone List</p>
    <%! Properties phones;
    %>
    <% int next;
    phones = new Properties();
    FileInputStream fin;
    try {
    fin = new FileInputStream("c:\\Program Files\\Apache Group\\Tomcat 4.1\\webapps\\ROOT\\phonelist\\"
    phones.load(fin);
    }
    catch (IOException e) { %>
    PhoneBook file not found.
    <% phones = null;
    throw new ServletException
    ("PhoneBooKSample failed to find phonelist file: "
    }
    %>
    <% if (phones == null) {
    %>
    <p>Sorry, No phone list.</p>
    <% }
    else {
    // The req object contains the HttpRequest parameters
    // This JSP checks for a parameter called 'name'
    String name = request.getParameter("name"

    if ((name != null) && (!name.equals("&quot)) {
    // Try to return the phone number for the specified 'name' parameter
    String phone = (String) phones.get(name);
    if (phone == null) {
    phone = name + " was Not found";
    }
    else {
    phone = name + ": " + phone;
    }
    %>
    <p> <%=phone%></p>
    <% }
    else {
    // List the entire phone directory using the WML Table
    %>
    <p><table columns="2">
    <% // create an Enumeration from the phones Properties object,
    // use the name parameter to look up the phone number
    Enumeration e = phones.propertyNames();
    while (e.hasMoreElements()) {
    String lookupname=(String) e.nextElement();
    String phonenumber=phones.getProperty(lookupname,"not found"
    %>
    <tr><td><b><%=lookupname %></b></td><td><%=phonenumber %></td></tr>
    <% }
    %>
    </table></p>
    <% }
    %>
    </card>
    </wml>
    <% }
    %>

    WML file
    ========
    <?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="card1" title="Phone Book" newcontext="true">
    <p>
    Name:
    <select name="name" value="" title="Name">
    <option value="">All</option>
    <option value="Mery">Mery</option>
    <option value="Su">Su</option>
    <option value="Kim">Kim</option>
    <option value="Chi">Chi</option>
    </select>
    </p>
    <do type="accept" label="Get number">

    <!-- Edit the URL below to point to the appropriate hostname and listenport
    of your webserver -->
    <go href="http://localhost/PhoneBookSample.jsp?name=$(name:escape)"/>
    </do>
    </card>
    </wml>



    Thanks A LOT!

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    2

    RE: Error 500 using /w Internet Toolkit 3.1

    more info on the request and response detail:

    Session tab in the toolkit:
    Request
    =======
    Location = [http://localhost/PhoneBookSample.jsp?name=Mery]
    Accept=[application/vnd.wap.wmlc, application/vnd.wap.wmlscriptc,application/vnd.wap.wbxml,...........etc etc]
    Accept-Charset=[ISO-8859-1, US-ASCII, UTF-8; Q=0.8, ISO-10646-UCS-2; Q=0.6]
    Accept-Language = [en, fi]

    Response
    ========
    Request Status\500:"Server Error"
    Location= [http://localhost/PhoneBookSample.jsp?name=Mery]
    Content Data: 108 bytes, application/vnd.wap.wmlc, ISO-8859-1
    Headers(4)
    (1)Content-Type=[application/vnd.wap.wmlc;Charset=ISO-8859-1]
    (2)Encoding-version=[1.2]
    (3)Accept-Ranges=[none]
    (4)Date =[some date]

    THANKS AGAIN!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×