Retrieveing a value from a set of instances of same entity.
Hi,
I want to retrieve a value of a particluar attribute from an entity instance among the group of instances of same entity. How this can be done?
Consider my rule base as below
the person ---> the person's income year (the person's income years)
the person's income year --> the person's income months(the person's incomes in a year)
"the person" conatins info about the person, "the person's income year" contains information about the year and "the person's income months"
entity contains entity instances for various months like jan- $200, feb-$300 and so on for a particular year defined in the "person's income
year" entity.
Now consider below set of data
Person 1
year-2012 - entity instance
jan -$200 - entity instance
feb-$300 - entity instance
mar-$400 - entity instance
year-2013 - entity instance
jan- $500 - entity instance
feb- $700 - entity instance
mar-$100 -entity instance
Now I im proving rules for year 2013 say jan , and I want to get the value of an attribute from the entity of year 2012 jan month.
How can I get the value from a previous entity instance?
You can use InstanceValueIf to achieve the result
Similar Messages
-
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 -
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 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 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. -
Problem in Retrive values from result set
I have a class where i do all database operation .First i fire select query and take values from result set and based on that value i fire update query.
Problem is that i am not getting all values from result set . i get only last value and when i fire update query i get error as :Resultset is closed.
I am using acess and java.You probably are using the same Statement object for both queries? Try creating separate Statement objects for each query. (My guess is this a problem with the way you're using JDBC, not a Servlet issue.)
-
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 -
Has anyone retrieved a value from a system Matrix from selecting the row
Hi everyone, I am trying to retrieve the value of a cell from the first column of a matrix depending on which row the user has highlighted. I can access the value from specifying which row to retrieve the value from but not from the user selecting which row. Im attempting do do this from the open items list system form which is accessed from the reports menu.
To retrieve the value from the first row my code is as follows:
oMatrix = oForm.Items.Item("5").Specific
DocNo = oMatrix.Columns.Item("1").Cells.Item(1).Specific.Value
SBO_Application.MessageBox(DocNo)
How do I change this code to access the value of the cell depending on which row is highlighted?
Any help would be appreciatedHi Sally,
you will get the selected row number on any event through "pVal.Row", you can get this value in a integer variable like:
int i = pVal.Row
and pass it in your code;
DocNo = oMatrix.Columns.Item("1").Cells.item(i)
or you can do same in this way also:
you have to specify your particular cell as a edit text and get the value of that:
oEditText=(SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(i).Specific;
string1 = oEditText.String;
Hope it will help. -
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] -
Retrieving multiple values from one column in SELECT statement
Hi,
I have a slight dilemma in that I'm trying to pull down all the values from a column from a select statement that includes some JOINS in it.
If I run the query at the SQL Plus prompt, it pulls back all the values/rows.
When I run the select (and prepared ) statement in my JSP, it only pulls back one of the 4 values I'm trying to retrieve.
e.g.
at the DB level :
SELECT role_name, CC_ID FROM votetbl a
INNER JOIN APPROVERS b ON
a.BUSVP = b.BUSVP AND
a.BRANCH = b.BRANCH
WHERE CC_ID = 1688this will return:
ROLE_NAME CC_ID
ops 1688
ops 1688
comply 1688
legal 1688
comply 1688
When run in my JSP, like so:
String primID3a = request.getParameter("primID");
Statement stmtovoter = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
String prepvotSQL = "SELECT role_name, CC_ID FROM votetbl a INNER JOIN APPROVERS b ON a.BUSVP = b.BUSVP AND " +
"a.BRANCH = b.BRANCH WHERE CC_ID = ?";
PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
prepvotstmt.setString(1, primID3a);
ResultSet rest3 = prepvotstmt.executeQuery();
rest3.next();
String votecat = rest3.getString(1);
out.println("Vote category: "+votecat);I only get ops returned.
Do I need to run an enumerator? Or reqest.getParameterValues or use a while statement around the results set?
Any feedback and direction here is welcomed!
Thanks!Actually, I tried looping and still only get 1, but returned several times.
i.e.
PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
prepvotstmt.setString(1, primID3a);
ResultSet rest3 = prepvotstmt.executeQuery();
rest3.next();
String votecat = rest3.getString(1);
while (rest3.next()) {
out.print("category roles "+votecat);
}then I get returned the following:
admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admin
like so.
Where as at the DB level I get
ROLE_NAME CC_ID
admin 1688
ops 1688
ops 1688
ops 1688
ops 1688
ops 1688
ops 1688
ops 1688
risk 1688
comply 1688
legal 1688
legal 1688
ops 1688
comply 1688
Maybe the while should go around the getString(1) designation? But I was thinking I'd tried that and gotten invalid cursor error
Something is definitely amiss, between the prepared statement in the servlet and the SELECT statement at the DB level.
I can totally hardcode the statement in the servlet or JSP and it will return one value potentially several times, but only one.
Other times, it will not return a value at all, even though one resides in the db.
Yet go to the DB/SQL Plus prompt and it returns perfectly. I can simply copy and paste the SELECT statement from the out.print line I made and it works like a champ in SQL Plus. Any ideas why the same exact thing cannot return the proper values within the servlet/JSP?
Yeeeeeeesh!!! : (
Message was edited by:
bpropes20 -
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. -
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. -
Retrieve changing values from TextInput Flash Component
Hi,
I've been banging my head against the wall with this one....
I've placed aTextInput Flash Component on the stage which
reads/displays a value from an external text file. So far so good.
If I enter new text during run-time - editable is set to true
- the TextInput component updates to reflect what I've typed. BUT,
how do I retrieve that text to a variable? (I need to save the new
value back to the external text file).
Current code:
myfieldtext = sprite(51).text
And eventPassMode is set to passAlways
this retrieves the initial value regardless of what I type.
Any help appreciated!I'm not sure if this all helps, but I had to make a flash
name input box
recently. I was getting all sorts of weird results trying to
get the text
out of flash. It was giving me all the font info etc, and I
just needed the
name. So what I ended up doing is when they were done
entering the text, I
put the text into a variable within flash, then pulled the
data from that
variable rather than striaght out of the text.
in director, in the behaviour attached to the flash sprite:
myText = sprite("nameInput").getVariable( "myNameString",
True)
where the sprite is named "nameInput". It seems better to
name the sprite
and refer to it that way than using the sprite number, such
as sprite(51).
In flash I have the text input field named "textInput", and
the following
code attached to the save button. You may have to use a
different event,
like when they text input loses focus.
on (release) {
var myNameString = "";
myNameString = textInput.text
trace(myNameString)
getURL('event:doEvent,1')
Timm
"tayl" <[email protected]> wrote in message
news:edjutm$ptl$[email protected]..
> Hi,
>
> I've been banging my head against the wall with this
one....
>
> I've placed aTextInput Flash Component on the stage
which reads/displays a
> value from an external text file. So far so good.
>
> If I enter new text during run-time - editable is set to
true - the
> TextInput
> component updates to reflect what I've typed. BUT, how
do I retrieve that
> text
> to a variable? (I need to save the new value back to the
external text
> file).
>
> Current code:
> myfieldtext = sprite(51).text
> And eventPassMode is set to passAlways
>
> this retrieves the initial value regardless of what I
type.
>
> Any help appreciated!
>
>
> -
Can't retrieve bean value from jsp!
Here's the chain of events for my web app:
JSP form (get info from user) -> forwarding jsp (uses bean to save info submitted to form)-> servlet (retrieves info from DB) -> JSP (presents DB info to user by populating values in text fields from original form)
Right now, I can access all the values submitted to the first JSP from my servlet. However, after my servlet retrieves the info from a db and stores it in a bean and forwards the request (using requestdispatcher) to the 2nd JSP, I can't get the values from the bean from the 2nd jsp. I was able to use the bean to store the information submitted to the original JSP, however.
Here's some relevant code:
FROM FORWARDING JSP (which saves user-submitted info in bean)
<jsp:useBean id="fxFormBean" class="fxmatcher.FxFormBean" scope="request"/>
<jsp:setProperty name="fxFormBean" property="*" />
<jsp:forward page="/FxMatcher" />
FROM LAST JSP (which should populate form fields)
header stuff:
<jsp:useBean id="fxFormBean" class="fxmatcher.FxFormBean" scope="session"/>
info retrieval:
<INPUT TYPE="text" NAME="fx_key" value="<%= fxFormBean.getFx_key() %>">
I wrote this JSP based on the example given here: http://www.jsptut.com/Editing.jsp, but I'm not getting the value from the bean. The result JSP just has value="".
I'm pretty sure that my servlet is saving the info to bean correctly, but here's the code anyways:
//retrieves info from DB
FxFormBean fx = (FxFormBean) request.getAttribute("fxFormBean");
fx.setFx_key (traderKey);
fx.setAa_block(agent_block);
fx.setAddition_to (additional_to);
log("trader key: [" + fx.getFx_key() + "]"); //debugging code
My debugging code did print out the correct info, so I don't think there's anything wrong with the bean or the servlet.
I would appreciate any help. Thank you very much.The first JSP puts the bean in the request, the servlet retrieves the bean from the request and updates it but in the second JSP you set the scope to session:
<jsp:useBean id="fxFormBean" class="fxmatcher.FxFormBean" scope="session"/>
So the second JSP is looking in the wrong place for your bean. Change the scope in the second JSP to request:
<jsp:useBean id="fxFormBean" class="fxmatcher.FxFormBean" scope="request"/> -
How to retrieve the values from a LinkedList
Hello,
I have just put this question in java programming forums by mistake...I think that it should be here ...
I have created a LinkedList to store the results of a query to a database.
These reasults are decimal numbers and then I want to sum all these numbers to be able to make the average.
But when I try to retrieve the values of the Linked List I always receive an incopatible types error..
Here is an extract of my code in a jsp page.
LinkedList Average = new LinkedList();
String Media = rst.getString(10);
Average.add(Media);
int Size = Average.size();
double Sum = 0.0;
for (int i=0; i<=Size; i++)
double Result = Average.get(i)
Sum = Sum + Result;
}If I try to retrieve the value of only one node from the list , I can just putting <%=Average.get(i)%>...but..how can I retrieve all the values (they are decimal numbers) to be able to add them?If you want to sum all the values, is there any reason you just don't retrieve the sum from the database rather than the list of values?
anyway
List average = new LinkedList();
while (rst.next()){
// retrieve the number:
String mediaString = rst.getString(10);
Double media = Double.valueOf(mediaString);
// or maybe like this if it is a number in the database
Double media = new Double(rst.getDouble(10));
average.add(media);
doubleSum = 0.0;
for (Iterator it = average.iterator(); it.hasNext(); ){
Double result= (Double) it.next();
doubleSum += result.doubleValue();
}
Maybe you are looking for
-
User Information checkboxes in remote web service
They have these checkboxes there for a reason - ease of property retrieval in a remote portlet. However, I'm unable to retrieve these values w/o using the IObjectManager and IExtendedData. If I'm using the .net app accel 1.1 and my portlet page is in
-
How do i delete account?
I have created new apple account as i have lost my access to my old email account that i have used to create an apple account. So i was wondering is there any way for me to delete that account. If there is may i know how do i go about doing it. I hav
-
Material Management Material Needed Please help!
Hi, I am new to SAP, have a MS in mech engineering. I am taking some classes but the class does not have any PDF tutorial material. I am looking for a tutorial which has all the steps with Screen dumps for complete MM implementation. I greatly apprec
-
Hi all, It is told that we have to create a structure in order to pass input values to a BAPI, whether it is via import paramter or tables parameter. When i tried to declare a import parameter with TYPE declaration also BAPI was generated and worked
-
Hiding navigation area from transaction screen--module pool
Using module pool, i am displaying a transaction screen at the click of a button. This transaction screen also has a small navigation screen appearing on the left.I want to hide this navigation area. How do I do it.