Make html:checkbox selected by default depending upon bean value --struts
Hi all,
I have a doubt regarding the html:checkbox .
I have the following code in my jsp.
I am giving it inside logic:iterate tag and fetching the value from session scope.
<html:checkbox property ="readchk" value ="read" indexed="true" onclick="return assignme(this.value,this.checked,'s')"/>
How to make this checkbox selected by default.
"readchk" (bean) is in my ActionForm, it has been been assigned either
0 or 1 .
I want to make the checkbox selected by default if the readchk is 1
and the checkbox not selected if the readchk value is 0.
Could anybody please help me out in fixing this problem.
Thanks
Parvathi
If u give the value for ur check box in the action form it wld be checked!!
regards
Shanu
Similar Messages
-
How can I make JSF checkboxes selected by default?
Hi everyone,
I have a problem in setting default value for checkboxes. I use them in a table. tableRowGroup's sourceData property is a list data provider. In the page bean I have the following code to select rows:
private TableSelectPhaseListener tablePhaseListener = new TableSelectPhaseListener();
public void setSelected(Object object) {
RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
if (rowKey != null) {
tablePhaseListener.setSelected(rowKey, object);
public Object getSelected(){
RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
return tablePhaseListener.getSelected(rowKey);
public Object getSelectedValue() {
RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
return (rowKey != null) ? rowKey.getRowId() : null;
public boolean getSelectedState() {
RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
return tablePhaseListener.isSelected(rowKey);
}I received a list of objects from a service using list data provider and use checkboxes to select them. Then I get the selected checkboxes in the action method of the page bean using
RowKey[] selectedRows = getTableRowGroup1().getSelectedRowKeys(); What I want to do is to set all the checkboxes as selected by default. Normally, this is performed by assigning the same values to selected and selectedValue properties of the checkbox component. But, in my case this is not applicable since we take advantage of getSelected() and getSelectedValue() methods in the pagebean. Properties of my checkbox component are as follows:
<ui:checkbox binding="#{MyPage.checkBox1}"
id="checkBox1" selected="#{MyPage.selected}" selectedValue="#{MyPage.selectedValue}"/>I cannot assign same values to selected and selectedValue. Can anyone help me to make these checkboxes selected as it is rendered?Hi Fanado,
In Finder, click once on an Excel document then Get Info (command i)
Choose Open with: Numbers
Then Change All... to make Numbers the app for all Excel documents.
The same for Word and Powerpoint
Regards,
Ian. -
To make a checkbox checked by default
hi all,
I am using struts framework
and I am using the below line for creating a checkbox
<html:checkbox property="name" value="Y" /></td>
How can I make the checkbox checked by default
thanksset value="something" in ur jsp
then in 2 ways u can set default values
1--- by setting that value in formbean
2--- by using setProperty() method in ur action
if that value matchs... then corresponding controll set defualt -
Make changes to the line item depending upon doc type n sp. GL ind in F-48
I want to make changes to the line item depending upon the document type and special GL indication for the transaction code F-48.
Depending upon document type and special GL indicator i want to calculate the work contract tax during simulation in transaction code F-48.Hi,
You want to deduct WCT when you use particular document type and special gl indicator.
I just want to know the reason why you want to determine the WCT based on the above conditions.
I created WCT as withholding tax types and assigned to vendor master. So when the user booking transactions he will choose the respective WCT tax type and tax code so system will deduct the amount and the same updated in WITH_ITEM.
Or you made a down payment request through T.code F-47 and when you want to book the actual transaction in F-48 then choose line item from down payment request.
Give me your requirement in clear if the above is not clear
Regards,
Sankar -
Hide Advance table Depending upon the value of dropDown
Hi,
I have 2 advance tables. 1st one has a DropDown. Depending upon the value of the dropdown in 1st advance table, the second advanced table should get rendered.
I tried by getting the value of the dropdown by addingg a PPF and iterating trough the table and I got the value. But when I redirect to the same page, all the selection and other values in 1st advanced table vanish out.
Can someone help me getting the 2nd table hidden and at the same time retaining the values for the 1st advanced table.
Thanks in Advance,
Kaushik RambhiyaKaushik
Implement PPR for this requirement and dont redirect the page
Displaying image based selected value of choice bean
http://oracleanil.blogspot.com/2009/05/ppr.html
Thanks
AJ -
Shading part of a JTable Cell dependent upon the value of the cell
Hi
Was hoping some one woudl be able to provide some help with this. I'm trying to create a renderer that will "shade" part of a JTable cell's background depending upon the value in the cell as a percentage (E.g. if the cell contains 0.25 then a quarter of the cell background will be shaded)
What I've got so far is a renderer which will draw a rectangle whose width is the relevant percentage of the cell's width. (i.e. the width of the column) based on something similar I found in the forum but the part I'm struggling with is getting it to draw this rectangle in any cell other than the first cell. I've tried using .getCellRect(...) to get the x and y position of the cell to draw the rectangle but I still can't make it work.
The code for my renderer as it stands is:
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;
public class PercentageRepresentationRenderer extends JLabel implements TableCellRenderer{
double percentageValue;
double rectWidth;
double rectHeight;
JTable table;
int row;
int column;
int x;
int y;
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (value instanceof Number)
this.table = table;
this.row = row;
this.column = column;
Number numValue = (Number)value;
percentageValue = numValue.doubleValue();
rectHeight = table.getRowHeight(row);
rectWidth = percentageValue * table.getColumnModel().getColumn(column).getWidth();
return this;
public void paintComponent(Graphics g) {
x = table.getCellRect(row, column, false).x;
y = table.getCellRect(row, column, false).y;
setOpaque(false);
Graphics2D g2d = (Graphics2D)g;
g2d.fillRect(x,y, new Double(rectWidth).intValue(), new Double(rectHeight).intValue());
super.paintComponent(g);
}and the following code produces a runnable example:
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
public class PercentageTestTable extends JFrame {
public PercentageTestTable()
Object[] columnNames = new Object[]{"A","B"};
Object[][] tableData = new Object[][]{{0.25,0.5},{0.75,1.0}};
DefaultTableModel testModel = new DefaultTableModel(tableData,columnNames);
JTable test = new JTable(testModel);
test.setDefaultRenderer(Object.class, new PercentageRepresentationRenderer());
JScrollPane scroll = new JScrollPane();
scroll.getViewport().add(test);
add(scroll);
public static void main(String[] args)
PercentageTestTable testTable = new PercentageTestTable();
testTable.pack();
testTable.setVisible(true);
testTable.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}If anyone could help or point me in the right direction, I'd appreciate it.
RuanaeThis is an example I published some while ago -
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class Fred120 extends JPanel
static final Object[][] tableData =
{1, new Double(10.0)},
{2, new Double(20.0)},
{3, new Double(50.0)},
{4, new Double(10.0)},
{5, new Double(95.0)},
{6, new Double(60.0)},
static final Object[] headers =
"One",
"Two",
public Fred120() throws Exception
super(new BorderLayout());
final DefaultTableModel model = new DefaultTableModel(tableData, headers);
final JTable table = new JTable(model);
table.getColumnModel().getColumn(1).setCellRenderer( new LocalCellRenderer(120.0));
add(table);
add(table.getTableHeader(), BorderLayout.NORTH);
public class LocalCellRenderer extends DefaultTableCellRenderer
private double v = 0.0;
private double maxV;
private final JPanel renderer = new JPanel(new GridLayout(1,0))
public void paintComponent(Graphics g)
super.paintComponent(g);
g.setColor(Color.CYAN);
int w = (int)(getWidth() * v / maxV + 0.5);
int h = getHeight();
g.fillRect(0, 0, w, h);
g.drawRect(0, 0, w, h);
private LocalCellRenderer(double maxV)
this.maxV = maxV;
renderer.add(this);
renderer.setOpaque(true);
renderer.setBackground(Color.YELLOW);
renderer.setBorder(null);
setOpaque(false);
setHorizontalAlignment(JLabel.CENTER);
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col)
final JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
if (value instanceof Double)
v = ((Double)value).doubleValue();
return renderer;
public static void main(String[] args) throws Exception
final JFrame frame = new JFrame("Fred120");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(new Fred120());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
} -
JTable - make 1st row selected by default
hi,
i have a JTable, how can i make the 1st row selected by default?
thanks.try table.getSelectionModel().setSelectionInterval(0, 0)
You need to check and make sure there is at least one row in the table before you do this, otherwise exception will throw.
Hope this will help. -
How to make a checkbox checked by default in payment method table in APsuppliers
I need to make the first checkbox in the payment method table(row name: check) to be checked by default... Any suggestion are welcome...
set value="something" in ur jsp
then in 2 ways u can set default values
1--- by setting that value in formbean
2--- by using setProperty() method in ur action
if that value matchs... then corresponding controll set defualt -
Make second workset selected by default
Hi,
I have a pcd role as shown below.
Role A (visible : yes)
|
--------Workset A (Entry point : yes; visible : yes)
|
------------------Folder A (visible : yes)
|
--------------------Workset 1 (visible : yes; leaf folder : yes)
|
-----------------------Page 1 ( default entry to folder : false)
Workset 2 (visible : yes; leaf folder : yes)
|
-----------------------Page 2 ( entry point : yes; default entry to folder : true)
Workset 3 (visible : yes; leaf folder : yes)
|
-----------------------Page 2 ( default entry to folder : false)
Along with this, I want to mention that it is EP 7.4. And I have tries by changing the property 'Clicking folder name launches first node' to false, but no effect.
I want the role to open with Page 2 as the first screen.
But it is not working.
Please help.
Thanks
ArindamIf u give the value for ur check box in the action form it wld be checked!!
regards
Shanu -
Multi select prompt defaulting to only 256 values
Hello All,
The requirement we have is to have the prompt defaulted it to be picking all the values in the prompt. The prompt has about 700 values. But it's only defaulting to 256 values. Is there a way to increase this. I am on obiee 11.1.1.6.10.
I have tried using the <MaxDropDownValues>256</MaxDropDownValues> in instanceconfig.xml. but that's off now use. Is there a seperate parameter that would control the values in multi select prompt?
Kindly help out.
Regards,
DeepHello Deep,
Check this
Srinivasan Software Solutions Pvt.Ltd.: [OBIEE 11g] Customizing Prompts 'ALL Column Values' To Custom Value
Thanks,
Sasi Nagireddy.. -
I am working in access 2013 to update a database first created in Access 2003. It has been saved as an accdb but I have the same problem in earlier versions.
I have a Tab Control subform in my MainDataEntry form which has 5 different tabs. Each Tab has its own set of text boxes and combo boxes for data entry. At the top of the MainDataEntry form there is a Text box [Text393], which has a drop down with
the 5 TAB names, [Mobile Device],[Computer],[Loose Media],[Network] and [Original Device]. When I select one of these values in the Text box, I would like to automatically set focus on the first Textbox or ComboBox inside the corresponding TAB.
I have tried to do this using the MacroBuilder inside the "After Update" Property for the Text or Combo box that is on the MainDataEntry Form using "If" and "Else If" statements for the "GoToControl" action, however
I seem to be able to only get one Tab to work. I have tried several different variations of this, putting the If statement first and the action argument second...putting all arguments inside a group, or not grouped....nothing seems to work. What am I
doing wrong?
EXAMPLE:
If [Text393]=[Mobile Device] Then
GoToControl
Control Name Combo471
Else If [Text393]=[Computer] Then
GoToControl
Control Name Bios_Date
Else If [Text393]=[Loose Media] Then
GoToControl
Control Name Combo659
Else If [Text393]=[Network] Then
GoToControl
Control Name User Name
Else If [Text393]=[Original Device] Then
GoToControl
Control Name Combo814
End IfIn the Macro Builder's AfterUpdate event for [Text393]:
GoTo Control
Control Name =Forms!MainDataEntry.Controls(Text393.Value).Name
To ensure that the first control on each tab receives the focus, set that control's Tab Index property to zero (0). -
How to display data depend upon ListBox value?
Hi Experts and Particularly Hema,
As I asked before how to display data in the ListBox, I got an very good response from you all(particularly Hema) .
Now what my doubt is asked with sample scenario below:
In Screen Painter -
Two fields namely : One List Box and other is I/O used only for displaying purpose i.e., only for output, not for input purpose.
List Box is filled by primary key field(C1) value from one table(T1) when the screen load.(i.e., such code is written in PBO).
Now what I need is :
If the user select any one value in the List Box then it automatically display the corresponding C2 value from T1 in the I/O field.
I think you may all understand what I am trying to ask.Please let me know the solution.
Thanks in advance,
Regards,
RaghuSimply attached a function code for the listbox... when the user changes the value, you will be able to pick this up in the PAI and loop back to the PBO and redisplay the corresponding output field.
Jonathan -
Can we hide column in a query depending upon the variable selected
Hi all,
let us say my report have 10 column.
now i am giving user option to select the values (let us say 'a' or 'b')
columns must be displayed depending upon the value selected by user ..
for example if user has selected 'a' then first five columns should be displayed..and if user has selected 'b' last five column should be displayed..(it will be OK even if we can hide the columns depending upon the selection )
Is it possible in BEx...please let me knowI did it sometime back. A bit complicated process.
Create an infoobject, manually enter the values "keyfig1" and "keyfig2".
Include this infoobject in the filters and restrict it using a "ready for input" variable.
Now create two formula variables.
Write a customer exit such that when you select "keyfig1", first formula variable's value should be set to 1 and other one's to 0.
Then in the query create two calculated key figures, multiply both with the formula variable. Also supress column (all active value == 0).
Then it will show the key figure which you have selected.
Pravender -
How do I make the checkbox selections made by users in FIM RCDC visible on the email notifications and on the request details on the request in the portal?
PhinaCongrats to Wim on a great article!
Forefront Identity Manager Technical Guru - October 2014
Wim Beck
Event Driven Scheduling of Forefront Identity Manager (FIM) using a Windows Service
Ed Price: "Fantastic job on formatting, the code, and all the explanations! The TOC and References are a nice touch!"
PG: "Nice innovative solution, that is a nice add-on to existing solutions. "
Ed Price, Azure & Power BI Customer Program Manager (Blog,
Small Basic,
Wiki Ninjas,
Wiki)
Answer an interesting question?
Create a wiki article about it! -
Safari is sandboxed to not reveal filepath from html file select to Javascript ?
I know safari is sandboxed not to reveal filepath from html file select control to Javascript via the Value attribute , but i am unable to find any documentation regarding how this is done and since when this is present .. Can somebody please guide me with this ..?
Since Safari is able to save as HTML file a page if it is opened online (from web), making "Save as...", and it is unable to make so if the webarchive file is on the hard disk...I tried to upload on a web server some .webarchive files.
Then I went online in the web page with the list of all the uploaded .webarchive files... (ex.: http://....filename1.webarchive, etc...)...
My goal was to open ONLINE (not on hard disk) the files and then make "save as...",... but... SURPRISE!!! Safari is UNABLE to open a webarchive file from the web, it asks me where to save the file... it can only save it, it writes that it is an "application"...
I think this happens because .webarchive is not a real web page but a "package"... but my displeasure is this:
Once opened an hard disk's webarchive file, its content is loaded in ram and it appears like a normal web page (html + images + etc...)... so, in this moment, Safari should be able to save it "as...." HTML file too.... discarding images and other objects....
Any advice?
Thank you!!!
Maybe you are looking for
-
Playback Issues with multiple framerates and Blackmagic Decklink 4K Extreme
I recently swapped by AJA Kona Card for a Blackmagic Decklink 4K Extreme in order to get external monitoring in DaVinci Resolve. I'm working in a 1080p 23.976 project that includes some 29.97 SD and HD footage. When loading this 29.97fps footage into
-
Why MLB.TV is not appearing after the last update?
why MLB.TV is not appearing after the last update?
-
Deleting and Syncing Photos on iPhone doesn't work or is stuck
I have around 3000 photos on my iPhone (all albums from Apterture synched via iTunes). I intend to delete all of them. It does not work if I choose to uncheck the synch photos feature in iTunes and also if I check it but have no albums/projects selec
-
SATA Drives - Opposite Configuration under Windows XP
I have 2 HDDs - 160GB and 80GB. I plug 160GB into SATA 1 and 80GB into SATA 2 on motherboard (MSI 865PE Neo2-PLS). In BIOS, 160GB is "Primary IDE" and 80GB is "Secondary IDE". I installed Windows XP SP2 in 160GB. 80GB remains plugged in SATA 2. In Wi
-
Mac Pro fans blowing continuously at full speed.
Hi guys, just bought a Mac Pro off someone. 2006 model, 2.0 quad core. The guy was running two x western digital 500GB drives. But took them out and replaced it with a seagte ST3500413AS 500gb drive (new). Mac OSX installed fine. But when i boot it u