jsp中如何设置代码文本格式
您好,我正在创建一个在线测验系统,以便学生可以浏览问题并提交答案。我的问题是有关 C++ 编码的问题,因此它将显示类代码,然后学生可能可以发现语法错误或写出输出。我的问题是如何将问题存储到数据库中,我正在使用 MySQL 我在想它会溢出范围吗?以及在网页中显示时如何格式化代码。有做过在线问答系统经验的人可以给我一些建议吗?谢谢
Hi I am creating a online quiz system, so student can go through the question and submit the answer. My question is something about C++ coding, so it will display a class code, then maybe student can spot the syntax error or write out the output. My question is that how to i store the question into database, I am using MySQL i was thinking will it overflow the range? And how do it format the code during display in webpage. Anyone who had experienced on doing oline quiz system can give me some suggestion? Thank You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您担心溢出范围,我建议使用以下
TEXT
类型(在 MySQL 中)而不是VARCHAR
:您还可以在
TEXT
类型上包含字符集。至于在网页中显示代码,有syntaxHighlighter。它是一个 javascript 库,您可以将其合并到您的网站中。它们支持多种语言,包括 C++。
希望这有帮助。
If you are worried about overflowing the range, I suggest using the following
TEXT
types (in MySQL) instead ofVARCHAR
:You can also include character set on
TEXT
type too.As to display code in a web page, there's syntaxHighlighter. It's a javascript library that you can incorporate in your site. They have support for many languages, including C++.
Hope this helps.
要将源代码存储在Mysql中,可以使用varchar或TEXT。
要在线编辑源代码,我推荐 markItUp。仅显示(不编辑)可能有更简单的解决方案。
To store sourcecode in Mysql, you can use varchar or TEXT.
To edit source code Online, I recommend markItUp. For displaying only (without edit) there may be simpler solutions.