Hi All,

I am a Java & Restlet newbie, and I want to create a restlet that does a 
roundtrip to a database, presents the results in HTML Text boxes in a HTML 
Table and stores any changes back to the database.

I am on Exclipse and Restlet 2.1

My code below extends the ServerResource example, but never gets to the 
@Post annotation. 

Also I need an example of how to read the HTML variables eg fname and 
lname.

Any help or examples to do with generating HTML pages would be appreciated

Cheers

Geoff Speedy

**************************************************************************************

import org.restlet.*;
import org.restlet.data.*;
import org.restlet.resource.*;

public class FifthServerResource extends ServerResource { 

   public static void main(String[] args) throws Exception { 
      // Create the HTTP server and listen on port 8182 
      new Server(Protocol.HTTP, 8182, FifthServerResource.class).start(); 
   }

   @Get 
   public String getting() { 
                System.out.println("Started getting ");
 
                String outstr = 
"<html><head><title>Sheet</title></head><form action=\"
http://localhost:8182\"; method=\"POST\">" + 
                "First name: <input type=\"text\" name=\"fname\" /><br />" 
+
                "Last name: <input type=\"text\" name=\"lname\" /><br />" 
+
                "<input type=\"submit\" value=\"Submit\" />" +
                "</form> ";
                                                                System.out
.println(outstr);
                                                        return outstr;
 
   }
   @Post 
   public String posting() { 
                System.out.println("Started posting ");
 
                String outstr = 
"<html><head><title>Sheet</title></head><form action=\"
http://localhost:8182\"; method=\"POST\">" + 
                                "First name: <input type=\"text\" 
name=\"fname\" /><br />" +
                                "Last name: <input type=\"text\" 
name=\"lname\" /><br />" +
                                "<input type=\"submit\" value=\"Submit\" 
/>" +
                                "</form> ";
                                                                System.out
.println(outstr);
                                                        return outstr;
 
   }
   } 

**************************************************************************************


Starting the internal [HTTP/1.1] server on port 8182
Started getting 
<html><head><title>Sheet</title></head><form action="http://localhost:8182
" method="POST">First name: <input type="text" name="fname" /><br />Last 
name: <input type="text" name="lname" /><br /><input type="submit" 
value="Submit" /></form> 
Started getting 
<html><head><title>Sheet</title></head><form action="http://localhost:8182
" method="POST">First name: <input type="text" name="fname" /><br />Last 
name: <input type="text" name="lname" /><br /><input type="submit" 
value="Submit" /></form> 
Started getting 
<html><head><title>Sheet</title></head><form action="http://localhost:8182
" method="POST">First name: <input type="text" name="fname" /><br />Last 
name: <input type="text" name="lname" /><br /><input type="submit" 
value="Submit" /></form> 

**************************************************************************************

Cheers,

Geoff Speedy | Principal Developer

Geoffrey Speedy | Principal Developer, BI & Reports Development Team | 
Information Management and Technology
Department of Human Services | Level 10, 2 Lonsdale Street, Melbourne
p. 9096 7243 | f. 9096 9100 | e. [email protected] | 
www.dhs.vic.gov.au
Corporate Services | Innovative business solutions for better client 
outcomes

_________________________________________________________________________________
 
This email contains confidential information intended only for the person named 
above and may be subject to legal privilege. If you are not the intended 
recipient, any disclosure, copying or use of this information is prohibited. 
The Department provides no guarantee that this communication is free of virus 
or that it has not been intercepted or interfered with. If you have received 
this email in error or have any other concerns regarding its transmission, 
please notify [email protected]
_________________________________________________________________________________

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2946983

Reply via email to