You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by selenity <ca...@gmail.com> on 2008/09/11 07:09:57 UTC

Velocity newbie

I am a newbie in apache velocity. Can someone post the code on how that
velocity gets data and post it? a sample is the login page. I am using
netbeans on creating velocity. Please help me.

<html>
    <head>
        <title>Sign in, Please!</title>
        <base href="$link.baseRef">
    </head>

    <body>

        #errorMarkup()

        <h3>Sign in, Please! (Velocity Version)</h3>

        <form method="POST" action="$link.action.login">

        <table border="0">
            <tr>
                <th align="right">
                    Username:
                </th>
                <td align="left">
                    <input type="text" name="username"
value="$!logonForm.username">
                </td>
            </tr>

            <tr>
                <th align="right">
                    Password:
                </th>
                <td align="left">
                    <input type="password" name="password"
value="$!logonForm.password">
                </td>
            </tr>

            <tr>
                <td align="right">
                    <input type="submit" value="Submit" name="submit">
                </td>
                <td align="left">
                    <input type="reset" value="Reset" name="reset">
                </td>
            </tr>

        </table>

        </form>

        View Template<br>

    </body>

</html>


this is the code i saw. But how can i post the username and password? do i
need to use servlet? how?
-- 
View this message in context: http://www.nabble.com/Velocity-newbie-tp19427967p19427967.html
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Velocity newbie

Posted by Nathan Bubna <nb...@gmail.com>.
Read this (especially "The Context" section):
http://velocity.apache.org/engine/releases/velocity-1.5/developer-guide.html

The example login page uses Velocity with Struts 1.x.  The integration
between the two is provided by VelocityTools.  Specifically, the
VelocityViewServlet renders templates and automatically injects the
VelocityStruts tools (e.g. $link) into the context. The context
created by the VelocityViewServlet also provides transparent access to
request/session/servletContext attributes (e.g. $logonForm ==
request.getAttribute("logonForm")).

On Wed, Sep 10, 2008 at 10:09 PM, selenity <ca...@gmail.com> wrote:
>
> I am a newbie in apache velocity. Can someone post the code on how that
> velocity gets data and post it? a sample is the login page. I am using
> netbeans on creating velocity. Please help me.
>
> <html>
>    <head>
>        <title>Sign in, Please!</title>
>        <base href="$link.baseRef">
>    </head>
>
>    <body>
>
>        #errorMarkup()
>
>        <h3>Sign in, Please! (Velocity Version)</h3>
>
>        <form method="POST" action="$link.action.login">
>
>        <table border="0">
>            <tr>
>                <th align="right">
>                    Username:
>                </th>
>                <td align="left">
>                    <input type="text" name="username"
> value="$!logonForm.username">
>                </td>
>            </tr>
>
>            <tr>
>                <th align="right">
>                    Password:
>                </th>
>                <td align="left">
>                    <input type="password" name="password"
> value="$!logonForm.password">
>                </td>
>            </tr>
>
>            <tr>
>                <td align="right">
>                    <input type="submit" value="Submit" name="submit">
>                </td>
>                <td align="left">
>                    <input type="reset" value="Reset" name="reset">
>                </td>
>            </tr>
>
>        </table>
>
>        </form>
>
>        View Template<br>
>
>    </body>
>
> </html>
>
>
> this is the code i saw. But how can i post the username and password? do i
> need to use servlet? how?
> --
> View this message in context: http://www.nabble.com/Velocity-newbie-tp19427967p19427967.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org