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

  • Home
  • SEARCH
  • 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 8352803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:04:34+00:00 2026-06-09T09:04:34+00:00

I need to get help with a problem. I have an application, which displays

  • 0

I need to get help with a problem.
I have an application, which displays data from database.

In database I am using one column for identifying an object with changes in time (version of object).
I mean that rows have different IDs, but same OBJECT_ID.
They are also differentiated by validity DATE columns (VALID_FROM and VALID_TO), so i can find the proper version of object in selected time.

When page is shown to user, he sets DATE for displaying data.
There is form on page, with Select Boxes (their items are object from database).
I need to show only items, that satisfy the validity condition.
Everything is OK before form handling.

I am using custom converter, that converts String value (ID of row in database table) to Object of my model, but I need two values for row to find. (ID and DATE from user form).

Converter method getAsObject gets only one VALUE parameter (ID from Select Box).
How to get second parametr to work?
Can i find it from Bean or from JSF input object?

If there is some way that includes using <f:attribute/>, is there way to set <f:attribute/> by Java code in Bean? (Form is generated by bean method).

I am sorry for my English, i try my best :o)

P.S.: Date parameter is important in sqlMap because of JOIN used. I search by ID, but other tables are joined by OBJECT_ID (version) => and i need to get one row only

Thanks for answers and have a nice day

Worsik

Edit:
Select Boxes are generated by this code:

                uiInput = new HtmlSelectOneMenu();
                UISelectItems items = new UISelectItems();
                items.setValueExpression("value", createValueExpression(
                        "#{myBean.referencedList." + item.getName() + "}",
                            List.class));
                uiInput.getChildren().add(items);

Converter method looks like this:

public Object getAsObject(FacesContext context, UIComponent component, String value) 
{
    if (value.equals("")) {
        return null;
    }
    Class entityType = component.getValueExpression("value").getType(
            FacesContext.getCurrentInstance().getELContext());
    // TODO: need to get date value from form
            Date day = new Date();
    return myService(context).findEntityById(entityType, Long.valueOf(value), day);
}

entityType is Class of model for object from database

myService calls Dao object and sqlMap is called

select * from object_table as t1 
JOIN other_table as t2 ON t1.object_fk = t2.object_id // (or version_id) 
where t1.id = #id:INTEGER#
and t2.valid_from <= #day:DATE#
and t2.valid_to >= #day:DATE#
  • 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-09T09:04:35+00:00Added an answer on June 9, 2026 at 9:04 am

    I figured out how to do this by <f:attribute/> by code in converter:

    Date day = (Date) component.getAttributes().get("dateForSearch");
    

    and in bean method after generating SelectBox with code:

    uiInput.getAttributes().put("dateForSearch", getSelectedDate()); 
    

    and in pages without dynamic generating of forms i used:

    <SelectOneMenu> 
    ... 
    <f:attribute name="dateForSearch" value="#{myBean.selectedDate}" />
    </SelectOneMenu> 
    

    I hope that this will not be only self answered question and will help somebody else

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

Sidebar

Related Questions

i got some problem and need help .. my plan : 1. get ip
I need help to get a response when I click on an Item from
I need some help to get this right, please. I have created an iPad
I need help regarding JOIN tables to get category name & author name from
I need a little help here: I get a file from an HTML upload
I would need little help here. I'm trying to get the git respository from
Am working on an application which has a requirement to download bulk data from
ASP.NET 4.0 Need some help with this vexing HTTP POST problem - I have
i have an application which has 3X4 matrix of images using arrow key(up,right,top,bottom) i
I am writing a WPF application using C# and I need some help with

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.