Playframework – play! How to retrieve the field values ​​in the template tag that are individually passed by the entity and field name as the parameter?

I want to create a tag, such as:

#{some_tag entity:user, field:'name'}< /pre> 

and hope it uses the following expression to generate some output with usernames:

${_entity._field}

I Know it doesn't work, but that's why I am asking here.
Is there an easy way to get the field value using the field name passed as a parameter to the template tag?

I don’t know a simple answer, but it is possible. You can create quick tags, And use reflection to get the fields you are after.
You can get more information about fast tags here – Can someone explain how to use FastTags

However, send specific fields Would it be easier to get to your mark?

I want to create a tag, such as:

#{some_tag entity:user, field:' name'}

and hope it uses the following expression to generate some output with usernames:

${_entity._field}

I know it doesn’t work, but that’s why I’m asking here.
Is there an easy way to get the field value using the field name passed as a parameter to the template tag?

I don’t know a simple answer, but it is possible. You can create a quick tag and use reflection to get the fields you are after. < br>You can get more information about fast tags here – Can someone explain how to use FastTags

But will it be easier to send specific fields to your tags?

Leave a Comment

Your email address will not be published.