java - Passing a database value from a jsp to a controller in Spring 4 -


i have user page viewing specific users details. want able add user "friend". sort of understand technical details need add user friend, unsure how pass jsp value controller.

this friend entity looks like:

@entity @table(name = "friend") public class friend { @id @generatedvalue private int id;  @column(name = "friend_username") private string friend_username;  @manytoone(optional=false) @joincolumn(name = "friend_username", referencedcolumnname="username", insertable=false, updatable=false) private user user;  public friend() {     this.user = new user(); }  public friend(int id, string friend_username, user user) {     super();     this.id = id;     this.friend_username = friend_username;     this.user = user; } 

in jsp file viewing user's details this:

<tr>     <td><b>username:</b></td>     <td>${user.username}</td> </tr> <tr>     <td><b>email:</b></td>     <td>${user.email} <tr>     <td><b>name:</b></td>     <td>${user.name} 

how pass user.username value controller? know i'll able current username using principal. if or has examples appreciate it.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -