Meaningless Drivel is fun!*
The moose likes Struts and the fly likes logic:iterate issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "logic:iterate issue" Watch "logic:iterate issue" New topic
Author

logic:iterate issue

rk sharma
Ranch Hand

Joined: Jun 25, 2011
Posts: 50

Hi,
I have a logic iterate to display all elements of a list. When i click the row, all the table columns should become amendable i.e., the text present at the table columns should become editable like text boxes. Can anyone suggest the logic. I tried in the following way.


Regards,

RK
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8914
    
    8

You will have to write some serious JavaScript to accomplish what you want. Personally, I prefer to have "Edit - Delete" links on each line item and bring up another page to do the editing.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
rk sharma
Ranch Hand

Joined: Jun 25, 2011
Posts: 50

Hi Joe,
Thank you for reply..
I have some number of rows and i have to make all the fields as amendable(should become editable in textbox) of a particular row when i supposed to click on that particular row.
Can you please give a snippet of code for that.
Franck Times
Greenhorn

Joined: Sep 20, 2011
Posts: 9

Hi,
with <bean:write name....> you're just displaying the field value. If you want it to be editable (i.e. be able to modifiy its value) you have to display it in an HTML element <input type=text ....>

so your code should be in Struts 1.x :

I made the assumption, you've chosen html as a prfix for struts tags with a line like:

And of course you have to encapsulate the whole display in a form whose action would take care of taking into account the modifications (saving to database, ...)

You might want to have a look at this example.

Regards
Franck
rk sharma
Ranch Hand

Joined: Jun 25, 2011
Posts: 50

Hi Franck,
Thank you very much for your valuable reply.
Here i just put a part of my code. I don't have any problem in accessing Struts. The fields should be displayed first in a web page(using bean:write) and then when i click a row the fields should become as editable as per the requirement.
Can you please suggest the way to do it.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8914
    
    8

rk sharma wrote:
Can you please suggest the way to do it.


As I said before, you will have to write some JavaScript to accomplish this task. Here is an example that shows how to display and hide fields depending on an action. If you are familiar with JavaScript, you should be able to adapt it (if you are not familiar with JavaScript, you'll need to do some reading to get up to speed).
Since this task has little to do with Struts, I suggest you have a look at our JavaScript forum.
 
 
subject: logic:iterate issue