我有这样的html结构:
<div id="triger1">some elements inside</div>
<div id="triger2">some elements inside</div>
<div id="triger3">some elements inside</div>
<div id="triger4">some elements inside</div>
Run Code Online (Sandbox Code Playgroud)
我如何获得JQuery中所有div的数组,其中包含triger ID(正如你所看到的,它们都有triger但不同的编号,例如.trig1,triger2等......)
提前致谢
我不确定这是否可行.
我目前正在开展一个大学项目,我有一个使用存储过程的函数.我想知道是否可以采用相同的SqlCommand
实例并应用更新的参数在同一函数内再次调用存储过程.
让我说我的代码中有这样的东西:
myConStr = ConfigurationManager.ConnectionStrings["MyConnString"].ConnectionString;
myConn = new SqlConnection(myConStr);
myCommand = new System.Data.SqlClient.SqlCommand("team5UserCurrentBooks3", myConn);
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.Parameters.AddWithValue("@book_id", bookID);
myCommand.Parameters.AddWithValue("@user_id", userID);
try
{
myConn.Open();
myCommand.ExecuteNonQuery();
Run Code Online (Sandbox Code Playgroud)
是否可以更新MyCommand
参数并再次调用存储过程?
除非我移动光标,否则SendInput不会执行鼠标单击按钮.
我很感激对这一个的帮助,因为我似乎无法绕过它.
我有一个程序,在前景窗口上执行鼠标单击,我在其中使用SendInput模拟鼠标左键单击.问题是,如果我将光标移动到点击位置而不是SendInput将进行点击,但是如果我不移动光标而不是没有点击发生,即使通过我传递x和y指向MouseInputData.我想执行鼠标左键而不需要实际移动光标.
贝娄是我的课程(相当简单和直接前进)
namespace StackSolution.Classes
{
public static class SendInputClass
{
[DllImport("user32.dll", SetLastError = true)]
static extern uint SendInput(uint nInputs, ref INPUT pInputs, int cbSize);
[DllImport("user32.dll")]
static extern bool SetCursorPos(int X, int Y);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetCursorPos(out Point lpPoint);
[StructLayout(LayoutKind.Sequential)]
struct INPUT
{
public SendInputEventType type;
public MouseKeybdhardwareInputUnion mkhi;
}
[StructLayout(LayoutKind.Explicit)]
struct MouseKeybdhardwareInputUnion
{
[FieldOffset(0)]
public MouseInputData mi;
[FieldOffset(0)]
public KEYBDINPUT ki;
[FieldOffset(0)]
public HARDWAREINPUT hi;
}
[StructLayout(LayoutKind.Sequential)]
struct KEYBDINPUT
{
public ushort wVk;
public ushort …
Run Code Online (Sandbox Code Playgroud) 我正在为我的大学项目使用jsp,jstl和jsf进行应用程序,据说,我对jsf也很新.
到目前为止,一切都很顺利.但是,我似乎有一个问题,想知道如何从托管bean重定向到dinamyc参数的页面.例如article.jsp?article_id=2
有人能告诉我它是如何完成的吗?
我一直想尝试使用像
FacesContext.getCurrentInstance().getExternalContext().dispatch("faces/article.jsp2?article_id=" + articleId);
Run Code Online (Sandbox Code Playgroud)
但得到错误:
javax.servlet.ServletException: #{postComment.postClick}: javax.faces.FacesException: javax.servlet.ServletException: javax.faces.component.UIViewRoot cannot be cast to com.sun.faces.application.StateManagerImpl$TreeNode
javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
Run Code Online (Sandbox Code Playgroud)
我一直在努力使用
response.sendRedirect("faces/article.jsp2?article_id=" + articleId);
return;
Run Code Online (Sandbox Code Playgroud)
但又一次出错了.
javax.servlet.ServletException: Cannot forward after response has been committed
javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我在使用jsf时如何从托管java bean重定向?
贝娄是我的代码(可能是错误的,这就是为什么重定向不工作).
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
String articleId = request.getSession().getAttribute("article_id").toString();
//String articleId = request.getParameter("article_id");
String authorName = request.getSession().getAttribute("user_name").toString();
java.util.Calendar calendar = java.util.Calendar.getInstance();
String commentDate = String.valueOf(calendar.get(java.util.Calendar.DAY_OF_MONTH)) + ".";
commentDate += String.valueOf(calendar.get(java.util.Calendar.MONTH)) + ".";
commentDate += String.valueOf(calendar.get(java.util.Calendar.YEAR));
ArrayList error …
Run Code Online (Sandbox Code Playgroud) 我用谷歌搜索并搜索了几个小时如何在jsp或servlet中进行重定向.但是,当我尝试应用它时,它不起作用.
我在jsp页面中的代码:
<%
String articleId = request.getParameter("article_id").toString();
if(!articleId.matches("^[0-9]+$"))
{
response.sendRedirect("index.jsp");
}
%>
Run Code Online (Sandbox Code Playgroud)
我知道从调试regexp工作,如果任何时候,articleId不是数字,if
内部,但当它到达response.sendRedirect时,它实际上不会重定向.
在这种情况下,我是否会错过一些非常基础
提前致谢.
我有一点问题我想在JSF textarea组件上使用MartkItUp JQuery富文本编辑器.我的表单看起来像这样:
<h:form id="comment">
<h:inputTextarea id="commentBody" cols="10" rows="10" value="#{postComment.commentBody}" required="true" requiredMessage="Comment Body is reqguired" >
<f:validateLength maximum="500" minimum="2" />
</h:inputTextarea>
<%-- more of the form... %-->
Run Code Online (Sandbox Code Playgroud)
问题是在输出上它给了我这样的textarea的id
id="comment:commentBody"
Run Code Online (Sandbox Code Playgroud)
当我尝试在JQuery中指出它没有任何反应.
$('#comment:commentBody').markItUp(mySettings);
Run Code Online (Sandbox Code Playgroud)
我之前有一个普通的textarea,没有问题.现在,我有很多.
我如何在JQuery中指向id,这看起来像是comment:commentBody
PS:我知道我可以用$('textarea')指向这个文本区域.markItUp(mySettings); 但是我正在寻找通过它的ID指向特定文本区域的解决方案.
我试图在三列上加入两个表,我收到一个错误:
error CS1941: The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.
Run Code Online (Sandbox Code Playgroud)
我不确定发生了什么.我检查的类型st_year
,st_month
,st_day
year
,month
,和day
他们都是int
,所以我不应该得到的错误.
代码是:
var q = from obj in objTimeLine
join ev in eventsTimeLine
on new {obj.st_year, obj.st_month, obj.st_day} equals new {ev.year, ev.month, ev.day}
select new {obj, ev};
Run Code Online (Sandbox Code Playgroud)
但是,如果我这样做:
var q = from obj in objTimeLine
join ev in eventsTimeLine
on obj.st_year equals ev.year …
Run Code Online (Sandbox Code Playgroud) 我是JavaScript的新手,只是我第一次尝试学习.作为一个小练习,我试着这么简单.
我正试图重新定位我在页面加载时的按钮.我做错了什么?
我将不胜感激.
我的代码如下:
<style type="text/css">
.mybutton{
position:absolute;
}
Run Code Online (Sandbox Code Playgroud)
JavaScript的:
<script type="text/javascript">
window.onload=function(){
var mytestdiv = document.getElementById("testdiv");
var mytestbutton = document.getElementById("testdiv").childNodes()[0];
var y = mytestdiv.offsetWidth;
var x = mytestdiv.offsetHeight;
mytestbutton.style.right = x;
mytestbutton.style.top = y;
}
</script>
Run Code Online (Sandbox Code Playgroud)
而我非常简单的HTML:
<body>
<div id="testdiv" style="width:500px;border:solid #000000">
<input type="submit" id="myButton" value="TestMe">
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
编辑: 我在furebug中遇到的错误是:
mytestbutton.style is undefined
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用JDBC,我的查询在某些情况下工作但在其他情况下不工作.我真的很感激任何帮助.
我的一些代码:
public Result getSpecificTopic()
{
String query = "Select msg_body, msg_author from lawers_topic_msg";// where msg_id=2 order by msg_id desc";
try
{
con = mysql.getConnection();
//Statement stmt = con.createStatement();
PreparedStatement stmt = con.prepareStatement(query);
//stmt.setInt(1, topicId);
ResultSet rs = stmt.executeQuery(query);
int rowCount = rs.getRow();
specificTopic = ResultSupport.toResult(rs);
con.close();
stmt.close();
}
catch(Exception e)
{
}
return this.specificTopic;
}
public void setTopicId(String num)
{
this.topicId = Integer.parseInt(num);
}
public int getTopicId()
{
return this.topicId;
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我改变
String query = "Select msg_body, msg_author from …
Run Code Online (Sandbox Code Playgroud)