Using a SelectOneChoice to retrieve a value in to a variable...
AAAAaaah. I've spent far too much time on what should be a very simple operation - can somebody help me....
(JDeveloper 10.1.3.4. Oracle ADF on Oracle ADF BC.)
I have a backing bean called HspShopBacking with a simple Date variable "selectedTime":
public class HspShopBacking
private oracle.jbo.domain.Date selectedTime;
getSelectedTime(){...}
setSelectedTime(oracle.jbo.domain.Date selectedTime){...}
}I would like to use a SelectOneChoice to display a list of times from my ViewObject: DELIVERY_TIMES and retrieve the value in to my selectedTime attribute.
Unlike most of the examples I can find I DON'T want my SelectOneChoice to have an existing Iterator as it's base datasource and then to retrieve the selected value from that iterator (because I've got various commits happening that might commit the updated value).
In Forms this was SO easy.....can somebody PLEASE point me in the direction of the relevant documentation or tell me what I need to do!!
I have a habit of answering my own questions ... these are the steps I took for retrieving a value from a SelectOneChoice component in to an individual variable, accessible from a backing bean (see the bottom of this post for links to the other posts that assisted me):
As an example, assume that I have Emp and Dept view objects in my model. I want a SelectOneChoice of departments that will take the selected Department Name in to a separate variable for access in the backing bean (and therefore will not use the Emp view at all).
1) To easily create a SelectOneChoice object (rather than try to create it manually), open the Emp view's data control up in the Data Control pallette and drag the Deptno column on to your JSPX (somewhere within the af:form tags). This is just so we can create the control using the wizard, we will be removing all references to Emp later.
2) From the context menu choose Single Selections->ADF Select One Choice
3) Select the Dept view iterator as the List Data Source
4) For now (to complete the wizard) select Deptno from the Base Data Source Attribute list, and choose Deptno from the List Data Source Attribute list (we will be changing these values in the XML once the wizard is complete).
5) Set the display attribute to Dname
6) Click OK
7) Open the source of the JSPX page where you created your SelectOneChoice right click and "Go to Page Definition"
8) In the structure pane, Right-click on executables->Insert inside executables->variableIterator
9) Right click on the created variables node in the Structure Pane->Insert inside variables->Variable
10) Give your variable a name (such as selectedDepartmentName)
11) I gave it a type of java.lang.Object (for maximum flexibility - I will be type checking inside the Backing Bean)
12) Select the bindings node, and from the right-click menu choose Insert inside bindings->attributeValues
13) From the wizard choose the "variables" data collection, and the attribute you named earlier (e.g. selectedDepartmentName), click OK
14) From the source xml of the attributeValues object you just created, change the id to something meaningful (e.g. selectedDepartmentValues)
15) In the structure pain, open the bindings node and Right click the list iterator binding that was created when you added the SelectOneChoice object (will be called something like EmpDeptNo) and choose "Go To Source"
15) From the source xml change the IterBinding="EmpIterator" to IterBinding="variables"
16) Change <Item Value="Deptno"/> to <Item Value="selectedDepartmentName">
So in summary the JSPX page will have:
<af:selectOneChoice value="#{bindings.EmpDeptNo.inputValue}"
label="#{bindings.EmpDeptNo.label}">
<f:selectItems value="#{bindings.EmpDeptNo.items}"/>
</af:selectOneChoice>The page definition will have:
<executables>
<iterator id="DeptIterator" RangeSize="-1"
Binds="Dept" DataControl="AppModuleDataControl"/>
<variableIterator id="variables">
<variable Name="selectedDepartmentName" Type="java.lang.Object"/>
</variableIterator>
</executables>
<bindings>
<list id="EmpDeptNo" IterBinding="variables"
StaticList="false" ListOperMode="0" ListIter="DeptIterator"
NullValueFlag="1" NullValueId="EmpDeptNo_null">
<AttrNames>
<Item Value="selectedDepartmentName"/>
</AttrNames>
<ListAttrNames>
<Item Value="Dname"/>
</ListAttrNames>
<ListDisplayAttrNames>
<Item Value="Dname"/>
</ListDisplayAttrNames>
</list>
<attributeValues IterBinding="variables" id="selectedDepartmentValues">
<AttrNames>
<Item Value="selectedDepartmentName"/>
</AttrNames>
</attributeValues>
</bindings>And your backing bean can access the value using:
FacesContext fc = FacesContext.getCurrentInstance();
ValueBinding vb = fc.getApplication().createValueBinding("#{bindings.selectedDepartmentValues}");
AttributeBinding ab = (AttributeBinding) vb.getValue(fc);
String dName = (String) ab.getInputValue() ;References:
Geting variable value in backing bean
http://www.oracle.com/technology/products/jdev/tips/mills/listvalue/listbindingvalue.html
Similar Messages
-
Using Javascript function to change the value of a request variable
Have a javascript function that activates onchange within a form variable. Would like the javascript function to change the value of a request variable.
The javascript function is able to obtain the current value of the request variable ( which is 0 ) however I am unsuccessful in changing the value to 1.
I have been trying to use the following:
var vchange = 'request.changes_made = 1 ;' ;
eval(vchange);
Any ideas?If the user makes a change to the content of the form, and then attempts to leave the form, a javascript alert pops up giving the user the option of cancelling the submit, returning to the form and saving it.
If there have been no changes, then the user is free to migrate to another page.
This process is to protect users from losing valuable information but not to annoy them with "R U Sure" messages.
Knowing the status of the form content is important to the functionality of the application.
G -
Retrieve values of other exit variable
hi gurus
i have to build an input ready query where on rows u have:
funds center cost center profit center account
and on columns:
0fiscper3
0amount
the user enter on the variable screen this:
0comp_code
0fiscyear
funds center
currency
0account
So just using the funds center I have to show cost center (matched with funds center on a Z Characteristic that I ve created) and the profit center for every costcenter (consulting 0costcenter on 0profit_ctr attribute).... I m using 2 exit variables on cmod ( one for getting costcenter and other for getting profit center), but when i have to feed profit center variables I have to retrieve the values for costcenter that were got for this variable... but how can I do this? Can I retrieve the values of other exit variable when filling profit center variable?
By the way I can use relation characteristic over this infocube because there already is an abap program that makes some logic over this infocube.
some suggest? point will be assigned
regardshi Ashish Tewari :
That s the way I was doing...
in ur example, are u considering 'ZCOST_CTR' as other exit variable? Because it s an exit variable that I fill through funds center variable whis user input...
If its not, what do u suggest?
here s my code, it works but it match every costcenter with all profit centers , which is wrong, every costcenter hast just 1 profit center...
** VARIABLE FOR 0costcenter
WHEN 'ZECCVAR045'.
IF i_step = '2'.
READ TABLE i_t_var_range INTO l_s_var_range WITH KEY vnam = 'ZECCGE001'.*this variables contains funds center
centro_gestor = l_s_var_range-low.
SELECT * INTO TABLE it_cenges_ceco
FROM /BIC/MZECFM012
WHERE objvers = 'A'
AND funds_ctr = centro_gestor.
LOOP AT it_cenges_ceco INTO ls_cenges_ceco.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = ls_cenges_ceco-/BIC/ZECFM012.
APPEND l_s_range TO e_t_range.
ENDLOOP.
ENDIF.
** VARIABLE for profit center for each cost center
WHEN 'ZECCBE010'.
IF i_step = '2'.
BREAK-POINT.
CLEAR it_cenges_ceco.
CLEAR ls_cenges_ceco.
CLEAR centro_gestor.
READ TABLE i_t_var_range INTO l_s_var_range WITH KEY vnam = 'ZECCGE001'.
centro_gestor = l_s_var_range-low.
SELECT * INTO TABLE it_cenges_ceco
FROM /BIC/MZECFM012
WHERE objvers = 'A'
AND funds_ctr = centro_gestor.
LOOP AT it_cenges_ceco INTO ls_cenges_ceco.
CLEAR ls_ceco.
ceco = ls_cenges_ceco-/BIC/ZECFM012.
SELECT SINGLE * INTO ls_ceco
FROM /BI0/MCOSTCENTER
WHERE objvers = 'A'
AND costcenter = ceco
AND dateto = '99991231'.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = ls_ceco-PROFIT_CTR.
APPEND l_s_range TO e_t_range.
ENDLOOP.
* BREAK-POINT.
ENDIF.
ENDCASE. -
How to Get User entered value in a text variable
Hi,
I have made a text variable to show the user entered value in the column header.
The user enteres value in a formula variable ABC whose default value is say '30'.
I am using customer exit to capture this value in the text variable. The code is as follows
IF i_vnam EQ 'txtvar'.
if i_step = 2.
LOOP AT i_t_var_range INTO loc_var_range
WHERE vnam = 'ABC'.
CLEAR l_s_range.
l_s_range-low = loc_var_range-low.
l_s_range-opt = 'EQ'.
l_s_range-sign = 'I'.
APPEND l_s_range TO e_t_range.
EXIT.
ENDLOOP.
endif.
endif.
Now when I am executing the query I am getting the default value in the column header i,e, 30. But when the user changes this default value to something else while executing the query, I simply get blank in the column. The changed value is not getting captured in the text variable.
ThanksHi,
Insted of going for exit,
just create a Text variable proceesing typr Default/ Manual Entry and set the default value as u wish,
use it in the KF header; dont use the same Text Variable for Query Title.
Now i tried this for you and it is working fine.
Regards
ReddY A -
Retrieve alert values for use as parameter in corrective action sql script
I am trying to write a corrective action sql script to kill a session that is blocking other sessions. I have the "blocking session count" metric set and the alert is firing correctly.
Is there any way to retrieve the sid and serial number from the alert generated and use it in a corrective action sql script?
Here is the alert generated:
Target Name=myproddb.world
Target Type=Database Instance
Host=myprodserver
Metric=Blocking Session Count
Blocking Session ID=SID: 522 Serial#: 5228
Timestamp=Mar 4, 2008 5:57:12 PM EST
Severity=Warning
Message=Session 522 is blocking 1 other sessions
Notification Rule Name=Testing Corrective actions
Notification Rule Owner=sysman
Clearly the sid, and serial # is contained within the alert Message field
what I want to write for the sql script is :
alter system kill session '%sid%,%serial_no%' immediate;
and have GC pass in the sid and serial_no to the script.
The "Target Properties" listed on the right of the Edit Corrective Action screen lists minimal details pertaining to the alert and certainly not the session sid, serial no.
Generically, is there any way to retrieve the values from an alert and use them in a corrective action script or job?
I've looked into getting the values from the mgmt$alert_history table, but I'm hoping that GC can pass the values to the sql script.
thanks in advance for your help.Hi
You can implementing a procedure like this.
1. When a block session count alarms occurs, there is a column in the v$lock that you can examine.
#!/bin/ksh
#kill_block_session.sh
#first export your variables
export ORACLE_HOME=/oracle/product/10.2.0.3
export ORACLE_SID=SIDNAME
$ORACLE_HOME/bin/sqlplus "/ as sysdba" << EOF
execute immediate killed_blocks;
EOF
# end
The killed_blocks is a procedure:
create procedure
declare
v_sid varchar2(15);
v_serial varchar2(15);
-- now a sql query that retrieve the sid and serial
-- you can obtain these values from v$session and v$lock
select vs.sid,vs.serial into v_sid,v_serial
from v$session vs,v$lock vl
where vs.sid=vl.sid
and vl.block >0
-- After this, you execute a dbms_put line with these
-- values
But you understant that this response action is very dangerous, because its possible that you kill sessions that the blocking are transitient.
You must examine your enviroment and your application and establish the metric like UDM and not for only session blocking count.
You must to see:
- The type of block
- The ctime time in the v$lock for to understatn the amount of time to determine that the block is need killed.
- In my opinion you need a special UDM and deactivate the blocking sesion count
If you want help to create this UDM send me a mail to [email protected]
Regards
Robert -
Re: [iPlanet-JATO] Re: Retrieving all Values from a Tiled View
Todd,
Let me try to explain you this time. I have a text field in a TiledViewBean.
When I display the page, the text field
html tag is created with the name="PageDetail.rDetail[0].tbFieldName" say
five times/rows with same name.
The html tags look like this.
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
When the form is submitted, I want to get the text field values using the
method getTbFieldName().getValues() which
returns an array object[]. This is in case where my TiledViewBean is not
bound and it is working fine.
Now in case when my TiledView is bound to a model, it creates the html tags
as follows.
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[1].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[2].tbFieldName" value=""
maxlength=9 size=13>
Now when I say getTbFieldName().getValues() it returns only the first
element values in the object[] and the rest of the
values are null.
May be we need to create a utility method do get these values from
requestContext.
raju.
----- Original Message -----
From: Todd Fast <toddwork@c...>
Sent: Saturday, July 07, 2001 3:52 AM
Subject: Re: [iPlanet-JATO] Re: Retrieving all Values from a Tiled View
Raju.--
I wanted to know how the getValues() method works the reason being,
when the tiled view is NOT bound to a model, it populates all the
fields with the same name as some thing likeI'm afraid I don't understand your point--can you please clarify? Do you
mean "value" instead of "name"?
What are you trying to do? What behavior are you expecting but notseeing?
>
Without further clarification, I can say that the setValues() methodsNEVER
populates data on multiple rows of a (dataset) model, nor does it affect
multiple fields on the same row. Perhaps what you are seeing is theeffect
of default values. Model that derive from DefaulModel have the ability to
carry forward the values set on the first row to other rows in lieu ofdata
in those other rows. This behavior is for pure convenience and can be
turned off, and it is turned off for the SQL-based models.
Todd
[email protected]Hi,
I wanted to know how the getValues() method works the reason being,
when the tiled view is NOT bound to a model, it populates all the
fields with the same name as some thing like
PageDetail.rDetail[0].tbFieldValue
PageDetail.rDetail[0].tbFieldValue
in which case, the getValues() method works fine.
But in case where the tiled view is bound to a model, it populates
with different field names such as,
PageDetail.rDetail[0].tbFieldValue
PageDetail.rDetail[1].tbFieldValue
in this case, the getValues() doesn't work. Any soultion to this?
We are using Moko 1.1.1.
thanks in advance,
raju.
--- In iPlanet-JATO@y..., "Todd Fast" <toddwork@c...> wrote:
Does anyone know of is there a single method to get all values of a
display
field in a tiled view without having to iterate through all the
values ie
resetTileIndex() / nextTile() approach.
ie Something that returns an Object[] or Vector just like ND returned a
CspVector. I tried using the getValues() methods but that allways returns
a
single element array containing the first element.
(I think now, that method is used for multi selecteable ListBoxes)Actually, no. We can add this in the next patch, but for now, I'd recommend
creating a simple utility method to do the iteration on an arbitrary model
and build the list for you.
Todd -
Retrieving ALL values from a single restricted user property
How can I retrieve ALL values of a single restricted user property from within
a .jpf file?
I want to display a dropdown list within a form in a JSP which should contain
all the locations listed in the property 'locations'. I ever get just the default
value when I access the property via
ProfileWrapper pw = userprofile.getProfileForUser(user);
Object prop = pw.getProperty("ClockSetup", "Locations");Well, the code you've got will retrieve the single value of the property
for the current user. You're getting the default value because the
current user doesn't have Locations property set, so the ProfileWrapper
returns the default value from the property set.
I assume you want to get the list of available values that you entered
into the .usr file in Workshop. If so, I've attached a
SetColorController.jpf, index.jsp, and GeneralInfo.usr (put in
META-INF/data/userprofiles) I wrote for an example that does just this.
It uses the PropertySetManagerControl to retrieve the restricted values
for a property, and the jsp uses data-binding to create a list from that
pageflow method.
For a just-jsps solution, you can also use the
<ps:getRestrictedPropertyValues/> tag. I've attached a setcolor-tags.jsp
that does the same thing.
Greg
Dirk wrote:
How can I retrieve ALL values of a single restricted user property from within
a .jpf file?
I want to display a dropdown list within a form in a JSP which should contain
all the locations listed in the property 'locations'. I ever get just the default
value when I access the property via
ProfileWrapper pw = userprofile.getProfileForUser(user);
Object prop = pw.getProperty("ClockSetup", "Locations");
[att1.html]
package users.setcolor;
import com.bea.p13n.controls.exceptions.P13nControlException;
import com.bea.p13n.property.PropertyDefinition;
import com.bea.p13n.property.PropertySet;
import com.bea.p13n.usermgmt.profile.ProfileWrapper;
import com.bea.wlw.netui.pageflow.FormData;
import com.bea.wlw.netui.pageflow.Forward;
import com.bea.wlw.netui.pageflow.PageFlowController;
import java.util.Collection;
import java.util.Iterator;
* @jpf:controller
* @jpf:view-properties view-properties::
* <!-- This data is auto-generated. Hand-editing this section is not recommended. -->
* <view-properties>
* <pageflow-object id="pageflow:/users/setcolor/SetColorController.jpf"/>
* <pageflow-object id="action:begin.do">
* <property value="80" name="x"/>
* <property value="100" name="y"/>
* </pageflow-object>
* <pageflow-object id="action:setColor.do#users.setcolor.SetColorController.ColorFormBean">
* <property value="240" name="x"/>
* <property value="220" name="y"/>
* </pageflow-object>
* <pageflow-object id="action-call:@page:index.jsp@#@action:setColor.do#users.setcolor.SetColorController.ColorFormBean@">
* <property value="240,240,240,240" name="elbowsX"/>
* <property value="144,160,160,176" name="elbowsY"/>
* <property value="South_1" name="fromPort"/>
* <property value="North_1" name="toPort"/>
* </pageflow-object>
* <pageflow-object id="page:index.jsp">
* <property value="240" name="x"/>
* <property value="100" name="y"/>
* </pageflow-object>
* <pageflow-object id="forward:path#success#index.jsp#@action:begin.do@">
* <property value="116,160,160,204" name="elbowsX"/>
* <property value="92,92,92,92" name="elbowsY"/>
* <property value="East_1" name="fromPort"/>
* <property value="West_1" name="toPort"/>
* <property value="success" name="label"/>
* </pageflow-object>
* <pageflow-object id="forward:path#success#begin.do#@action:setColor.do#users.setcolor.SetColorController.ColorFormBean@">
* <property value="204,160,160,116" name="elbowsX"/>
* <property value="201,201,103,103" name="elbowsY"/>
* <property value="West_0" name="fromPort"/>
* <property value="East_2" name="toPort"/>
* <property value="success" name="label"/>
* </pageflow-object>
* <pageflow-object id="control:com.bea.p13n.controls.ejb.property.PropertySetManager#propSetMgr">
* <property value="31" name="x"/>
* <property value="34" name="y"/>
* </pageflow-object>
* <pageflow-object id="control:com.bea.p13n.controls.profile.UserProfileControl#profileControl">
* <property value="37" name="x"/>
* <property value="34" name="y"/>
* </pageflow-object>
* <pageflow-object id="formbeanprop:users.setcolor.SetColorController.ColorFormBean#color#java.lang.String"/>
* <pageflow-object id="formbean:users.setcolor.SetColorController.ColorFormBean"/>
* </view-properties>
public class SetColorController extends PageFlowController
* @common:control
private com.bea.p13n.controls.ejb.property.PropertySetManager propSetMgr;
* @common:control
private com.bea.p13n.controls.profile.UserProfileControl profileControl;
/** Cached possible colors from the User Profile Property Set definition.
private String[] possibleColors = null;
/** Get the possible colors, based upon the User Profile Property Set.
public String[] getPossibleColors()
if (possibleColors != null)
return possibleColors;
try
PropertySet ps = propSetMgr.getPropertySet("USER", "GeneralInfo");
PropertyDefinition pd = ps.getPropertyDefinition("FavoriteColor");
Collection l = pd.getRestrictedValues();
String[] s = new String[l.size()];
Iterator it = l.iterator();
for (int i = 0; it.hasNext(); i++)
s[i] = it.next().toString();
possibleColors = s;
catch (P13nControlException ex)
ex.printStackTrace();
possibleColors = new String[0];
return possibleColors;
/** Get the user's favorite color from their profile.
public String getUsersColor()
try
ProfileWrapper profile = profileControl.getProfileFromRequest(getRequest());
return profileControl.getProperty(profile, "GeneralInfo", "FavoriteColor").toString();
catch (P13nControlException ex)
ex.printStackTrace();
return null;
// Uncomment this declaration to access Global.app.
// protected global.Global globalApp;
// For an example of page flow exception handling see the example "catch" and "exception-handler"
// annotations in {project}/WEB-INF/src/global/Global.app
* This method represents the point of entry into the pageflow
* @jpf:action
* @jpf:forward name="success" path="index.jsp"
protected Forward begin()
return new Forward("success");
* @jpf:action
* @jpf:forward name="success" path="begin.do"
protected Forward setColor(ColorFormBean form)
// set the color in the user's profile
try
ProfileWrapper profile = profileControl.getProfileFromRequest(getRequest());
profileControl.setProperty(profile, "GeneralInfo", "FavoriteColor", form.getColor());
catch (P13nControlException ex)
ex.printStackTrace();
return new Forward("success");
* FormData get and set methods may be overwritten by the Form Bean editor.
public static class ColorFormBean extends FormData
private String color;
public void setColor(String color)
this.color = color;
public String getColor()
return this.color;
[GeneralInfo.usr]
[att1.html] -
How to retrieve multiple values from a DB Adapter to a Web Service
Hello,
I'm creating a login WS that receives the username and password and returns the user status, full name and a set of permissions (the number of permissions varies among users).
In order to do that i've created a DBAdapter that is calling a PL/SQL procedure. This DBAdapter is connected to the login Web Service through a mediator.
I have two problems:
1 - I don't know the type of variable that the PL\SQL procedure should return. Like I said I need to retrieve an undefined number of values from a table (user permissions). How can I do this inside a PL\SQL procedure? What kind of structure should i return?
2 - How can i assign a multiple value variable (the permission variable) in the mediator? Is the mediator going to identify that this is variable is multiple valued and add automatically a for-each statement?
The Oracle DB version im using is the 11.1.0.7.0 and the Oracle SOA Suite 11.1.1.3.0.
Thanks in advance,
PauloHey guys,
thanks for your help.
I've created a userdefined type and sucessfully retrievied from the PL\SQL procedure multiple values. I have also mapped this values with the web service.
Even though everything's working fine i would like to understand if it is also possible to use the XMLType to return these values. I ask this cause I don't no if by returning a XMLType i can explicitly map the XML elements inside the mediator component.
If possible what are the main advantages/disavantages between using XMLType and Userdefined Types?
Paulo. -
How to retrieve 2 values from a table in a LOV
Hi
I'm pretty new to APEX. I try to retrieve two values from a table using a LOV. I have a table named DEBIT with then columns SITE, NAME and KEY
I want to display NAME to the user in a list. When the user select an item from the list, I want to retrieve the data of the SITE and KEY column of this item in order to launch an SQL command based on this two values.
How to retrieve thes two values whant the user chooses an item from the list ?
I apologize for my english, being french.
Regards.
ChristianChristian,
From what I understood about your requirement, you want a 'select list with submit' which displays "NAME" and based on the value selected, you want to get the corresponding values for "SITE" and "KEY" from the table.
<b>Step 1: Create a select list with submit, say P1_MYSELECT </b><br><br>
Use something like this in the dynamic list of values for the select list: <br>
SELECT NAME display_value, NAME return_value
FROM DEBIT<br><br>
<b>Step 2: Create a page process of type PL/SQL block. Also create 2 hidden items P1_KEY and P1_SITE. </b><br><br>
In the PL/sQL, write something like:
DECLARE
v_key DEBIT.KEY%TYPE;
v_site DEBIT.SITE%TYPE;
CURSOR v_cur_myvals IS
SELECT KEY, SITE
FROM DEBIT
WHERE NAME = :P1_MYSELECT;
BEGIN
OPEN v_cur_myvals;
LOOP
FETCH v_cur_myvals
INTO v_key,v_site;
EXIT WHEN v_cur_myvals%NOTFOUND;
:P1_KEY := v_key;
:P1_SITE := v_site;
END LOOP;
CLOSE v_cur_myvals;
END; <br><br>
Then you can use these values for whatever purpose you need to.
Hope this helps. -
Retrieving checkbox values from JSP
In my program I have an 'ADD' form.
In that form I ask the question "Do you have a car?"
with a single checkbox for reply.
The code I use is below.
Can anyone tell me how to set the checkbox to 'ticked' or 'unticked' in my
main jsp by sending paramters from the ADD form's checkbox??
ADD FORM...
<form action='post' method='servlet/controller?task=addEmployee'>
<input type'text' name='emplpoyee'>
<input type='checkbox' name='car' value='true'>
<input type='submit' name='submit' value='Add'>
</form>
Through a class I retrieve the values posted
public Page doTask() {
Employees employee = new Employees();
employee.setName(request.getParameter("name"));
employee.setCar(Boolean.getBoolean(request.getParameter("car")));
try{
String submit = request.getParameter("submit");
if(submit.equals("Add")){
model.addEmployee(employee);
Page nextPage = new Page("/servlet/Controller?task=GetAllEmployeesTask");
return nextPage;
This class sends the parameters to my main JSP where
this information is inserted. ('employees.jsp')
my name is retrieved so...
<= employees.getName()>
how would I retrieve/set a checkbox valuerequest.getParameter("car")
the thing is that the browser will not send unchecked checkbox values. so you can only know it was checked by the presense or absense of the value. -
Retrieving all values from hashmap in order you put them in
Hi guys,
I want to retrieve all values from a HashMap in the order I put them in.
So I can't use the values() method that gives back a collection and iterate over that.
Do you guys know a good way to do that ?You can just do something like this:
class OrderedMap
private final Map m_rep = new HashMap();
private final List m_keys = new ArrayList();
public Object get( final Object key )
return m_rep.get( key );
public Object put( final Object key, final Object value )
final Object result = m_rep.put( key, value );
if ( result != null )
m_keys.add( key );
return result;
public Object remove( final Object key )
final Object result = m_rep.remove( key );
if ( result != null )
m_keys.add( key );
return result;
public Iterator keyIterator()
return m_rep.iterator();
}Then use it like this:
for ( Iterator it = map.keyIterator(); it.hasNext(); )
final Object value = map.get( it.next() );
}This will be in the order you put them in. However, if you want to do this correctly, you should implement the Map interface and add all the methods. Another thing you can do is download the JDK 1.4 source, learn how they did and do it the same way for 1.2.
R. -
How to retrieve the values from a table if they differ in Unit of Measure
How to retrieve the values from a table if they differ in Unit of Measure?
If no data is read
- Insure that you use internal code in SELECT statement, check via SE16 desactivating conversion exit on table T006A. ([ref|http://help.sap.com/saphelp_nw70/helpdata/en/2a/fa0122493111d182b70000e829fbfe/frameset.htm])
If no quanity in result internal table
- There is no adqntp field in the internal table, so no quantity is copied in itab ([ref|http://help.sap.com /abapdocu_70/en/ABAPINTO_CLAUSE.htm#&ABAP_ALTERNATIVE_1@1@]).
- - Remove the CORRESPONDING, so quantity will fill the first field adqntp1. ([ref|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_WA.htm])
- - Then loop at the internal table and move the quantity when necessary to the 2 other fields.
* Fill the internal table
SELECT msehi adqntp
INTO TABLE internal table
FROM lipso2
WHERE vbeln = wrk_doc1
AND msehi IN ('KL','K15','MT').
* If required move the read quantity in the appropriate column.
LOOP AT internal_table ASSIGNING <fs>.
CASE <fs>-msehi.
WHEN 'K15'.
<fs>-adqnt2 = <fs>-adqnt1.
CLEAR <fs>-adqnt1.
WHEN 'MT'.
<fs>-adqnt3 = <fs>-adqnt1.
CLEAR <fs>-adqnt1.
ENDCASE.
ENDLOOP.
- You could also create another table with only fields msehi and adqntp and then collect ([ref|http://help.sap.com/abapdocu_70/en/ABAPCOLLECT.htm]) the data to another table.
Regards,
Raymond -
How to retrieve the values from PL/SQL table types.
Hi Every one,
I have the following procedure:
DECLARE
TYPE t1 IS TABLE OF emp%ROWTYPE
INDEX BY BINARY_INTEGER;
t t1;
BEGIN
SELECT *
BULK COLLECT INTO t
FROM emp;
END;
This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
Can anybody help me please!!!!!
Thanks
Ahmed.You mean, you can't add this
for i in t.first..t.last loop
dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
end loop;or you can't add this
set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
You see, not able like very similar it is not working - both are too vague...
Best regards
Maxim -
How to retrieve constants value from compiled code in jar file?
Hi everyone,
I've been looking for a way to solve this for a week now, without any much success... and I've finally decided to ask the Java gurus for a solution! :-)
Here's what I am basically trying to do:
I have several jar files in which there are only compiled code (.class).
In every class, there are 2 constants (declared as static final String) that I would like to retrieve (one is the version and the other the date of the last modification).
My goal is to print a list of all the classes in the jar files with the values of these 2 constants for each class.
The solution that I have right now to do this does not work properly: for now, I read all the elements of the classpath, check if these are jar files, and if so, I look into each one and load all the classes one by one and print the results.
The problem with this is that it uses the method Class.forName(className) and as some classes are unfortunately present in many jar files (2 or 3 copies), once the classes have been loaded, then it won't be "reloaded".
Without the possibility to "reload" these classes, I cannot see inconsistencies in the versions of the classes present in the jar files.
I have read many articles, and I thought that I could then use a custom classloader and create a new instance of this classloader for each jar file.
2 problems with this:
- according to many posts in the different forums I have read, the jar files should not appear in the CLASSPATH (but this would be easier for me if I could use it...)
- some classes will not be loaded if some classes (present in other jar files) are not loaded... and this makes things really really complicated to implement...
So, I thought that I was maybe doing this the wrong way, and that there might be an easy way out of this...
In fact, I do not need to load the classes... all I need to do, is take a sneak peek at the constants and print their values... and that's it!
Somehow, I think that this is possible to retrieve the values of compile time constants (declared as static final String) as I can see that with Eclipse (when opening a jar file).
So, my question is: how can I do that within my java application?
Or maybe there is another easier solution to do what I need?
Thanks in advance for your help!Hi everyone,
I've been looking for a way to solve this for a week now, without any much success... and I've finally decided to ask the Java gurus for a solution! :-)
Here's what I am basically trying to do:
I have several jar files in which there are only compiled code (.class).
In every class, there are 2 constants (declared as static final String) that I would like to retrieve (one is the version and the other the date of the last modification).
My goal is to print a list of all the classes in the jar files with the values of these 2 constants for each class.
The solution that I have right now to do this does not work properly: for now, I read all the elements of the classpath, check if these are jar files, and if so, I look into each one and load all the classes one by one and print the results.
The problem with this is that it uses the method Class.forName(className) and as some classes are unfortunately present in many jar files (2 or 3 copies), once the classes have been loaded, then it won't be "reloaded".
Without the possibility to "reload" these classes, I cannot see inconsistencies in the versions of the classes present in the jar files.
I have read many articles, and I thought that I could then use a custom classloader and create a new instance of this classloader for each jar file.
2 problems with this:
- according to many posts in the different forums I have read, the jar files should not appear in the CLASSPATH (but this would be easier for me if I could use it...)
- some classes will not be loaded if some classes (present in other jar files) are not loaded... and this makes things really really complicated to implement...
So, I thought that I was maybe doing this the wrong way, and that there might be an easy way out of this...
In fact, I do not need to load the classes... all I need to do, is take a sneak peek at the constants and print their values... and that's it!
Somehow, I think that this is possible to retrieve the values of compile time constants (declared as static final String) as I can see that with Eclipse (when opening a jar file).
So, my question is: how can I do that within my java application?
Or maybe there is another easier solution to do what I need?
Thanks in advance for your help! -
Unable assign a BPM Object field value to a JSP Variable using "invoke"
Hi,
I'm unable to retrieve a value returned by a BPM Object Method and use it in JSP. Here is what I'm trying to achieve:
BPM object named : "myObject" has a method "getRequiredValue" which returns a "String". I want to assign the value returned by "getRequiredValue" to a JSP Variable "myVariable" using invoke method as below:
<% String myVariable = ""; %>
<f:invoke var="${myObject}" methodName="getRequiredValue" retAttName="myVariable"/>
<% out.println ("myVariable: " + myVariable); %>
When I execute the above code I don't get the value being returned by "getRequiredValue" into "myVariable".
Any help would be highly appreciated!
regards,
MK1. Make sure you mark the "Server Side Method" property of the getRequiredValue method to "Yes".
2. I guess you dont need to specify "<% String myVariable = ""; %>". Try removing it.
3. Replace "<% out.println ("myVariable: " + myVariable); %>" by <c:out value="${myVariable}"/> just in case!
4. Lastly, I hope "myObject" is the name of the instance variable in your screenflow, and not the BPM object name.
Hope this helps
-Hemant
Maybe you are looking for
-
Problem with cancel billing document URGENT
Hello, I have a problem. I have created cancel invoice but if you look at the document flow for tht cancel invoice it is showing completed and accounting document clreared. But client is asking that when ever we create cancel invoice this status shou
-
G/L Accounts and cost center
i would like to find the list of valid G/l Accounts and cost center for a input company code. Is there any good tables for getting this information. ?
-
Need to apply payment for delivered items only, not full down payment
Version: (8.8 PL18) Description of requirements: (Be able to handle the right amount of down payment when we copy a sales order to an invoice and there is a back order for some items. It actually works fine when we go on an invoice and we copy from a
-
How to make a menu for HD content (not BD)
I am a newbie on this forum and I am not sure where to post: I am a middle-aged woman with blond (grey) hair (**** happens) BUT I have been 'playing around' with computers since 1977. I have been editing video and audio since the 90's and mainly as a
-
Upgraded to Creative suite 5 from photoshop CS5
Hi, I bought Photoshop CS5 standalone a while ago but have now bought creative suite CS5 production which comes with photoshop extended version. During the install it said it wouldn't reinstall photoshop, but is there much of a difference between sta