fady005
Posts: 115
|
Posted: 03/16/2007, 1:40 AM |
|
Hello,
I'd like to take some Session variables from a precedent page (I know how to do) and insert them row by row into a new table (I don't know how to do)...
The Session variables are changed every time I pass by the main page (depending on selection) so I have keep an history of the values in the results page...
Can you help me please ?
_________________
Be inventive ! |
|
|
matheus
Posts: 386
|
Posted: 03/16/2007, 4:26 AM |
|
How do you need insert them row by row? You had a editable grid? If had, put a hidden field, put Control Source, fill with session value, and voilá. Save this.
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
fady005
Posts: 115
|
Posted: 03/16/2007, 4:40 AM |
|
I would like to do like in the example in php on the website : http://examples.codecharge.com/Store/ShoppingCart.php but I want to do it in JSP....
I didn't really understand your idea matheus... can you please give me an extract of the code ? thanks
_________________
Be inventive ! |
|
|
matheus
Posts: 386
|
Posted: 03/16/2007, 9:02 AM |
|
What didn't work?
What really do you need?
What Session had in ShoppingCart example?
Please try think, and not just extract of code.
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
fady005
Posts: 115
|
Posted: 03/19/2007, 12:45 AM |
|
What I want is to add a line in a table for every article I add to the cart.
Just forget all about Session... I just want to know how to add a new row for every article.... and then how to delete a row...
The extract of code is always more useful than a long explanation...
I think what I'm looking for is explained here : http://examples.codecharge.com/ExamplePack/EditableGrid...Button_desc.php but I didn't really understand how to deal with it...
Is this what it looks like ?
<TR id="{RowIDAttribute}" name="{RowNameAttribute}" {RowStyleAttribute}> If not please correct it...
_________________
Be inventive ! |
|
|
matheus
Posts: 386
|
Posted: 03/19/2007, 3:37 AM |
|
This example, put all row visible false, when click Add Row, then the line appears.
It's something like this you want?
It's a Editable Grid?
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
fady005
Posts: 115
|
Posted: 03/19/2007, 5:42 AM |
|
It might be a solution...
But how can we show the next Row ?
I think an Editable grid is the best way...
_________________
Be inventive ! |
|
|
matheus
Posts: 386
|
Posted: 03/19/2007, 5:52 AM |
|
Next Row? You will not save one-to-one. You will put 3 itens, and save one time.
I don't understand what you need.
What Shopping Cart example had that you need?
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
fady005
Posts: 115
|
Posted: 03/19/2007, 7:03 AM |
|
Actually At the first page we select a product and it's characteristics and the quantity...
For example : "Computer : Pentium 4, 512Mb RAM, 40Gb HDD,..."
At the second page we have the summary of the Cart in a table... so at the first time it add the article to the table so we have one row showed with 3 colums (The name of the article = Computer, The characteristics = Pentium 4, 512Mb RAM, 40Gb HDD,... and The check box to delete)...
Then when we click on a link and select another product "Monitor : 15", Flat, Toshiba,..."
and when we submit we have the table containing two rows (one for every choice), etc...
This is the detailed explanation...
Thanks for your help !
_________________
Be inventive ! |
|
|
matheus
Posts: 386
|
Posted: 03/19/2007, 12:09 PM |
|
Ok, do you can do with one product?
You want to do a submit (save product) when selected link from product. You will need save data manually.
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
fady005
Posts: 115
|
Posted: 03/19/2007, 11:48 PM |
|
Yes I've done it with one product...
For manual save I will create a session variable for each product...
I just want to know how to add rows (or show rows if they're invisible) on page load and then how to delete them (or hide them) when the user want to...
Thanks
_________________
Be inventive ! |
|
|
matheus
Posts: 386
|
Posted: 03/20/2007, 4:38 AM |
|
Do you need to do the INSERT in SQL manually!
And EditableGrid retrieve value from database.
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
fady005
Posts: 115
|
Posted: 03/20/2007, 6:55 AM |
|
Actually the values I want to retrieve are not from the database so no need for SQL...
All the variables are saved in session variables...
If I use a simple Grid could I be able to add rows ?
Thanks
_________________
Be inventive ! |
|
|
matheus
Posts: 386
|
Posted: 03/20/2007, 9:12 AM |
|
Grid is a list of products, without form input.
EditableGrid have form input.
But in yout case, you need Grid that retrieve value from session and not from database, right?
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
fady005
Posts: 115
|
Posted: 03/21/2007, 12:57 AM |
|
That's it !
So you mean I have to use a simple grid ?
_________________
Be inventive ! |
|
|
matheus
Posts: 386
|
Posted: 03/21/2007, 3:39 AM |
|
Codecharge doesn't implement Grid that retrieve value from session.
You can do Grid in hand.
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
fady005
Posts: 115
|
Posted: 03/22/2007, 12:14 AM |
|
That's what I'm doing...
I just don't know the code to insert dynamically a new row... Do you ?
_________________
Be inventive ! |
|
|
matheus
Posts: 386
|
Posted: 03/22/2007, 4:32 AM |
|
In Before Show Row you can do this (populate Grid with a new line), but you need have ALL values in session.
But, in Java, you need change some CCS generated code.
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
fady005
Posts: 115
|
Posted: 03/23/2007, 12:23 AM |
|
OK could you give an extract of the code ?
And what should I change ?
_________________
Be inventive ! |
|
|
matheus
Posts: 386
|
Posted: 03/23/2007, 3:48 AM |
|
In EditableGrid, put all controls that you need.
In File <<nm_editablegrid>>DataObject.java
-----------------------------------------------
Look method load();
Look fireAfterSelectEvent.
one line after fireAfterSelectEvent, it was a connection close.
after that line you start.
fireAfterExecuteSelectEvent( new DataObjectEvent(command) );
ds.closeConnection();
//End load
//Custom Code
Vector list2 = new Vector();
Object obj = null;
while (records.hasMoreElements()){
obj = records.nextElement();
list2.add(obj);
}
ArrayList listVal = new ArrayList();
//populate this arraylist, with your session values!
amountOfRows = listVal.size();
int start = (( pageNum - 1 ) * pageSize);
int size = getPageSize();
listVal = new ArrayList(lista.subList(start, listVal.size()));
if ((size) <= listVal.size()){
listVal = new ArrayList(listVal.subList(0, size));
}
DbRow hash = null;
for (int i=0; i<listVal.size(); i++){
hash.put("param1", (Object)msg.getVl_1());
//hash.put("<<nm_control>>", "object that you need");
list2.add(hash);
}
records = lista2.elements();
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
fady005
Posts: 115
|
Posted: 04/13/2007, 1:29 AM |
|
I've done it in JavaScript... i think it's easier in my case...
Thanks for your help !
_________________
Be inventive ! |
|
|
privatemiao
Posts: 17
|
Posted: 05/22/2007, 2:39 AM |
|
package test;
public class Demo {
public static void main(String[] args) {
boolean flag = false;
String [] str = {"jpg", "png", "bmp"};
for(int i = 0; i < str.length; i ++){
if ("jpg".equalsIgnoreCase(str)){
flag = !flag;
break;
}
}
System.out.println(flag);
}
}
_________________
me was me |
|
|