<loginSection
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
        <div class="frontPanel">
            <t:if t:test="userExists">
                                        <div class='welcomeMessage'>Welcome, 
${userExists.surname}!</div>
                                                <div class="button-box">
                                                        <t:actionlink 
t:id="logout">Log Out</t:actionlink>
                                                </div>
                                        </div>
                <t:parameter name="else">
                    <p>You are currently not logged in. Please log in or 
                    <t:actionlink t:id="register">register</t:actionlink>.
                    </p>
<form t:type="form" t:id="form">
        <t:errors/>
        <div class="input-box"> 
        <input t:type="TextField" t:id="userName" 
t:validate="required,minlength=8"
size="20"></input>
        <input t:type="PasswordField" t:id="userPassword"
t:validate="required,minlength=8" size="20"></input>
        <input type="submit" value="log in"></input>
        </div>
</form>
                </t:parameter>
            </t:if>
        </div>
</loginSection>


@Persist
    @Property
    private String userName;
    @Property
    private String userPassword;
    
    
    @Component
    private Form form;
    
    @Component(id = "userName")
    private TextField textField;
    
    @ApplicationState
    @Property
    private User user;

    @Property
    private boolean userExists;    

    @Inject
    private Session hibernate;    
    
   
    Object onSuccess()
    {
        List list = hibernate.createCriteria(User.class)
        .add(Restrictions.eq("name", userName))
        .add(Restrictions.eq("password", userPassword))
        .list();
        
        if(list.size() > 0)
            user = (User)list.get(0);
        else
            form.recordError(textField, "Invalid user name or password.");
        
        return null;
    }

This is the code I am dealing with, and I am switching from Tap 5.0 to Tap
5.2. 



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Linking-my-app-with-MYSQL-tp5666272p5667280.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to