I have a question concerning Omega and example login xhtml page - JavaBean interaction. I have asked in Omega subforum but Aragorn told me to ask here.
I don't understand how login.xhtml can interact with its related bean "UserLoginView.java" [1]. I don't see any reference to UserLoginView in login.xhtml or other files
[1]: complete path Omega-1.14/tag/src/main/java/org/primefaces/omega/view/overlay
Thank you
login xhtml page - JavaBean interaction
Can you provide a little more info? The link you provided above is not a real link I need to be able to look at something to help you. maybe post the login.xhtml here.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
I do not understand where UserLoginView.java is called in login.xhtml file. I mean, login.xhtml obviously uses the code of UserLoginView.java, but I cannot see in login.xhtml any reference to UserLoginView.java
omega directory tree
login.xhtml
UserLoginView.java
Thank you
omega directory tree
login.xhtml
Code: Select all
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<f:facet name="first">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
</f:facet>
<title>PrimeFaces Omega</title>
</h:head>
<h:body styleClass="login-body">
<div id="login-wrapper">
<p:graphicImage name="images/login-logo.png" library="omega-layout" />
<div id="login-container">
<span class="title">Omega</span>
<div class="ui-g ui-fluid">
<div class="ui-g-12">
<p:inputText placeholder="Username" />
</div>
<div class="ui-g-12">
<p:password placeholder="Password" feedback="false"/>
</div>
<div class="ui-g-12 ui-md-6">
<span class="remember-me">Remember Me</span>
<p:selectBooleanCheckbox />
</div>
<div class="ui-g-12 ui-md-6">
<p:link>Forgot Password</p:link>
</div>
<div class="ui-g-12">
<p:button outcome="dashboard" value="Login" icon="fa fa-check" />
</div>
</div>
</div>
<div class="login-footer">PrimeFaces Omega</div>
</div>
<h:outputStylesheet name="css/layout.css" library="omega-layout" />
</h:body>
</html>
Code: Select all
/*
* Copyright 2009-2014 PrimeTek.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.primefaces.omega.view.overlay;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.primefaces.context.RequestContext;
@ManagedBean
public class UserLoginView {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public void login(ActionEvent event) {
RequestContext context = RequestContext.getCurrentInstance();
FacesMessage message = null;
boolean loggedIn = false;
if(username != null && username.equals("admin") && password != null && password.equals("admin")) {
loggedIn = true;
message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Welcome", username);
} else {
loggedIn = false;
message = new FacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "Invalid credentials");
}
FacesContext.getCurrentInstance().addMessage(null, message);
context.addCallbackParam("loggedIn", loggedIn);
}
}
Hmmm you are right i have no idea how this would work.
A) The code is not wrapped in <h:form>
B) It never references the bean to bind the values to it.
A) The code is not wrapped in <h:form>
B) It never references the bean to bind the values to it.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
-
- PrimeFaces Core Developer
- Posts: 3979
- Joined: 03 Dec 2010, 14:11
- Location: Bavaria, DE
- Contact:
Make a post in the Omega forum that the example isn't correct and should be adjusted.
Fixing it by yourself for now should be straight forward if you have a little bit JSF experience.
Fixing it by yourself for now should be straight forward if you have a little bit JSF experience.
Thomas Andraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
Well I have already did that some time ago and Aragorn told me for unknown reasons to ask here.tandraschko wrote: ↑02 Jul 2018, 15:58Make a post in the Omega forum that the example isn't correct and should be adjusted.
Fixing it by yourself for now should be straight forward if you have a little bit JSF experience.
Read from message viewtopic.php?p=162677#p162677
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Omega login.xhtml does not use UserLoginView.java. We've added some bean files from PrimeFaces showcase into Omega. Thus, users can easily test the demo files of showcase.
Please see this demo;
https://www.primefaces.org/showcase/ui/ ... Demo.xhtml
It uses UserLoginView.java. For Omega login.xhtml, you need to write bean.java yourself.
Best Regards,
Please see this demo;
https://www.primefaces.org/showcase/ui/ ... Demo.xhtml
It uses UserLoginView.java. For Omega login.xhtml, you need to write bean.java yourself.
Best Regards,
Github Profile: https://github.com/mertsincan
While looking for "login" in primefaces forum, I saw another topic containing the message
I have to create a login web page that leads to a CRUD webpage. The project will never go into production because it's a kind of homework, so I don't need a real security later.
I was thinking about creating a Java Bean for the Omega example login xhtml page. The only remaining thing to handle would be the attempt of unauthenticated user to open the CRUD webpage.
How do you think I could proceed? I don't think I have to study JS and Angular for my very basic needs.
Thank you!
merve7 wrote: ↑29 Jun 2018, 09:13You can review for example this link ;http://jasonwatmore.com/post/2016/09/29 ... e-tutorial
I have to create a login web page that leads to a CRUD webpage. The project will never go into production because it's a kind of homework, so I don't need a real security later.
I was thinking about creating a Java Bean for the Omega example login xhtml page. The only remaining thing to handle would be the attempt of unauthenticated user to open the CRUD webpage.
How do you think I could proceed? I don't think I have to study JS and Angular for my very basic needs.
Thank you!
-
- Information
-
Who is online
Users browsing this forum: No registered users and 42 guests