W3C home > Mailing lists > Public > www-jigsaw@w3.org > July to August 1996

Re: An example for PostableResource wanted

From: Anselm Baird-Smith <abaird@w3.org>
Date: Sun, 7 Jul 1996 15:57:21 +0500
Message-Id: <9607071957.AA02057@www18.w3.org>
To: mil@physics.ucf.edu (Mark I. Lubin)
Cc: www-jigsaw@w3.org
Mark I. Lubin writes:
 > By the way, back to the ReverseString.java, I see that you got the string
 > as 
 > String str = data.getValue("string");
 > Can you tell me, how can I get hold on more inputs form the Form ( in other
 > words , say I have more complex Form : a few string-inputs, text-field, 
 > radio-buttons). That can be used for real-life example, like this survey about
 > Jigsaw:
 > <STRONG>Please take a minute and complete the form about Jigsaw</STRONG>    
 > <FORM METHOD="POST" ACTION="....">                
 > Name: <INPUT NAME="name" SIZE=50><BR>
 > Email Address: <INPUT NAME="email" SIZE=50><BR>
 > <INPUT NAME="subject" TYPE="hidden" VALUE="COMMENTS"><P>
 > Type whatever you wish about Jigsaw:<P>             
 > <TEXTAREA NAME="content" ROWS=10 COLS=60></TEXTAREA> </P><P>
 > Do you like Jigsaw?<P>
 > <INPUT TYPE="radio" NAME="the type" VALUE="Yes">Yes<BR>
 > <INPUT TYPE="radio" NAME="the type" VALUE="No">No<BR>
 > <INPUT TYPE="submit" VALUE="send via email">  
 > <INPUT TYPE="reset"  VALUE="clear form and start over"> <BR>
 > </FORM>
 > Then server will collect the information and send copy to the user.

You can either:

a) Get each field value by its name attribute. So in the above
example, to get the value of the subject, you can say:
    String subject = data.getValue("subject");
   And get back the content of the subject field.

b) You can list all returned value (as is the case of the
PostableResource handle's method) by enumerating the keys from data,
and walking through them (see the code for

If there is something broken in this interface, it's time to raise
your voice...[I am not sure how case sensitivity is handled, and I am
not sure it matters].

In your case (the above example), you will probably want to use the
HtmlGenerator object, by doing somethiung like:

ppublic class JigsawSurvey extends PostableResource {

import w3c.jigsaw.html.*;

public Reply handle(Request request, URLDecoder data) {
    HtmlGenerator g = new HtmlGenerator("Jigsaw survey"); // set title
    g.append("<h1>The data you entered</h1>");
    g.append("<li>your name: ", data.getValue("name"));
    g.append("<li>content: ", data.getValue("content"););
    g.append("<li>type: ", data.getValue("the type"));
    // Add as many append as you want
    Reply reply = request.makeReply(HTTP.OK);
    return reply;

At this point, you probably want to read the api documentation at:

Received on Sunday, 7 July 1996 21:37:07 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:29 UTC