- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我创建了一个登录页面用户正确输入用户名和密码后,他将被引导到另一个页面(主页)
@ManagedBean
public class Superviseur {
private String login; have get and set
private String password;// have get and set
public void checkLogin() {
try {
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/supervision";
Connection con = DriverManager.getConnection(url,"root", "");
Statement stm = (Statement) con.createStatement();
String rq = "select * from superviseur ";
ResultSet res=stm.executeQuery(rq);
while (res.next()) {
Superviseur sup=new Superviseur();
sup.setPassword(res.getString("password"));
sup.setLogin(res.getString("login"));
if(sup.getLogin().equals(login)&&sup.getPassword().equals(password)) {
System.out.println( "WELCOM");
} else {
System.out.println("ERROR login/password ");
}
} catch (Exception e) {
System.out.println("ERROR :" + e.getMessage());
}
}
}
xhtml页面包含两个输入和命令按钮
<p:commandButton value="login" action="#{superviseurBean.checkLogin()}" />
它在控制台中向我显示欢迎,如果正确(通过/登录),否则错误
但如果密码和登录正确,我必须转到另一个页面
最佳答案
您可以像这样从 bean 更改当前页面:
FacesContext.getCurrentInstance().getExternalContext().redirect("/accueil.jsf");
对于显示消息,您可以使用:
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN,"Sample warn message", "Watch out for PrimeFaces!"));
并添加到您的 XHTML 页面中:
<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
关于java - 素面 : submit after succes action,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23689511/
我不是 Ruby 程序员,但在尝试回答这个问题时python's counterpart for Ruby String#succ? ,我试图了解 Ruby 的实现是如何工作的。然后我引用了文档suc
这个练习我有一些问题 COTO(0,y)=y COTO(x+1,y)=SUCC(SUCC(COTO(x, SUCC(y))) COTO (1,3); COTO (2,2); COTO (3,44) -
有人可以向我解释为什么这个序言查询会这样工作。定义是: add(0,Y,Y). add(succ(X),Y,succ(Z)):- add(X,Y,Z). 鉴于这种: ?- add(succ(succ
我经常使用SWI-Prolog 的列表(谓词)功能。看看它如何实现它的一些谓词。我想确切地了解它对 succ/2 的作用,因为我在 SWI-Prolog 上使用它,但我也需要它与 Sicstus 一起
我创建了一个登录页面用户正确输入用户名和密码后,他将被引导到另一个页面(主页) @ManagedBean public class Superviseur { private String l
得知 Haskell 将数字上的 succ 函数定义为加一时,我有点惊讶: succ :: a -> a The successor of a value. For numeric types, su
如何仅使用 succ 和 pred 制作乘法函数? 我已有的添加功能: plus :: Integer -> Integer -> Integer plus a b | a == 0 = b
我在尝试编写 HMAC_MD5 代码时遇到了一些问题。 我在 STM32F4 微处理器上用 C 语言工作。 这是我的(更新的)代码: RCC_AHB2PeriphClockCmd(RCC_AHB2Pe
我想知道在 python 中是否有一个函数(或方法)像在 Ruby 的 String#succ 中那样递增字符串方法,即: ~ $ irb --simple-prompt >> '2'.succ =>
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 6 年前。 Improv
C# 有等价于 Ruby's string successor method 的东西吗? ? 最佳答案 不,没有内置的等效项,尽管您当然可以创建自己的等效项。我建议这样的框架: char[] arra
我在 a repo 中有以下代码: impl IdAllocator where Id : Clone + Default + Add, { pub fn new() -> IdAllocat
Pascal 是我的学习语言,我很好奇 C# 是否也有函数 pred 和 succ。 这是我在 Pascal 中完成的,我想在 C# 中尝试 // in Pascal: pred(3) = 2 suc
Ruby 中的 Fixnum 方法 .next 和 .succ 有什么区别?看起来它的工作原理是一样的: 1.next => 2 1.succ => 2 如果有什么不同,为什么有两种方法做同样
是否有可能在一次递归过程中,不使用除 is_zero、succ 和 pred (n', n'+d') redBad n 0 delta = case redBad n delta 0 of (
我是 Haskell 的新手,正在研究 Collatz 猜想问题。所需的输出是从给定整数到 1 所需的步数。这是我第一次不得不使用 Maybe 类型,这可能会造成我的困惑。 我有这个可行的解决方案
这似乎适用于 GHCi 和 GHC。我将首先展示一个使用 GHCi 的示例。 给定的 i 类型已推断如下: Prelude> i = 1 Prelude> :t i i :: Num p => p 鉴
我想请求您的帮助。我想创建简单的投票系统。我不知何故成功了。我有一个简单的“UP”按钮,该按钮可以发布表单,并使用简单的 +1 整数作为帖子的得分值。现在有很多问题,但我稍后会和他们一起解决。 现在我
data Term = Var Integer | Apply Term Term | Lambda Term deriving (Eq,
要求 GHC 打印“one”和“succ zero”(编码数字的 lambda 演算方式)的类型,我得到了两种不同的类型!他们不应该是一样的吗?你能告诉我如何手动推导它的类型吗? zero = \ f
我是一名优秀的程序员,十分优秀!