eclipse script type="text/html"

本文讨论了如何在使用Eclipse Indigo编辑JavaScript渲染的HTML模板时,解决语法高亮、格式化等问题。通过安装特定插件,可以将包含<script type=text/html>标签的内容视为HTML进行编辑。

http://stackoverflow.com/questions/12056265/editing-text-html-content-in-eclipse

I'm getting more into using javascript-rendered templates by wrapping them in 'script type="text/html"' tags (in my case within a JSP). The problem is that Eclipse (Indigo) doesn't apply any formatting such as syntax colouring, indentation, suggestions, etc. Is there a way that i can tell Eclipse to treat such content as HTML?

(Edit)

Thanks to folks for the answers, but perhaps i should clarify the question. JSP editing in Eclipse works quite well - just a few nuisances here and there. Different formats within the JSP including JSP, Javascript, HTML, and scriptlets work fine. I just wondered whether there was a configuration somewhere where i could define a <script type="text/html"> section to be rendered as HTML. If the answer is no, so be it.

answer:



You need a plugin for Eclipse. Such as this one.

share improve this answer



 

http://amateras.osdn.jp/cgi-bin/fswiki_en/wiki.cgi?page=EclipseHTMLEditor

I'm getting more into using javascript-rendered templates by wrapping them in 'script type="text/html"' tags (in my case within a JSP). The problem is that Eclipse (Indigo) doesn't apply any formatting such as syntax colouring, indentation, suggestions, etc. Is there a way that i can tell Eclipse to treat such content as HTML?

(Edit)

Thanks to folks for the answers, but perhaps i should clarify the question. JSP editing in Eclipse works quite well - just a few nuisances here and there. Different formats within the JSP including JSP, Javascript, HTML, and scriptlets work fine. I just wondered whether there was a configuration somewhere where i could define a <script type="text/html"> section to be rendered as HTML. If the answer is no, so be it.

