我的jsp中有一些列表项标签.每个列表项都包含一些元素,包括一个名为delete的链接("a"标签).我想要的只是在点击链接时删除整个列表项.
这是我的代码的结构:
$("a").click(function(event) {
event.preventDefault();
$(this).parent('.li').remove();
});Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<li id="191" class="li">
<div class="text">Some text</div>
<h4><a href="URL">Text</a></h4>
<div class="details">
<img src="URL_image.jpg">
<span class="author">Some info</span>
<div class="info"> Text
<div class="msg-modification" display="inline" align="right">
<a name="delete" id="191" href="#">Delete</a>
</div>
</div>
</div>
</li>Run Code Online (Sandbox Code Playgroud)
但这不起作用.我是jQuery的新手,所以我尝试了一些东西,例如:
$(this).remove();
Run Code Online (Sandbox Code Playgroud)
这有效,它会在单击时删除链接.
$("#221").remove();
Run Code Online (Sandbox Code Playgroud)
这有效,它删除指示的列表项,但它不是"动态的".
有人可以给我一个提示吗?
我在查询中遇到错误。此查询正常并返回数据(选择和行数用于分页):
select *
from (select a.*, rownum rnum
from (select id_edition, id_document, name, extension, creation_date, url,
(select inscription_date from edition_student_d0 where id_edition = 12345 and id_third = 12345) inscription_date
from upd_edition_doc_d0
where id_edition = 1071591
order by creation_date desc) a
where rownum <= 10 )
where rnum >= 1
Run Code Online (Sandbox Code Playgroud)
现在我尝试包含“case when”并仅在某些情况下获取 url,因此我进行了这些修改,包括 case 块:
select *
from (select a.*, rownum rnum
from (select id_edition, id_document, name, extension, creation_date,
(select inscription_date from edition_student_d0 where id_edition = 12345 and id_third = 12345) …Run Code Online (Sandbox Code Playgroud) 基本上我有两个这样的表:
表1:用户
id_user, name, ...
Run Code Online (Sandbox Code Playgroud)
表2:叶子
id_2, employee (the column employee is the id of the user from the first table), ...
Run Code Online (Sandbox Code Playgroud)
现在表2是空的(没有行),对于第一个表中的每个用户,我想在第二个表上创建一行,将第一个表中的id作为列雇员中的值插入,如:
表2:叶子
id employee column1 column2 column3 column4 column5
id1 1 date1 date2 integer1 integer2 string
id2 2 date1 date2 integer1 integer2 string
...
Run Code Online (Sandbox Code Playgroud)
我试过的INSERTS:
这个工作正常:
INSERT INTO entitleddays (employee, startdate, enddate, type, days, description)
VALUES (1, '2015-01-01', '2015-12-31', 3, 5, 'test');
Run Code Online (Sandbox Code Playgroud)在这里,我尝试了上面解释的内容,但它不起作用:
INSERT INTO entitleddays (employee, startdate, enddate, type, days, description)
VALUES ((SELECT id from users), '2015-01-01', …Run Code Online (Sandbox Code Playgroud)使用Java和JDBC在Oracle中插入时遇到问题.获得的错误是:
java.sql.SQLException:ORA-00917:缺少逗号
插入的数据取自类似字符串的形式,并解析为适当的数据类型,然后保存在名为edicio的对象中.一切都好.然后,我的意图是使用此对象的数据在DB中插入.
这是DAO的代码,我在这里插入:
public Edicio insertarCurs(Connection con, Edicio ed) throws SQLException {
PreparedStatement stm = null;
ResultSet rst = null;
// Insert
StringBuffer sql = new StringBuffer();
sql.append("INSERT INTO curs (id, nom, idarea, area, programa, datainici)");
sql.append(" VALUES (?, ?, ?, ?, ?, ?");
logger.info("Building insert works fine.");
try {
stm = con.prepareStatement(sql.toString());
// params
stm.setLong(1, ed.getIdEdicio());
stm.setString(2, ed.getNomEdicio());
stm.setLong(3, ed.getIdArea());
stm.setString(4, ed.getArea());
stm.setString(5, ed.getPrograma());
// Conversion from Java Date to SQL Date
java.sql.Date sqlDate = new java.sql.Date(ed.getDataInici().getTime());
logger.info("sqlDate …Run Code Online (Sandbox Code Playgroud) oracle ×2
case-when ×1
database ×1
identifier ×1
java ×1
javascript ×1
jdbc ×1
jquery ×1
mysql ×1
ora-00904 ×1
ora-00917 ×1
parent ×1
sql-insert ×1
subquery ×1