[JBoss Seam] - Re: How to passing through request parameters to the next pa
by schmatz
"mars1412" wrote : why would you let the user login, before she even confirmed the e-mail address?
Because the progress is the following:
1. Register yourself (now you have an account with username and password)
2. Get the confirmation email
3. click on the link in the mail
4. Login
5. Your email address is confirmed.
anonymous wrote : in most system it works like that:* user registers
| | * email is sent to given address
| | * user clicks on the activation link (NO login required)
| | * account is activated
| | * from now on the user can login
|
This is not save! If you enter a wrong email address someone else gets your email, can log in, and sees your details.
anonymous wrote : if that's what you want, I could show U some of our code
No, that's not what I want. The problem is - like I posted - about how to propagate the req parameter to the over next step.
Thank you anyway,
Mark
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127010#4127010
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127010
18 years, 2 months
[JBoss Seam] - Need help to understand who to use the PAGE context
by fredatwork
Hello,
I trying to understand how to use the page context with seam and I need some expertise.
I built a very simple working sample with :
- two html pages (sample2.xhtml and sample2next.xthml)
- sample2.xhtml holds a button that throws an action Sample2Action.init.
- this action initiates a POJO object named Sample2Context that holds a counter. It is initiated to 1 by the action. This object is injected from and outjected to the PAGE seam context.
- pages.xml redirect to sample2next.html' upon completion of Sample2Action.init.
Here is the sample2.xhtml page (it renders a simple 'Start' button) :
<html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:s="http://jboss.com/products/seam/taglib">
| <head>
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" lang="fr"/>
| <<title>Sample2</title>
| </head>
| <body>
| <h:form>
|
| <h:messages/>
| <h:commandButton action="#{Sample2Action.init}" value="Start"></h:commandButton>
|
| </h:form>
|
| </body>
| </html>
Here is the sample2next.xhtml page that I get when you press on the start button in sample2.xhtml (it renders the counter and a 'Fresh' button which increments the counter) :
<html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:s="http://jboss.com/products/seam/taglib">
| <head>
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" lang="fr"/>
| <title>Sample2Next</title>
| </head>
| <body>
| <h:form>
|
| <h:messages/>
|
| <h:outputLabel value="Counter :"/>
| <h:outputText value="#{Sample2Context.counter}"/>
| <h:commandButton value="Refresh" action="#{Sample2Action.refresh}"/>
|
| </h:form>
|
| </body>
| </html>
Here is the POJO I wanna store in the page :
@Name("Sample2Context")
| public class Sample2Context implements Serializable {
|
| private int counter;
|
| /**
| * @return the counter
| */
| public int getCounter() {
| return counter;
| }
|
| /**
| * @param counter the counter to set
| */
| public void setCounter(int counter) {
| this.counter = counter;
| }
|
| /**
| * Increment counter by 1
| */
| public void increment() {
| counter++;
| }
|
| /**
| * @see java.lang.Object#toString()
| */
| @Override
| public String toString() {
| return "[Context = " + counter + "]";
| }
|
| }
Here is the action bean :
@Stateless(name="Sample2Action")
| @Name("Sample2Action")
| public class Sample2Bean implements Sample2Local {
|
| // Page context object
| @In(value="Sample2Context", create=true, required=false)
| @Out(value="Sample2Context", scope=ScopeType.PAGE, required=true)
| private Sample2Context context;
|
| // Messages
| @In
| private FacesMessages facesMessages;
|
| /**
| * @see sample2.Sample2Local#init()
| */
| public void init() {
| context.increment();
| facesMessages.add(FacesMessage.SEVERITY_INFO, "Initiated page context " + context);
| System.out.println("Initiated page context " + context);
| }
|
| /**
| * @see sample2.Sample2Local#refresh()
| */
| public void refresh() {
|
| Object object = Contexts.lookupInStatefulContexts("Sample2Context");
| System.out.println("Context object : " + object);
| Object pageObject = Contexts.getPageContext().get("Sample2Context");
| System.out.println("Page context object : " + pageObject);
|
| System.out.println("In refresh with : " + context);
| context.increment();
| System.out.println("Incremented page context " + context);
| facesMessages.add(FacesMessage.SEVERITY_INFO, "Incremented page context " + context);
| }
|
| /**
| * @see sample2.Sample2Local#remove()
| */
| @Remove
| public void remove() {
| }
|
| }
Now here is my problem and question :
Once the start button is pressed, sample2next.xhtml renders a counter at 0. However, the Sample2Action.init action initiated this counter to 1. Everything happens as the completion of Sample2Action.init does not outject the POJO Sample2Context to the PAGE context, and the action Sample2Action.refresh retrieves a newly created object.
Why is that ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127008#4127008
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127008
18 years, 2 months