1.9.0 i如何在java中执行此键 - 下一次触发器验证
我喜欢这样的东西,但是在java adf中
protected PreparedStatement createStatementADF(String query)
{
PreparedStatement statement=null;
try {
/*create transaction for current statemtnt*/
DBTransaction dbTransaction = (DBTransaction) this.getTransaction();
statement= dbTransaction.createPreparedStatement(query, 0);
} catch (SQLException e)
{
throw new JboException(e);
}
return statement;
}
/*Executes single query*/
protected ResultSet executeQueryADF (String query, Object[] bindVars)
{
PreparedStatement statement=null;
ResultSet ret=null;
try {
/*create transaction for current statemtnt and resuse it*/
statement=createStatementADF(query);
if ((bindVars != null)&&(statement!=null)) {
// 2. Loop over values for the bind variables passed in, if any
for (int z = 0; z < bindVars.length; z++) {
// 3. Set the value of each bind variable in the statement
statement.setObject(z + 1, bindVars[z]);
}
}
// 4. Execute the statement
ret=statement.executeQuery();
} catch (SQLException e) {
throw new JboException(e);
} finally {
if (statement != null) {
try {
// 5. Close the statement
statement.close();
} catch (SQLException e) {
}
}
}
return ret;
}
public void getUsrStatus()
{
ResultSet rs = null;
Object[] bindVars = new Object[]{"TestUser"};
try {
rs = executeQueryADF("SELECT account_status FROM dba_users WHERE username = ?", bindVars );
while(rs.next())
{
//..... process data
}
} catch (Exception e)
{
}
}
我可以使用valueChangeListener,我要验证密码并调用验证密码的过程,我必须根据enterd useid进行验证
public void labelListener(ValueChangeEvent valueChangeEvent)
{ UIComponent c = valueChangeEvent.getComponent();
//This step actually invokes Update Model phase for this
//component
c.processUpdates(FacesContext.getCurrentInstance());
//Jump to the Render Response phase in order to avoid
//the validation
FacesContext.getCurrentInstance().renderResponse();
}
答案 0 :(得分:0)
创建使用以下查询的视图对象(VO):
get_xpath
其中p_username是绑定变量并将VO添加到应用程序模块(AM)
根据您的使用情况,您应该在AM中公开该方法(可能会返回一个布尔值或字符串)。将该方法添加到绑定中,并在用户执行某些操作(单击按钮)时执行该方法。使用您的方法的结果,您可以执行一些导航或显示错误。 (抛出异常也可以选择)。
修改强> 您可以将PL / SQL移动到函数/过程中并从AM执行它。非常好的前:http://www.baigzeeshan.com/2010/05/calling-plsql-procedure-and-function-in.html