简体   繁体   中英

How to pass arguments to a java api from html code using play framework?

I want to pass arguments from HTML view to Java API in play framework. I've written the following code. What changes should be done to successfully pass the arguments from Html view to API in java controller?.

When i tried passing it as @w.username and @w.email or by keeping '@w.username' or @w.username i've got error.

@import model.User 
@(users: List[User]) 
<html>
    <body>
        <h1>Users</h1>

        <table>
            <thead>
                    <th>User Name</th>
                    <th>Email</th>
                    <th>Status</th>
            </thead>
        <tbody>
            @for(w <- users) {
            <tr>
                <td>@w.username</td>
                <td>@w.email</td>
                <td>@w.status</td>
                <td>            
                    <form action="@routes.UserController.getUser(w.username,w.email)">
                        <input type = "submit" value="View Deatils">
                    </form>
                </td>
            </tr>
            }
        </tbody>
    </table>
</body>
</html>

它必须像您写的那样工作:

@routes.UserController.getUser(w.username,w.email)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM