Project

General

Profile

Revision 102

Added by Matt Jones over 20 years ago

debugging form submission

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
159 159

  
160 160
    // Get a handle to the output stream back to the client
161 161
    PrintWriter out = response.getWriter();
162
    //response.setContentType("text/html");
162 163
  
163 164
    String name = null;
164 165
    String[] value = null;
......
167 168
    while (paramlist.hasMoreElements()) {
168 169
      name = (String)paramlist.nextElement();
169 170
      value = request.getParameterValues(name);
171
      //out.println(name + " => " + value[0]);
170 172
      params.put(name,value);
171 173
    }
172 174

  
......
264 266
  private void handleGetDocumentAction(PrintWriter out, Hashtable params, 
265 267
               HttpServletResponse response) 
266 268
               throws ClassNotFoundException, IOException, SQLException {
269
    String docidstr = null;
270
    long docid = 0;
271
    String doc = null;
272
    try {
267 273
      // Find the document id number
268
      String docidstr = ((String[])params.get("docid"))[0]; 
269
      long docid = (new Long(docidstr)).longValue();
274
      docidstr = ((String[])params.get("docid"))[0]; 
275
      docid = (new Long(docidstr)).longValue();
270 276

  
271 277
      // Get the document indicated fromthe db
272
      String doc = docreader.readXMLDocument(docid);
278
      doc = docreader.readXMLDocument(docid);
279
    } catch (NullPointerException npe) {
280
      response.setContentType("text/html");
281
      out.println("Error getting document ID: " + docidstr +" (" + docid + ")");
282
    }
273 283

  
274

  
275 284
      // Return the document in XML or HTML format
276 285
      String qformat = ((String[])params.get("qformat"))[0]; 
277 286
      if (qformat.equals("xml")) {
MetaCatServlet.java
159 159

  
160 160
    // Get a handle to the output stream back to the client
161 161
    PrintWriter out = response.getWriter();
162
    //response.setContentType("text/html");
162 163
  
163 164
    String name = null;
164 165
    String[] value = null;
......
167 168
    while (paramlist.hasMoreElements()) {
168 169
      name = (String)paramlist.nextElement();
169 170
      value = request.getParameterValues(name);
171
      //out.println(name + " => " + value[0]);
170 172
      params.put(name,value);
171 173
    }
172 174

  
......
264 266
  private void handleGetDocumentAction(PrintWriter out, Hashtable params, 
265 267
               HttpServletResponse response) 
266 268
               throws ClassNotFoundException, IOException, SQLException {
269
    String docidstr = null;
270
    long docid = 0;
271
    String doc = null;
272
    try {
267 273
      // Find the document id number
268
      String docidstr = ((String[])params.get("docid"))[0]; 
269
      long docid = (new Long(docidstr)).longValue();
274
      docidstr = ((String[])params.get("docid"))[0]; 
275
      docid = (new Long(docidstr)).longValue();
270 276

  
271 277
      // Get the document indicated fromthe db
272
      String doc = docreader.readXMLDocument(docid);
278
      doc = docreader.readXMLDocument(docid);
279
    } catch (NullPointerException npe) {
280
      response.setContentType("text/html");
281
      out.println("Error getting document ID: " + docidstr +" (" + docid + ")");
282
    }
273 283

  
274

  
275 284
      // Return the document in XML or HTML format
276 285
      String qformat = ((String[])params.get("qformat"))[0]; 
277 286
      if (qformat.equals("xml")) {
lib/resultset.xsl
62 62
                </xsl:attribute>
63 63
              </input>
64 64
              <input type="submit" value="Display"/>
65
       <!--
66
              <a>
67
              <xsl:attribute name="href">
68
              /servlets/MetaCatServlet?action=getdocument&amp;docid=<xsl:value-of select="./docid"/>
69
              </xsl:attribute>
70
              <xsl:text>Document </xsl:text><xsl:value-of select="./docid"/>
71
              </a>
72
        -->
65
<!--
66
              <input border="0" type="image" name="docid" 
67
                     src="/xmltodb/images/details.png">
68
                <xsl:attribute name="value">
69
                  <xsl:value-of select="./docid"/>
70
                </xsl:attribute>
71
              </input>
72
-->
73 73
          </td>
74 74
          <td><xsl:value-of select="./doctitle"/>
75 75
              <xsl:text>&nbsp;</xsl:text>
lib/style/resultset.xsl
62 62
                </xsl:attribute>
63 63
              </input>
64 64
              <input type="submit" value="Display"/>
65
       <!--
66
              <a>
67
              <xsl:attribute name="href">
68
              /servlets/MetaCatServlet?action=getdocument&amp;docid=<xsl:value-of select="./docid"/>
69
              </xsl:attribute>
70
              <xsl:text>Document </xsl:text><xsl:value-of select="./docid"/>
71
              </a>
72
        -->
65
<!--
66
              <input border="0" type="image" name="docid" 
67
                     src="/xmltodb/images/details.png">
68
                <xsl:attribute name="value">
69
                  <xsl:value-of select="./docid"/>
70
                </xsl:attribute>
71
              </input>
72
-->
73 73
          </td>
74 74
          <td><xsl:value-of select="./doctitle"/>
75 75
              <xsl:text>&nbsp;</xsl:text>
resultset.xsl
62 62
                </xsl:attribute>
63 63
              </input>
64 64
              <input type="submit" value="Display"/>
65
       <!--
66
              <a>
67
              <xsl:attribute name="href">
68
              /servlets/MetaCatServlet?action=getdocument&amp;docid=<xsl:value-of select="./docid"/>
69
              </xsl:attribute>
70
              <xsl:text>Document </xsl:text><xsl:value-of select="./docid"/>
71
              </a>
72
        -->
65
<!--
66
              <input border="0" type="image" name="docid" 
67
                     src="/xmltodb/images/details.png">
68
                <xsl:attribute name="value">
69
                  <xsl:value-of select="./docid"/>
70
                </xsl:attribute>
71
              </input>
72
-->
73 73
          </td>
74 74
          <td><xsl:value-of select="./doctitle"/>
75 75
              <xsl:text>&nbsp;</xsl:text>

Also available in: Unified diff