小编Rev*_* V.的帖子

ui:decorate和ui:include之间真正的概念差异是什么?

它发生前我ui:decorate在功能一样ui:include,只是你也可以通过ui:paramui:define被包含文件.

我疯了吗?

编辑:虽然事实上你也可以传递ui:param给一个ui:include文件,但事实证明我已经在做了.也许你也可以通过ui:define,我会在这里检查和编辑.

jsf facelets

23
推荐指数
1
解决办法
3万
查看次数

$和jQuery有什么区别

当我尝试使用$("#div_id")$(document).ready它返回NULL,但是当我使用jQuery("#div_id")它返回实际的对象!

为什么会这样?

更新:我尝试了noConflict方法而没有获得任何提示.

jQuery.noConflict()
function (a,b){return new c.fn.init(a,b)}

$.noConflict();
TypeError: Object function ()
    {
        return document.getElementById.apply(document, arguments)
    } has no method 'noConflict'
Run Code Online (Sandbox Code Playgroud)

更新2:

$(document).ready(function() {
    debugger;
});

<input type="text" id="test" name="test" value="123" />
Run Code Online (Sandbox Code Playgroud)

当我在控制台中运行以下代码时,我得到了这些结果:

$("#test").val()
TypeError: Cannot call method 'val' of null
jQuery("#test").val()
"123"
Run Code Online (Sandbox Code Playgroud)

谢谢

jquery

21
推荐指数
3
解决办法
1万
查看次数

在JSF项目中通过<welcome-file>设置默认主页

当我使用Eclipse中的Tomcat 8.0启动Java EE项目时,我无法设置在浏览器中加载的默认页面.我正在尝试学习JSF,所以我遵循了本教程

一切正常,但是当我右键单击login.xhtmlwelcome.xhtml文件并选择"在服务器上运行/运行" 时,我只能看到创建的页面.

到目前为止,我创建的所有其他Web应用程序在我启动整个项目时都加载了默认页面.默认行为是加载index.html页面(如果有的话,可能是index.jsp).所以我添加index.htmlindex.xhtml页面到我的WEB-INF项目文件夹,希望其中至少有一个将被显示.然而,没有任何反应.浏览器始终只显示localhost:8080/JSFFaceletsTutorial/URL 上的页面,但页面是白色的,甚至不是错误消息.我想我一直在解决这个问题的过程中遇到错误404,但是,我不再能够重现这个错误,我不记得是什么导致了它.

我发现可以更改默认的起始页面

但是,它对我也不起作用.无论我是否编辑web.xml文件,我都得到相同的结果.

更令人费解的是,当我尝试更改网络浏览器时:"窗口/网络浏览器/ ..."它在外部网络浏览器中的作用时间与内部Eclipse网络浏览器不同.内部总是空白页面 - 但外部网络浏览器曾经设法显示index.html页面 - 但它是一些过时的版本.尽管我完全确定我编辑了它,保存了更改,重新启动了服务器......但它仍然显示了页面的过时版本.即使在这种情况下,它仍然忽略了web.xml文件中所做的更改.但是当我现在尝试它时,它再次在所有浏览器中显示空白页面.除了编辑web.xml文件外,我不知道我做了什么改变......

我的猜测是问题在于我还没有完全掌握的JSF技术.这是因为当我选择使用右键单击"运行方式/在服务器上运行" 来运行login.xhtmlwelcome.xhtml页面时,这些页面的URL将显示localhost:8080:路径/JSFFaceletsTutorial/faces/login.xhtml/JSFFaceletsTutorial/faces/welcome.xhtml.这很奇怪,因为我的项目中没有任何目录"faces".键入所有可能的排列:

<welcome-file-list>
    <welcome-file>faces/index.html</welcome-file>
    <welcome-file>faces/index.xhtm</welcome-file>
</welcome-file-list>
Run Code Online (Sandbox Code Playgroud)

在这web.xml也没有帮助.当我在那里输入完整地址时,它没有帮助.

以下是我在控制台中收到的警告(我跳过了INFO日志条目):

"2014年12月19日上午9:39:55 org.apache.tomcat.util.digester.SetPropertiesRule开始警告:[SetPropertiesRule] {Server/Service/Engine/Host/Context}将属性'source'设置为'org.eclipse. jst.jee.server:JSFFaceletsTutorial'找不到匹配的属性....警告:JSF1074:已经注册了名为'loginBean'的托管bean.用com.tutorial.LoginBean替换现有的托管bean类com.tutorial.LoginBean .2014年12月19日上午9:39:57 org.apache.coyote.AbstractProtocol start"

我不确定这是否有用.我现在没有想法了.

eclipse jsf tomcat homescreen welcome-file

9
推荐指数
1
解决办法
2万
查看次数

刷新 iframe 而不刷新整个页面

我有一个 iframe,我想自动刷新自身,而不刷新整个页面。我更喜欢使用 javascript 或 jquery。这是我一直在尝试但没有成功的。

<div class="Widget"><!--DARK SKY-->
    <div class="WidgetHeader">
        <img src = "images/WidgetHeaders/DarkSky.png"></div>
    <div id="DarkSky" style="width: auto; height: 245px; padding: 5px; background-color: hsla(0,0%,100%,.9);">
        <iframe id="forecast_embed" type="text/html" frameborder="0" height="245" width="100%" src="http://forecast.io/embed/#lat=38.269571&lon=-85.487420&name=Louisville&units=us&color=#4c7cba"> </iframe>
    </div>   
</div>

