Hi Gurpreet,

There are limitations. The browser will not be happy with the html and
the body tags, and Wt will not like the fact that the example html
that you write does not contain valid XML (e.g. <input type=submit
value="Show"> vs <input type=submit value="Show"/>.

I haven't tried this myself, but the inclusion of a form element will
probably work in most cases. If the browser does not support
JavaScript, Wt already puts a form tag in the toplevel of the page,
and you'll have a form in a form and that will not work. If you
configured Wt in progressive bootstrap, Wt will also add this toplevel
form element (since it doesn't know yet if the browser will support
JS), and you have  a problem.

But if you really want to do this, why not use an iframe? Iframes are
made for exactly this use case. On top of that, you can have the CGI
served by apache/nginx/... and you don't have to care about calling a
CGI script yourself. Alternatively, you could specialize a WResource
that calls the CGI script, if you want to use Wt's session tracking
mechanism to provide access control to the CGI script (maybe such a
resource would be a nice addition to the toolkit).

An iframe in Wt can be implemented by a WText:
new WText("<iframe src=\"my.cgi\"/>", Wt::XHTMLUnsafeText, parent);
Or in case that you use a WResource:
WCgiResource *r = new WCgiResource("/my/script/is/here", ...);
new WText("<iframe src=\"" + r->url() + "\"/>", ...);

Note that 'Wt::XHTMLUnsafeText disables the XSS filtering for this
wtext, so beware if any of the iframe's URL contains untrusted
strings!

BR,
Wim.

2011/5/12 Gurpreet Kaur Karwal <[email protected]>:
> Thank You very much for replying. So, that means I can embed an HTML CODE
> example:-
>
> <html>
>   <body>
>
>     <p>
>
> <FORM METHOD="GET" ACTION="http://path to script">
> Lambda:
> <INPUT type=text    name=lambda          VALUE="">
>
> <input type=submit value="Show">
> <input type=reset value="Reset">
> </FORM></p></body></html>
>
> Can be embedded in WText???
>
>
>
> On Tue, May 10, 2011 at 12:17 PM, Wim Dumon <[email protected]> wrote:
>>
>> Hi,
>>
>> A WText can show embedded HTML code and filters it for XSS at the same
>> time (the HTML must have valid XML syntax). Wt does not contain
>> methods to set the environment variables for your CGI script for you,
>> you'll have to do this yourself.
>>
>> A solution will probably involve pipe(), fork(), setenv(), popen() and
>> some glue methods to forward the output of the CGI script to a string
>> in the Wt process.
>>
>> BR,
>> Wim.
>>
>> 2011/5/9 Gurpreet Kaur Karwal <[email protected]>:
>> > I want to create a form using wt that is capable of calling a CGI
>> > Script. Is
>> > the practice of writing HTML Code and then somehow embedding it in wt
>> > worth?? If yes, how can I do that. And if there is an easier alternative
>> > to
>> > embedding HTML code please do tell. It will be great if I can have some
>> > example of the suggested method also.
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > WhatsUp Gold - Download Free Network Management Software
>> > The most intuitive, comprehensive, and cost-effective network
>> > management toolset available today.  Delivers lowest initial
>> > acquisition cost and overall TCO of any competing solution.
>> > http://p.sf.net/sfu/whatsupgold-sd
>> > _______________________________________________
>> > witty-interest mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/witty-interest
>> >
>> >
>>
>>
>> ------------------------------------------------------------------------------
>> Achieve unprecedented app performance and reliability
>> What every C/C++ and Fortran developer should know.
>> Learn how Intel has extended the reach of its next-generation tools
>> to help boost performance applications - inlcuding clusters.
>> http://p.sf.net/sfu/intel-dev2devmay
>> _______________________________________________
>> witty-interest mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
> ------------------------------------------------------------------------------
> Achieve unprecedented app performance and reliability
> What every C/C++ and Fortran developer should know.
> Learn how Intel has extended the reach of its next-generation tools
> to help boost performance applications - inlcuding clusters.
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to