Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2025-08

https://wiki.lazarus.freepascal.org/fpWeb_Tutorial

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

duilio foschi

I am studyng these pages.

I'd like to notify the maintainer that the 1st example Hello, World!

Let's create a simple Web Application.

is buggy.

There is no way (or I could find no way) to set the module reesponse.

According to the notes, I should be able to write this code from the object inspector, but could find no way to do it

procedure TFPWebModule1.DataModuleRequest(Sender: TObject; ARequest:
TRequest;AResponse: TResponse; var Handled: Boolean);begin
  AResponse.Content := 'Hello, World!';
  Handled := true;
end;

I am working in windows 10 with Lazarus 3.4.

With the help of DeepSeek, I was able to create a response by adding

  HTTPRouter.RegisterRoute('/', @HandleHello);

to the main body of the code and - of course -

procedure HandleHello(ARequest: TRequest; AResponse: TResponse);
begin
  AResponse.Content := 'Hello World!';
  AResponse.ContentType := 'text/plain';
  AResponse.SendResponse;
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20250807/47429a9c/attachment.htm>

Reply by email

Jean SUZINEAU
to duilio foschi

Le 07/08/2025 ? 22:05, duilio foschi via lazarus a ?crit?:

Show quoted text 6 lines
There is no way (or I could find no way) to set the module reesponse. According to the notes, I should be able to write this code from the object inspector, but could find no way to do it

In the object inspector, in the events tab, you should double click on "OnRequest",
and the IDE will create the DataModuleRequest method. Very often the method name doesn't match exactly the event name. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20250807/96635ac2/attachment-0001.htm>

Reply by email

duilio foschi
to Jean SUZINEAU

not so easy:

There is no way to click the OnRequst method as no object is there.

See:
https://i.ibb.co/chCf2ykd/immagine-2025-08-08-074907406.png

Thank you
DF

On Thu, Aug 7, 2025 at 11:33?PM Jean SUZINEAU via lazarus <

Show quoted text 19 lines
wrote: Le 07/08/2025 ? 22:05, duilio foschi via lazarus a ?crit : There is no way (or I could find no way) to set the module reesponse. According to the notes, I should be able to write this code from the object inspector, but could find no way to do it In the object inspector, in the events tab, you should double click on "OnRequest", and the IDE will create the DataModuleRequest method. Very often the method name doesn't match exactly the event name. -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20250808/6fa6c65f/attachment.htm>

Reply by email

Jean SUZINEAU
to duilio foschi

Le 08/08/2025 ? 07:53, duilio foschi via lazarus a ?crit?:

There is no way to click the OnRequst method as no object is there.

It seems you have no web module in your project.

You should create one through the menu File /new / web module (may be a bit different, my lazarus is in French).

Then if the web module is the active tab in your source editor, hitting F11 should show the object inspector with your web module. Basically you have the .pas file of your web module in the source editor, and the object inspector let you edit the content of the corresponding .lfm file.
I'm sure there are much better and detailed explanations than mine in basic tutorials for Lazarus and Delphi, these concepts haven't changed for 30 years.

Reply by email

duilio foschi
to Jean SUZINEAU
It seems you have no web module in your project.

this is the point :)

The notes at https://wiki.lazarus.freepascal.org/fpWeb_Tutorial

On Fri, Aug 8, 2025 at 9:33?AM Jean SUZINEAU via lazarus <

Show quoted text 24 lines
wrote: Le 08/08/2025 ? 07:53, duilio foschi via lazarus a ?crit : > There is no way to click the OnRequst method as no object is there. It seems you have no web module in your project. You should create one through the menu File /new / web module (may be a bit different, my lazarus is in French). Then if the web module is the active tab in your source editor, hitting F11 should show the object inspector with your web module. Basically you have the .pas file of your web module in the source editor, and the object inspector let you edit the content of the corresponding .lfm file. I'm sure there are much better and detailed explanations than mine in basic tutorials for Lazarus and Delphi, these concepts haven't changed for 30 years. -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20250808/6ff6cddb/attachment-0001.htm>

Reply by email

duilio foschi
to duilio foschi

the notes at https://wiki.lazarus.freepascal.org/fpWeb_Tutorial

dont tell you to create one :)

Thank you!

Show quoted text 32 lines
>It seems you have no web module in your project. this is the point :) The notes at https://wiki.lazarus.freepascal.org/fpWeb_Tutorial On Fri, Aug 8, 2025 at 9:33?AM Jean SUZINEAU via lazarus < > wrote: > Le 08/08/2025 ? 07:53, duilio foschi via lazarus a ?crit : > > There is no way to click the OnRequst method as no object is there. > It seems you have no web module in your project. > > You should create one through the menu File /new / web module (may be a > bit different, my lazarus is in French). > > Then if the web module is the active tab in your source editor, hitting > F11 should show the object inspector with your web module. > Basically you have the .pas file of your web module in the source > editor, and the object inspector let you edit the content of the > corresponding .lfm file. > I'm sure there are much better and detailed explanations than mine in > basic tutorials for Lazarus and Delphi, these concepts haven't changed > for 30 years. > > -- > _______________________________________________ > lazarus mailing list > > https://lists.lazarus-ide.org/listinfo/lazarus >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20250808/2109adea/attachment.htm>

Reply by email

Michael Van Canneyt
to duilio foschi
duilio foschi wrote
the notes at https://wiki.lazarus.freepascal.org/fpWeb_Tutorial dont tell you to create one :)

Well, you can deduce from the text that you must create one, the initial project creation wizard shows a dropdown under 'Web module to create' and you must select a kind of webmodule to create. If you don't select anything, no webmodule will be created. (and that is OK if you just want to serve files)

But you are right, the page is outdated, I'll see about updating it to match the latest situation.

Michael.

Reply by email