<script type = "text/javascript">
    window.onload = function() {   
        setInterval(function refreshDarkSky() {  
            document.getElementById("#forecast_embed").src ="http://forecast.io/embed/#lat=38.269571&lon=-85.487420&name=Louisville&units=us&color=#4c7cba"
        }, 90000);
    } 
</script>
Run Code Online (Sandbox Code Playgroud)

javascript iframe jquery refresh reload

8
推荐指数
1
解决办法
3万
查看次数

Android:联系人Picker Intent | 无法实例化Uri类型

我正在尝试仅使用电话号码选择联系人.我正在遵循此代码

static final int PICK_CONTACT_REQUEST = 1;  // The request code
...
private void pickContact() {
    Intent pickContactIntent = new Intent(Intent.ACTION_PICK, new Uri("content://contacts"));
    pickContactIntent.setType(Phone.CONTENT_TYPE); // Show user only contacts w/ phone numbers
    startActivityForResult(pickContactIntent, PICK_CONTACT_REQUEST);
}
Run Code Online (Sandbox Code Playgroud)

但不幸的是,它显示错误: Cannot instantiate the type Uri

实际上我有另一个正常工作的代码,但在选择电子邮件联系人时崩溃了.我只需要电话号码.

Intent intentContact = new Intent(Intent.ACTION_PICK,
                                ContactsContract.Contacts.CONTENT_URI);
intentContact.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                            startActivityForResult(intentContact, PICK_CONTACT);
Run Code Online (Sandbox Code Playgroud)

并且onReceive(),此方法被调用

public void getContactInfo(Intent intent) {

    ContentResolver cr = getContentResolver();
    cursor = cr.query(intent.getData(), null, null, null, null);

    while (cursor.moveToNext()) {
        String contactId = cursor.getString(cursor
                .getColumnIndex(ContactsContract.Contacts._ID));
        if …
Run Code Online (Sandbox Code Playgroud)

android android-contacts

7
推荐指数
2
解决办法
8565
查看次数

如何使用jquery创建一个简单的滑块(不使用插件)?

<script>
   var img = function(){
      $("#slider").animate({"left":"-=1775px"},10000,function(){
         $("#slider").animate({"left":"0px"},10000);
         img();
      });
   };
   img();
</script>
Run Code Online (Sandbox Code Playgroud)

我在jquery中使用了动画属性,但我希望循环连续显示三个图像.

javascript jquery animation loops image-gallery

6
推荐指数
1
解决办法
510
查看次数

如何解释像<T> T,<T,V> Query <T>,Class <T>这样的Java泛型?

有Java API:Morphia

Morphia类定义如下方法:

<T> T fromDBObject(Class<T> entityClass, com.mongodb.DBObject dbObject)
Run Code Online (Sandbox Code Playgroud)

有人能解释一下是什么<T> T and Class<T>意思吗?该方法是否在集合中返回类型为T的类?

Inteface DataStore上的另一个API:

<T,V> Query<T> find(Class<T> clazz, String property, V value) 

What <T,V> Query<T> means? Is the method returning an object of type Query that is then surrounded by collection `<T,V>` and `<T>`. This part is very confusing.
Run Code Online (Sandbox Code Playgroud)

如果(< > )涉及角括号,它是否正确,它总是意味着涉及Java集合?

对不起,我忘了在这个问题中标记一些内容作为代码,否则SO正在逃避改变问题的全部含义,因此@Vash和@fiver的2个答案都符合此编辑前的问题.

感谢您指出一些教程,但请提供您在Java泛型方面的专业知识的特定答案,以帮助我更好地理解教程.

java generics

5
推荐指数
2
解决办法
5911
查看次数

响应式布局教程?

是否有任何教程如何使响应式布局与类似?我在整个互联网上搜索,但找不到任何正常的教程,因为所有其他人都调整窗口大小,你可以通过iphone缩小/缩放.

html css responsive-design

5
推荐指数
1
解决办法
7545
查看次数

Jquery TimePicker:如何动态更改参数

我正在使用Jquery Timepicker.

我有两个输入字段 - 接受时间.

<input id="startTime"  size="30" type="text" />
<input id="endTime"  size="30" type="text" />
Run Code Online (Sandbox Code Playgroud)

我按照文档使用Jquery UI计时器

$('#startTime').timepicker({
    'minTime': '6:00am',
    'maxTime': '11:30pm',
    'onSelect': function() {
        //change the 'minTime parameter of #endTime <--- how do I do this ?
     }
});
$('#endTime').timepicker({
    'minTime': '2:00pm',
    'maxTime': '11:30pm',
    'showDuration': true
});
Run Code Online (Sandbox Code Playgroud)

我希望在选择第一个timePicker时,第二个'minTime'参数会被更改.基本上我正在尝试收集某些活动的开始时间和结束时间.我希望第二个输入框显示第一个输入字段(开始时间)本身的值的选项.

javascript jquery jquery-ui timepicker

5
推荐指数
2
解决办法
2万
查看次数

Accountmanager vs sharedpreference用于身份验证和服务器通信

在我的项目中,想要在服务器中读取和写入数据取决于身份验证密钥(用户).

到目前为止,我计划使用共享首选项来存储用户身份验证密钥以进一步与服务器通信.

后来我通过阅读本教程来了解"客户经理" :

我很少混淆使用客户经理或共享偏好.

我觉得很难理解账号管理员.

任何人都可以指导哪种方法适合我的项目.

任何客户经理教程.?

还有其他建议......?

提前致谢.

authentication android http sharedpreferences accountmanager

5
推荐指数
1
解决办法
1911
查看次数