我需要访问组件标记属性,如:
<h:inputtext id="input_age"/>
Run Code Online (Sandbox Code Playgroud)
来自支持bean,如:
public class UserInfo {
String inputAgeId;
public UserInfo() {
inputAgeId = { /*code to access component tag attribute*/ }.getStyleClass();
}
}
Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用JSF 2.0并面临一个热烈欢迎的问题.我使用了模板和模板客户端,并将模板文件应用于CSS(应该提到我不是css专家)样式.当我运行应用程序时,一切都很好但是当页面被提交或重新加载或导航到另一个页面时,按下页面上的任何链接或按钮都不会应用样式,只显示纯HTML.我该如何克服这个问题?
模板文件:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="resources/css/default.css" rel="stylesheet" type="text/css" />
<link href="resources/css/cssLayout.css" rel="stylesheet" type="text/css" />
<title>
<ui:insert name="title">Facelets Template</ui:insert>
</title>
</h:head>
<h:body>
<div id="top" class="top">
<ui:insert name="top">Top</ui:insert>
</div>
<div id="left">
<ui:insert name="left">left</ui:insert>
</div>
<div id="content" class="left_content">
<ui:insert name="content">Content</ui:insert>
</div>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
客户端模板:
"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">
<body>
<ui:composition template="./../templates/TutorialsStructure.xhtml">
<ui:define name="title">
Start
</ui:define>
<ui:define name="top">
<h:graphicImage value="Image/butterfly.gif" style="alignment-adjust: central"/>
</ui:define>
<ui:define name="left">
</ui:define>
<ui:define name="content">
<h:form>
<div>
<p>
<div>
<h:outputLabel id="outputlabel_userName" …Run Code Online (Sandbox Code Playgroud)