是否可以在我的.xhtml文件中嵌入注释,这些注释只显示在源代码而不是渲染结果中?我想在文件中包含author,date,...但它们不应该在生成的输出中对最终用户可见.如果我使用标准评论标签 <!-- -->,浏览器会显示它们.
我想对齐4个div框,以便它们像这样处于2x2布局中
1 2
3 4
Run Code Online (Sandbox Code Playgroud)
我的代码看起来像这样
<div style="width:300px;height:300px;float:left;"> DIV 1 </div>
<div style="width:300px;height:300px;float:left;"> DIV 2 </div>
<div style="width:300px;height:300px;clear:left;"> DIV 3 </div>
<div style="width:300px;height:300px;float:left;"> DIV 4 </div>
Run Code Online (Sandbox Code Playgroud)
它产生以下布局:
1 2
3
4
Run Code Online (Sandbox Code Playgroud)
有人可以帮我弄这个吗?
我正在使用左浮动DIV来模拟两列布局(每个div包含用于编辑不同数据的文本字段,如名称,爱好,......).所以看起来应该是这样的
1 2
3 4
5 6
Run Code Online (Sandbox Code Playgroud)
现在我的div-box并不总是相同,因为有些DIV比其他DIV有更多的元素.现在我的布局看起来像这样
1 2
2
3 4
5 6
Run Code Online (Sandbox Code Playgroud)
如果您缩放,则还可以看到此示例的效果,以便仅显示四个或三个列.例如,如果连续显示4列,则Float 1和Float 6之间有很多空间.这在我的UI上看起来不太好.我想要的是Float 6跟Float 1之间没有空格(除了我定义的边距)
编辑:我的DIV基本上只包含一个浮点数:左边和宽度:40%,这样两个适合屏幕
这是一个截图显示更多 
我想将我的JSF 2.0 xhtml文件放在WEB-INF\jsf下.我如何访问它们呢?我知道WEB-INF内部的任何内容都没有暴露在外面,所以我需要一个控制器来将我重定向到相应的JSP,对吧?(这也是模型2模式iirc).
我可以使用web.xml/faces-config.xml中的参数来实现这一点吗?我认为FacesServlet是我的webapp的控制器所以它应该用于此目的?
另一个理解模型2模式的问题.是否每个操作都必须首先进入servlet,然后处理下一个可能的步骤?因此,<a href="anotherPage.html" />在这种模式中禁止使用简单,因为它不会进入控制servlet?
我现在正在学习/使用JSF 2.0(Sun Mojarra),我希望在我的webapp中有一个选项卡式窗格(单个选项卡可以命名为General,Detail1,Detail2,...).
我该如何实现这一目标?到目前为止,我还没有找到任何纪录片:(
我想使用faces-config.xml(JSF 2.0)的导航规则功能,但我遇到了一些问题.我有三个文件(index.xhtml,index2.html,index3.xhtml),它们看起来像这样:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<f:loadBundle basename="resources.application" var="bundle"/>
<head>
<title><h:outputText value="#{bundle['welcome.title']}" /></title>
</head>
<body>
<h3>1</h3>
<h:form>
<h:commandButton action="next2" id="nextpagelink" value="Next Link">Next</h:commandButton>
</h:form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
(index.xhtml,其他看起来与不同的动作名和其他h3-field相似)
我的faces-config.xml包含以下与navigation-rules相关的条目:
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<application>
<message-bundle>resources.application</message-bundle>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
<navigation-rule>
<display-name>index.xhtml</display-name>
<from-view-id>/index.xhtml</from-view-id>
<navigation-case>
<from-outcome>next2</from-outcome>
<to-view-id>/index2.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>index2.xhtml</display-name>
<from-view-id>/index2.xhtml</from-view-id>
<navigation-case>
<from-outcome>next3</from-outcome>
<to-view-id>/index3.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>index3.xhtml</display-name>
<from-view-id>/index3.xhtml</from-view-id>
<navigation-case>
<from-outcome>next1</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
Run Code Online (Sandbox Code Playgroud)
web.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" …Run Code Online (Sandbox Code Playgroud) 我的页面中有以下代码:
<div id="data_body_container" style="overflow: auto; width: 880px; height: 500px;">
...
</div>
Run Code Online (Sandbox Code Playgroud)
然后在网站下面:
<script type="text/javascript">
$(window).resize(function() {
var windowWidth = $(window).width() - 50;
var windowHeight = $(window).height() - 50;
$('#data_body_container').css({'width': windowWidth+'px', 'height': windowHeight+'px','overflow:auto'});
alert('Resize to '+ windowWidth + 'x'+windowHeight );
})
</script>
Run Code Online (Sandbox Code Playgroud)
但我的Firefox错误控制台说"无效对象初始化程序"并指向此行,如果单击该条目.错误在哪里?对我来说似乎是对的