<%@ page language="java" contentType="text/html; charset=UTF-8" import="dao.*,model.*,java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>员工基本信息</title> <!-- 引入本地 EasyUI 的 CSS 和 JS(假设项目根目录下有 easyui 文件夹) --> <link rel="stylesheet" type="text/css" href="../easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="../easyui/themes/icon.css"> <script type="text/javascript" src="../easyui/jquery.min.js"></script> <script type="text/javascript" src="../easyui/jquery.easyui.min.js"></script> </head> <body> <% Userdao mydao = new Userdao(); List<Users> userlist = mydao.QueryUserInfoAll(); %> <h1 align="center">员工基本信息</h1> <!-- 使用 EasyUI 的 datagrid 组件 --> <!-- 外层添加一个 div 容器,并设置居中样式 --> <div style="width: 100%; text-align: center;"> <table class="easyui-datagrid" style="width:600px; height:auto; margin: 0 auto;" data-options="singleSelect:true, collapsible:true, url:'', method:'get'"> <thead> <tr> <th data-options="field:'user_id', width:100, align:'center'">用户名</th> <th data-options="field:'user_pwd', width:100, align:'center'">密码</th> </tr> </thead> <tbody> <% Users myUsers = new Users(); for (int i = 0; i < userlist.size(); i++) { myUsers = userlist.get(i); String user_id = myUsers.getuser_id(); String user_pwd = myUsers.getuser_pwd(); %> <tr> <td><%=user_id%></td> <td><%=user_pwd%></td> </tr> <% } %> </tbody> </table> </div> </body> </html>
最新发布
07-06
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="zh-CN" class="bootstrap-admin-vertical-centered"> <head> <meta charset="UTF-8"> <title>图书馆管理系统</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="static/css/bootstrap.min.css"> <link rel="stylesheet" href="static/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="static/css/bootstrap-admin-theme.css"> <link rel="stylesheet" href="static/css/bootstrap-admin-theme.css"> <script src="static/js/bootstrap.min.js"></script> <script src="static/jQuery/jquery-3.1.1.min.js"></script> <script src="static/ajax-lib/ajaxutils.js"></script> <script src="static/js/login.js"></script> </head> <style type="text/css"> .alert{ margin: 0 auto 20px; text-align: center; } </style> <script src="static/js/jquery.min.js"></script> <script src="static/js/bootstrap.min.js"></script> <body class="bootstrap-admin-without-padding"> 池州学院 230312242 杨洪博 课设 <div style="background-image: url('/books/WebContent/2.png'); background-size: cover; background-repeat: no-repeat; background-position: center;"></div> <div class="col-lg-12"> <div class="alert alert-info"> <a class="close" data-dismiss="alert" href="#">×</a> 欢迎登录图书馆管理系统 </div> <form class="bootstrap-admin-login-form" method="post" action="/books/LoginServlet"> <% String state = (String)session.getAttribute("state"); session.removeAttribute("state"); if(state!=null){ %> <label class="control-label" for="username">密码错误</label> <%}%> <div class="form-group"> <label class="control-label" for="username">账 号</label> <input type="text" class="form-control" id="username" name="username" required="required" placeholder="学号"/> <label class="control-label" for="username" style="display:none;"></label> </div> <div class="form-group"> <label class="control-label" for="password">密 码</label> <input type="password" class="form-control" id="password" name="password" required="required" placeholder="密码"/> <label class="control-label" for="username" style="display:none;"></label> </div> <label class="control-label" for="password">没有账号请<a href="/books/register.jsp" style="color:blue;">注册</a></label> <br> <input type="submit" class="btn btn-lg btn-primary" value="登    录"/> </form> </div> </div> </div> <div class="modal fade" id="modal_info" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="infoModalLabel">提示</h4> </div> <div class="modal-body"> <div class="row"> <div class="col-lg-12" id="div_info"></div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" id="btn_info_close" data-dismiss="modal">关闭</button> </div> </div> </div> </div> </body> </html> 图片不显示 是哪里出了问题
06-22
<%@ page language="java" import="supermarket.connDb,java.util.* " contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% ArrayList<String[]> list = connDb.index_4(); ArrayList<String[]> list2 = connDb.index_5(); %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>ECharts supermarket</title> <link href="./css/style.css" type="text/css" rel="stylesheet"/> <link rel="shortcut icon" href="#"/> <script src="./js/echarts.min.js"></script> <script src="./js/echarts.js"></script> <script src="./js/style/macarons.js"></script> <script src="./js/style/roma.js"></script> <script src="./js/style/vintage.js"></script> </head> <body> <div class='header'> <p>ECharts supermarket</p> </div> <div class="content"> <div class="nav"> <ul> <li><a href="./SMindex.jsp">总商品品类成交对比</a></li> <li><a href="./SMindex1.jsp">饮品成交量对比</a></li> <li><a href="./SMindex2.jsp">各省会员人数</a></li> <li><a href="./SMindex3.jsp">男女购买商品对比</a></li> <li class="current"><a href="#">商品购买关系</a></li> </ul> </div> <div class="container"> <div class="title">超市商品购买关系</div> <div class="show"> <div class='chart-type'></div> <div id="main" style="width:700px;height:500px"></div> </div> </div> </div> <script> var supermarketContainer=document.getElementById('main'); //基于准备好的dom,初始化echarts实例 var myChart = echarts.init(supermarketContainer); //指定图表的配置项和数据 <% ArrayList list11 = new ArrayList(); for(int i =0;i<list.size();i++){ list11.add(list.get(i)[0]); list11.add(list.get(i)[1]); } System.out.println(list11); LinkedHashSet<Integer>hashSet =new LinkedHashSet(list11); ArrayList<Integer>list1 =new ArrayList(hashSet); //System.out.println(list1); %> var nodes =[]; <% for(int i =0; i<list1.size(); i++){ %> nodes.push({ name: '<%=list2.get(i)[1]%>', id: '<%=list2.get(i)[0]%>', symbolSize: 20, symbol:'circle',}) <% } %> console.log(nodes) var links =[]; <% for(int i =0; i<list.size();i++){ String temp =list.get(i)[2]; double temp1 =Double.parseDouble(temp); double temp2 =temp1 * 10; temp1 =temp1 * 100; temp =String.format("%.2f", temp1).toString()+"%"; //System.out.println(temp); %> links.push({ source: '<%=list.get(i)[0]%>', target: '<%=list.get(i)[1]%>', lineStyle: {width: '<%=temp2%>'}, relation: {name: '<%=temp%>'}}) <% } %> console.log(links) var option ={ title: { text: '超市商品购买关系图', left: 'left', //top: 20, textStyle: { //color: '#ccc' } }, tooltip : { trigger: 'item' //formatter: "{a} <br/>{b} : {c} ({d}%)" }, visualMap: { show: false, min: 80, max: 600, inRange: { //colorLightness: [0, 1] } }, grid:{ containable:true }, series : [ { type: 'graph', layout: 'force', nodes: nodes, links: links, force: { repulsion:100, gravity:0.03, edgeLength:80, layoutAnimation:false }, itemStyle: { normal: { opacity:0.9, color:function(params){ var colorList=[ '#C1232B','#B5C334','#FCCE10','#E87C25','#27727B', '#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD', '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0', ]; return colorList[params.dataIndex] } } }, lineStyle: { normal: { show:true, color:'target', width:5 } }, label: { show: true, position: "bottom", distance: 5, fontSize: 10, align: "center", }, autoCurveness: 0.01, edgeLabel: { show: true, position: "middle", fontSize: 10, formatter: (params) =>{ return params.data.relation.name; }, }, edgeSymbol: ["circle", "arrow"], } ] }; // 使用刚指定的配置项和数据显示图表 option && myChart.setOption(option); //}} </script> </body> </html>这是index.jsp代码Tomcat7.0
05-27
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <!DOCTYPE html> <html> <head> <title> 淘!我喜欢</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <!-- 顶部导航栏 --> <div class="top-nav"> <div class="container"> <a href="#">亲,请登录</a> <a href="#">免费注册</a> <a href="#">我的订单</a> <a href="#">购物车</a> </div> </div> <!-- 搜索区域 --> <div class="search-area"> <div class="container"> <img src="images/logo.png" alt="logo" class="logo"> <div class="search-box"> <input type="text" placeholder="请输入搜索关键词"> <button>搜索</button> </div> </div> </div> <!-- 商品分类导航 --> <div class="category-nav"> <div class="container"> <a href="#">女装</a> <a href="#">男装</a> <a href="#">数码</a> <a href="#">家电</a> <a href="#">美妆</a> <a href="#">食品</a> </div> </div> <!-- 轮播广告 --> <div class="banner"> <img src="images/banner1.jpg" alt="促销广告"> </div> <!-- 商品展示区 --> <div class="product-showcase"> <div class="container"> <h2>猜你喜欢</h2> <div class="products"> <%-- 动态商品数据示例 --%> <div class="product-item"> <img src="images/product1.jpg" alt="商品1"> <p class="title">夏季新款连衣裙</p> <p class="price">¥128.00</p> </div> <%-- 更多商品项... --%> </div> </div> </div> <!-- 页脚 --> <footer> <div class="container"> <p>© 2023 淘宝网</p> </div> </footer> <script src="js/main.js"></script> </body> </html> 将上代码改到jdk1.8版本下的
07-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xiangyong58

喝杯茶还能肝到天亮,共同进步

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值