当我在Netbeans中编译JSF页面时,我对JSF页面和faces-config.xml文件中的注释会发生什么感兴趣?它们是保留还是由编译器删除.如果它们被保存,我可以以某种方式删除它们吗?我知道编译器会删除java bean代码中的注释,但我不确定JSF页面.
我想优化此SQL查询的性能.如果我使用一百万个密钥填充此哈希表,则查询将花费大约一分钟.我如何优化这种Java方法以加快执行速度?
private HashMap<String, Boolean> selectedIds = new HashMap<>();
public void deleteSelectedIDs() throws SQLException {
if (ds == null) {
throw new SQLException();
}
Connection conn = ds.getConnection();
if (conn == null) {
throw new SQLException();
}
PreparedStatement ps = null;
ResultSet resultSet = null;
try {
conn.setAutoCommit(false);
boolean committed = false;
try {
String sqlDeleteQuery = "DELETE FROM ACTIVESESSIONSLOG WHERE ASESSIONID = ?";
Set<String> keySet = selectedIds.keySet();
String[] keys = new String[]{};
keys = selectedIds.keySet().toArray(keys);
ps = conn.prepareStatement(sqlDeleteQuery);
for (int …
Run Code Online (Sandbox Code Playgroud) 我将此代码剪断,用于输入验证:
public void validaUserID(FacesContext context, UIComponent component, Object value) throws ValidatorException, SQLException {
int findAccount = 0;
if (ds == null) {
throw new SQLException("Can't get data source");
}
// Initialize a connection to Oracle
Connection conn = ds.getConnection();
if (conn == null) {
throw new SQLException("Can't get database connection");
}
// Convert Object into String
int findValue = Integer.parseInt(value.toString());
// With SQL statement get all settings and values
PreparedStatement ps = conn.prepareStatement("SELECT * from USERS where USERID = ?"); …
Run Code Online (Sandbox Code Playgroud) 我有一个JSF应用程序,它有几个JSF页面.当我点击页面加载一个新页面时,我等待1-2秒加载新页面,我看到白色屏幕.我怎么能解决这个缓慢加载?例如,我可以在加载新页面时在屏幕中央显示"正在加载..."并刷新屏幕而不显示白色显示吗?什么是最佳做法?
我想列出班上所有的颜色Color.<color>
。
在哪里可以找到列出的所有颜色?
当我尝试在JSF页面中显示Java List<String>
国家时,我在JSF页面中遇到了非常奇怪的问题.这是代码:
private List<String> listCountries;
// Get the list with Countries
public List<String> getlistCountries() {
// Generate List of Countries
initlistCountries();
return listCountries;
}
public void initlistCountries(){
listCountries.add("Afghanistan");
listCountries.add("Albania");
listCountries.add("Algeria");
listCountries.add("Andorra");
listCountries.add("Angola");
......
}
Run Code Online (Sandbox Code Playgroud)
这段代码是否正确?我不能使用,@PostConstruct
因为我已经使用它了.
加载JSF页面时出现错误:
java.lang.NullPointerException
at com.DX_57.AC_57.AddAccount.initlistCountries(AddAccount.java:344)
at com.DX_57.AC_57.AddAccount.getlistCountries(AddAccount.java:339)
Run Code Online (Sandbox Code Playgroud) 我有一个JSF表:
正如您所看到的,列的名称是基本的html链接.有没有办法删除名称的下划线?还要改变名字的颜色?感谢您的帮助.
<div id="settingsHashMap" style="width:1050px; height:400px; position:absolute; background-color:r; top:20px; left:1px">
<h:form id="form" >
<p:growl id="growl" showDetail="true" sticky="true" />
<!-- The sortable data table -->
<h:dataTable onmouseover="addOnclickToDatatableRows();" id="dataTable" value="#{AccountsController.dataList}" binding="#{table}" var="item">
<!-- Check box -->
<h:column>
<f:facet name="header">
<h:selectBooleanCheckbox value="#{AccountsController.mainSelectAll}" class="checkall" >
<f:ajax listener="#{AccountsController.selectAll}" render="@form" />
</h:selectBooleanCheckbox>
</f:facet>
<h:selectBooleanCheckbox onclick="highlight(this)" value="#{AccountsController.selectedIds[item.userid]}" >
<!-- if the user deselects one row deselect the main checkbox -->
<f:ajax listener="#{AccountsController.deselectMain}" render="@form" />
</h:selectBooleanCheckbox>
<!-- Click on table code -->
<h:outputLink id="lnkHidden" value="AccountProfile.jsf" style="text-decoration:none; color:white;">
<f:param …
Run Code Online (Sandbox Code Playgroud) 我在JavaFX中工作,我有这个ObservableList<Tab>
。您能告诉我如何循环获取列表内容吗?也许是这样的:
ObservableList<Tab>
for (....){
tabPane.getTabs().add(i);
)
Run Code Online (Sandbox Code Playgroud)