问题
I've been looking around and came across the WT toolkit, Is it stable? Any good? I was stumped on how to go about this in C++, given the lack of libraries and resources concerning web developement. (CGI/Apache)
The purpose of my application is to populate some data from a Sybase ASE15 database running GNU/Linux & Apache Hence allow some user interactions.
I am going to use Sybase open client library (libct) to retrieve columns from the Server, feed this data back to wt model/view.
My requests:
Is there any more practical solution rather than using other scripting languages? I mean by practical, an interface with ODBC retrieving, and MVC mechanism?
If not available in C++, any alternative in Java?
回答1:
Give this one a look. I never much liked Wt's design. But then, I'm kind of an anti-framework guy.
http://cppcms.sourceforge.net/wikipp/en/page/main
回答2:
C++ isn't a very popular choice for web applications - probably because it's too easy to leave security holes, and development time tends to be a lot slower than for the scripting languages.
Dynamically typed scripting languages convert compile-time errors to runtime errors. Detecting those might not be as easy as reading through the compiler output. Scripting languages may be OK for quick-and-dirty simple projects. Beyond a certain level of complexity one needs strongly typed, well-structured languages. Such as C++, or Java.
Most scripting languages encourage sloppy programming.
As to the "security holes": if you refer to buffer overruns, allocation/deallocation errors, the answer is "STL". And proper training of course :-)
回答3:
- http://www.webtoolkit.eu/wt#/
- http://cppcms.sourceforge.net/wikipp/en/page/main
- C++ web service framework
For starters. There are certainly more I'm sure - a healthy google search probably wouldn't hurt. Also, you could try the #C++ channel on freenode - they have an offtopic channel that you can ask about if you want to talk about non STL C++ and the people there would happily answer your questions I'm sure. Good Luck.
回答4:
tntnet (http://www.tntnet.org) is great for creating web applications with C++.
回答5:
You might want to check out klone:
http://koanlogic.com/klone/index.html
Basically, it's a framework AND server that makes writing C++ web backends easy...
回答6:
CGI programs are pretty damn easy to write in both C and C++ - you don't really need any special library, though having one will obviously make development a little faster. Do you really understand how CGI works? Basically, your program reads environment variables with getenv(), does some processing, and then writes some HTML out to the program's standard output.
回答7:
The best web toolkit for C/C++ would be Apache httpd. Just write a module and you can use libct to access your database.
There is MVC modules out there like mod_spin but I don't have any experience with it.
回答8:
C++ isn't a very popular choice for web applications - probably because it's too easy to leave security holes, and development time tends to be a lot slower than for the scripting languages. I'd say 99% of web applications don't need the speed that C++ brings.
So this leads to a lack of good frameworks.
From my fairly light look at the area I'd say Wt is probably your best bet, although it's more of a library of useful things (like page templates) than a framework.
I'd seriously consider not doing this in C++ though. Even Java (I prefer C++ myself) has much stronger support for web development.
回答9:
Another alternative may be the "FastCGI / CGI C++ Library" that is aimed for Boost integration at someday: http://cgi.sourceforge.net/
回答10:
Qt is going to grow day by day. And Wt is the trying to stand for web tool kit based on Qt. C++ the powerful language and the best in my opinion. If you like gnu projects and independent tech. I really suggest to use them. I used PHP, Phyton, C#, VisualBasic, Fortran etc. but I did not like as much as C++ among of them.
回答11:
I gave Wt a try and really liked it. I will not give you any cons or pros for using it from scratch, but when you have a backend written in C/C++ with millions of API entries then Wt is an obvious choice. There are some very powerful features that is easier to use for example dynamically loaded tables. Signal processing on the server etc.
One thing I really disliked at Wt is that it is not compatible with Apache on Windows as of time of this writing. You either have to use Unix, or IIS on Windows. Wt also offers its own http server, that is very convenient for developing your applications but I would not trust it in the role of production server as I am not sure of its security.
回答12:
My personal choice for web development is Ruby on Rails, but if you have to chose between C, C++ or Java for web development, my suggestion is to use Java with JavaServer Faces
回答13:
Apache Celix looks like a promising active project that meets the requirements of this (albeit old) question. See: http://celix.apache.org/
From the Apache Project description page:
Celix is an implementation of the OSGi specification adapted to C. It will follow the API as close as possible, but since the OSGi specification is written primarily for Java, there will be differences (Java is OO, C is procedural). An important aspect of the implementation is interoperability between Java and C. This interoperability is achieved by porting and implementing the Remote Services specification in Celix.
来源:https://stackoverflow.com/questions/1252201/any-good-c-c-web-toolkit