我是Java脚本的新手.我正在练习code.When我把我的代码放在head部分,然后我得到元素null,当我把它放在body中,但在元素之前,然后我也得到null,但如果我把它放在body中,但是在元素之后然后我得到了元素.我想问一下为什么在前两种情况下我得到null.这是我的代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/attributes.js"></script> // null
</head>
<body>
<script type="text/javascript" src="js/attributes.js"></script> // null
<a id="braingialink"
onclick="return showAttributes();"
href="http://www.braingia.org" >Steve Suehring's Web Site
</a>
<script type="text/javascript" src="js/attributes.js"></script> // ok
</body>
Run Code Online (Sandbox Code Playgroud)
这是我的javascript
var a1 = document.getElementById("braingialink"); //get null in first two cases
window.alert(a1.getAttribute("href"));
a1.setAttribute("href", "www.google.com");
window.alert(a1.getAttribute("href"));
function showAttributes() {
var e = document.getElementById("braingialink");
var elementList = "";
for (var element in e) {
/**
* Sometimes, especially when …Run Code Online (Sandbox Code Playgroud) 我在Netbeans 6.9中创建了一个JSF 2.0项目.我开始使用CDI了.在我尝试添加范围创建项目后,我注意到它中没有viewcope.我想知道对话范围和视图范围是指同样的事情吗?我可以使用会话范围代替视图范围.如果不是那么我如何将视图范围与CDI一起使用.我也知道缝是解决方案,但我怎么能用netbeans缝.是否有任何netbeans插件接缝?接缝-3-
谢谢
我使用<p:graphicImage>如下:
<div id="mapp">
<h3>Country Map</h3>
<p:graphicImage id="city"
value="#{countryPages_Setup.countryMap}"
width="250"
height="190">
</p:graphicImage>
</div>
Run Code Online (Sandbox Code Playgroud)
但这不是可点击的图像.如何使这个图像可以点击,以便当用户点击它时,我可以调用我想要的托管bean动作.
我做了一个消息框,上面有两个按钮.基本上它是一个jQuery插件,具有叠加效果的弹出窗口.但是当出现消息框,并且用户按下选项卡按钮时,消息对话框不会聚焦.那么我怎么能这样做呢,如果我的消息框出现,然后焦点自动转到我的消息框?当焦点丢失并且用户再次按下标签按钮然后它再次回到我的消息拨号如果我用鼠标单击消息框然后按标签按钮,然后焦点到达按钮然后消失.这是图像
.这是制作盒子的代码.
var containerDiv = $("<div></div>", {
id: config.containerDivID
});
// append all the div to main Div(container)
containerDiv.append(messageDiv, buttonDiv);
centerPopup(config, containerDiv);
loadPopup(config);
function centerPopup(config, container){
var backgroundPopup = $("<div></div>", {
id: "backgroundPopup"
}); //end of imageDiv
$("body").append(backgroundPopup);
$("body").append(container);
$("#backgroundPopup").css({
"height": windowHeight
});
} //end of centerPopup()
function loadPopup(config){
//loads popup only if it is disabled
if(popupStatus==0){
$("#backgroundPopup").css({
"opacity": "0.7"
});
$("#backgroundPopup").fadeIn("slow");
$("#" + config.containerDivID).fadeIn("slow");
popupStatus = 1;
} //end of if
} //end of function loadPopup()
Run Code Online (Sandbox Code Playgroud)
谢谢
我有这样的页面布局
<input id="name" class="mandotary" type="text">
<label for="name">Name must be entered</label>
<input id="code" class="mandotary" type="text">
<label for="code">Code must be entered</label>
Run Code Online (Sandbox Code Playgroud)
现在我想首先加载页面时隐藏标签元素.如果失去焦点且值为null,则应显示标签,否则应隐藏标签.我试过这个
var inputElementArray = $("input.mandotary");
$.each(inputElementArray, function(index, element){
var id = $(element).attr("id");
var label = $("label").attr("for", id);
// label.hide();
$(element).focus(function(){
var next = $(element).next();
$(element).next().hide();
}); //end of focus()
$(element).blur(function(){
// get value of text area
var text = $(element).val();
if (text == "") {
var next = $(element).next();
$(element).next().show();
} //end of if
}); //end of blur()
}); //end of …Run Code Online (Sandbox Code Playgroud) 我开发了一个Web服务。当我想在服务器上发布它时,出现以下错误
cannot Deploy TemperatureConverterServiceClientEAR
Deployment Error for module: TemperatureConverterServiceClientEAR: Error occurred
during deployment: Exception while loading the app : java.lang.Exception: WEB0113:
Virtual server [server] already has a web module
[AndroidBackendAuthentication.war] loaded at [/AndroidBackendAuthentication];
therefore web module
[TemperatureConverterServiceClientEAR#AndroidBackendAuthentication.war] cannot be
loaded at this context path on this virtual server. . Please see server.log for
more details
Run Code Online (Sandbox Code Playgroud)
我去目录C:\glassfish3\glassfish\domains\domain1\eclipseApps并删除所有文件。我也去了

然后,我在服务器上单击。在default Web module选项中,我有以下条目

我如何从这里删除这些模块。每当我尝试部署Web服务时,都会收到此消息。我如何摆脱此消息?我还从“应用程序”选项中删除了已部署的模块,此后该default Web module选项变为空。但是如果我尝试部署任何Web服务,就会收到错误消息。请帮忙
谢谢。
我是hibernate的新手,并试图在hibernate中运行查询,但我得到了异常
unexpected token: ON near line 1, column 135 [SELECT A.comp_id.appRefNo ....
Run Code Online (Sandbox Code Playgroud)
这是代码
StringBuffer query = new StringBuffer("SELECT A.comp_id.appRefNo,
A.comp_id.custId from ");
query.append(LosaCustContactZ.class.getName());
query.append(" A INNER JOIN " + LosaCust.class.getName() + " B
ON ( B.comp_id.appRefNo = A.comp_id.appRefNo AND " +
"B.comp_id.custId = A.comp_id.custId) INNER JOIN " + LosaApp.class.getName() + " C
ON " + "(B.comp_id.appRefNo = A.comp_id.appRefNo) ");
query.append("WHERE C.comp_id.appRefNo != ?" + " AND C.appDt >= ? AND
A.contactT = 'PHONE'" );
if (StringUtils.isNotEmpty(phoneNums)) {
query.append(" AND A.contact …Run Code Online (Sandbox Code Playgroud) 我正在使用过滤器处理JSF 2.0中的会话到期.这是代码
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
HttpSession session = httpServletRequest.getSession(false);
if (session == null) {
//session timeout check.
if (httpServletRequest.getRequestedSessionId() != null && !httpServletRequest.isRequestedSessionIdValid()) {
System.out.println("Session has expired");
session = httpServletRequest.getSession(true);
session.setAttribute("logedin", "0"); // public user
httpServletResponse.sendRedirect(timeoutPage);
} else {
session = httpServletRequest.getSession(true);
session.setAttribute("logedin", "0");
filterChain.doFilter(httpServletRequest, httpServletResponse);
}
}
} //end of doFilter()
Run Code Online (Sandbox Code Playgroud)
但问题是,当会话到期并且用户点击后退按钮时,他会获得所有样式的页面.无论如何,当会话到期时,如果用户单击浏览器后退按钮,则他会指向timeoutPage.
还有一点,我也在我的页面上使用Prime Faces组件,比如datatable.我正在使用分页.如果会话超时,并且我单击分页,则不会出现会话到期消息.似乎ajax请求不调用过滤器?如何连接我的ajax事件,或者你可以说数据表分页事件到会话到期?
谢谢
我试图在片段中向spinner添加项目.但我对上下文有疑问.因为在片段中没有上下文.我在这里怎么样
public class DetailFrag extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View scrollView = inflater.inflate(R.layout.myscrollview , container, false);
LinearLayout linearLayout = (LinearLayout) scrollView.findViewById(R.id.mylayout1);
for (int i=0; i<questionList.size(); i++) {
View verticalLinearLayout = inflater.inflate(R.layout.mylistrow, null);
View horizontalLInearLaoyout = verticalLinearLayout.findViewById(R.id.questionRow);
TextView tv = (TextView) horizontalLInearLaoyout.findViewById(R.id.question);
Spinner spinner = (Spinner) horizontalLInearLaoyout.findViewById(R.id.spinner);
//Problem: how to define this in fragment createFromResource(this,...)
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.options_array, android.R.layout.simple_spinner_item);
EditText editText = (EditText) verticalLinearLayout.findViewById(R.id.txtMultiLine);
String question = questionList.get(i).question;
tv.setId(i);
tv.setText(i …Run Code Online (Sandbox Code Playgroud) 我收到以下错误
Line 84 in XML document from class path resource [car-job-app-context.xml] is
invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 84;
columnNumber: 154; cvc-complex-type.2.4.c: The matching wildcard is strict, but
no declaration can be found for element 'jpa:repositories'.
Run Code Online (Sandbox Code Playgroud)
这是我的档案
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:repository="http://www.springframework.org/schema/data/repository"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
http://www.springframework.org/schema/data/repository
http://www.springframework.org/schema/data/repository/spring-repository.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa-2.0.xsd" >
.....
<context:annotation-config/>
<context:component-scan base-package="pk.training.basitMahmood.service.impl" />
<jpa:repositories base-package="pk.training.basitMahmood.repository" entity-manager-factory-ref="emf" transaction-manager-ref="transactionManager" />
Run Code Online (Sandbox Code Playgroud)
这是我的maven依赖项的快照

我也看到了同样的链接,说移动tx declaration后context但它不起作用.
与我的问题相同的帖子.我在组合之前和之后尝试过,但错误仍然存在. …
jquery ×2
jsf-2 ×2
android ×1
clickable ×1
glassfish-3 ×1
graphicimage ×1
hibernate ×1
hql ×1
javascript ×1
jpa-2.0 ×1
jsf ×1
netbeans-6.9 ×1
primefaces ×1
seam ×1
spring ×1