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 7882651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:20:07+00:00 2026-06-03T04:20:07+00:00

I am developing an Wicket application. But my question is not really Wicket related.

  • 0

I am developing an Wicket application. But my question is not really Wicket related. In that app I have a horizontal menu. This menu is created by few links. On clicking the link you will be navigated to some page. Now based on the page you are currently viewing the css class attribute of the link of the menu will be changed to “selected”. This is the description of the problem.

Now I am solving this problem by using a integer value. The value is saved in the session and it is updated when any one link has been clicked. Based on that saved value, which link will be “selected”, will be determined at runtime.

I am implementing this in following way:

//On link click I set a number in session

public void onClick() {
    session.setValue(1);// or 2 or 3
}

When the menu is created I switch between the value and modify the css class, as follows:

switch(session.getValue){
    case 1: add css to home;
    case 2: add css to profile;
    // and so on.
}

I was wondering that is this the only right way to do it? Or there some other better techniques or design patterns exist which can help me to achieve this in better way?

  • 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-03T04:20:08+00:00Added an answer on June 3, 2026 at 4:20 am

    Store the menu items in an array (or an ArrayList):

    items[0] = home
    items[1] = profile
    

    And use the index of the array as menu identifier. When you receive the selected menu itentifier, retrieve the corresponding item with

    items[selectedItem]
    

    You could also use a Map if the identifiers are not numbers, or don’t go from 0 to N.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Developing a web application that I've registered with Twitter. In this app, I might
Developing a network application, I have a Connection class that manages sending and receiving
I know this question might be repeated many times but would really appreciate any
I'm developing a new application in Wicket and have run into a small problem.
I'm developing a Wicket 1.5 web application with many different components, and I'm interested
Currently developing an application using the newest version of symfony, obtained through PEAR. This
I am currently developing a wicket application where in development mode I am in
I'm developing an application for the Mac, and I'm wicked new at this -
developing iphone app, I have used a UIImageview and i have set an image
Developing for iPhone, I have a collection of points that I need to make

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.