Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8218949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:58:50+00:00 2026-06-07T12:58:50+00:00

I am working on a play 2.0 framework application in java. I want to

  • 0

I am working on a play 2.0 framework application in java. I want to display the default profile pic depending on their gender and age, like man or woman or boy or girl pics as a default pic (like facebook etc.).

How would I go about generating a different URL for the image, based on the attributes of the user?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:58:53+00:00Added an answer on June 7, 2026 at 12:58 pm

    in your User model, have a method

    public String getProfilePictureURL() {
        if ("male".equals(gender) && age >= 18) return "url for man image";
        else if ("male".equals(gender) && age < 18) return "url for boy image";    
        else if ("female".equals(gender) && age >= 18) return "url for woman image";
        else if ("female".equals(gender) && age > 18) return "url for girl image";
        else return null;
    }
    

    I am assuming you have gender and age attributes in your User model class. Make sure you put in the correct

    Then, in your view, you can just say

    <img src="@user.getProfilePictureURL()" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been working on a Play framework social networking application, and I've come across
hi there i am woring with java play framework and i want to implement
I'm working on a 1.2 Play! framework application, and I have a problem when
Hi i am working on a play 2.0 application . I want to enable
I am working on Play Framework 2.0 and it uses Jerkson to parse JSON
i'me working on a web server using play framework 2.0, where the login is
LoadHtmlString UIWebView is not working. I want to play embeded you tube video. I
I have a Play Framework application that sends emails using SMTP server. Now I
I've got a Play (1.2.4) application that's working fine on my Windows 7 64bit
I'm working on a C# desktop 2D game, and want to play audio. 1)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.