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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:20:34+00:00 2026-05-16T21:20:34+00:00

I need to change some existing application to render different view depending on some

  • 0

I need to change some existing application to render different view depending on some request parameter. This application is using tiles. I never used tiles before, and need a bit of hint how to go about doing this.

Tiles are defined as follows:

<bean id="viewResolver"class="org.springframework.web.servlet.view.UrlBasedViewResolver"><property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" /></bean>

Let’s say I have welcome.tile, if there is some parameter in request eg. id=xyz and tile xyz.welcome.tile exists I would like to render this one, if it does not exist, I would like to render default. My controller returns welcome.tile as view, but I do not want to add code to controllers, I would like to do this as simply as possible.

My thought was to somehow intercept view resolution so it will check parameter on request and then verify if given tile with prefix from parameter exists, if it exists it would be used. But I am not sure where to start.

This is some old code, so unfortunately I cannot afford for to much changes.

Thanks in advance
Konrad

  • 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-05-16T21:20:35+00:00Added an answer on May 16, 2026 at 9:20 pm

    I think you can achieve that extending UrlBasedViewResolver with a version that reads the request parameter of your wish and build the view name with this information. Knowing that ViewResolver interface doesn’t provide an instance of HttpRequest, you can get it using the org.springframework.web.util.RequestHolder.currentRequest() static method.

    This way if you request is (for example) /mvc/dailyReport/criticalStuff,
    the viewName can be dailyReport.criticalStuff

    and if you request is /mvc/dailyReport/criticalStuff?printable,
    the viewName can be resolved as dailyReport.criticalStuff.printable where this is a printable version of the dailyReport.criticalStuff view.

    Hope it helps

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

Sidebar

Related Questions

I'm using itextsharp to generate the PDFs, but I need to change some text
I've got some UITableViewCells that need to change their height depending on the length
I have to make changes to an existing Application developed using MFC. this application
I need to change some text values inside an after effect project file that
I need to change some custom properties values in many files. Here is an
I need to know when a sharer has been authorized (to change some UI)
I have some images that need to change, based not only on hover, but
I need that on every page change or on some elemetents (a, input[button, submit],
I need a function to change the appearance of some elements in my HTML
How to change HTML background with JavaScript Function? I need some simple function to

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.