cosmetic
This commit is contained in:
@@ -16,39 +16,39 @@ or go to [[step_4.wiki|step 4]]
|
|||||||
|
|
||||||
* The code looks like
|
* The code looks like
|
||||||
|
|
||||||
response (req: WSF_REQUEST): WSF_HTML_PAGE_RESPONSE
|
response (req: WSF_REQUEST): WSF_HTML_PAGE_RESPONSE
|
||||||
-- Computed response message.
|
-- Computed response message.
|
||||||
do
|
do
|
||||||
--| It is now returning a WSF_HTML_PAGE_RESPONSE
|
--| It is now returning a WSF_HTML_PAGE_RESPONSE
|
||||||
--| Since it is easier for building html page
|
--| Since it is easier for building html page
|
||||||
create Result.make
|
create Result.make
|
||||||
Result.set_title ("EWF tutorial / Hello World!")
|
Result.set_title ("EWF tutorial / Hello World!")
|
||||||
--| Check if the request contains a parameter named "user"
|
--| Check if the request contains a parameter named "user"
|
||||||
--| this could be a query, or a form parameter
|
--| this could be a query, or a form parameter
|
||||||
if attached req.string_item ("user") as l_user then
|
if attached req.string_item ("user") as l_user then
|
||||||
--| If yes, say hello world #name
|
--| If yes, say hello world #name
|
||||||
Result.set_body ("Hello " + l_user + "!")
|
Result.set_body ("Hello " + l_user + "!")
|
||||||
--| We should html encode this name
|
--| We should html encode this name
|
||||||
--| but to keep the example simple, we don't do that for now.
|
--| but to keep the example simple, we don't do that for now.
|
||||||
else
|
else
|
||||||
--| Otherwise, ask for name
|
--| Otherwise, ask for name
|
||||||
Result.set_body ("[
|
Result.set_body ("[
|
||||||
<form action="/" method="POST">
|
<form action="/" method="POST">
|
||||||
<p>Hello, what is your name?</p>
|
<p>Hello, what is your name?</p>
|
||||||
<input type="text" name="user"/>
|
<input type="text" name="user"/>
|
||||||
<input type="submit" value="Validate"/>
|
<input type="submit" value="Validate"/>
|
||||||
</form>
|
</form>
|
||||||
]"
|
]"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
--| note:
|
--| note:
|
||||||
--| 1) Source of the parameter, we could have used
|
--| 1) Source of the parameter, we could have used
|
||||||
--| req.query_parameter ("user") to search only in the query string
|
--| req.query_parameter ("user") to search only in the query string
|
||||||
--| req.form_parameter ("user") to search only in the form parameters
|
--| req.form_parameter ("user") to search only in the form parameters
|
||||||
--| 2) response type
|
--| 2) response type
|
||||||
--| it could also have used WSF_PAGE_REPONSE, and build the html in the code
|
--| it could also have used WSF_PAGE_REPONSE, and build the html in the code
|
||||||
--|
|
--|
|
||||||
end
|
end
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user