Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

[STRUTS] How to manage a table

Thread view: 
loris_p - 29 May 2007 21:17 GMT
Hi, I have a table of users and I have to add for each row two buttons
(or links): "Modify" and "Delete". With JSP and Servlets I used to
pass parameters directly in the URL like this:
http://localhost/myapp/deleteUser?id=3
but I don't know how to make this with Struts Actions..
Can someone help me?
Thanks :)
mikwiat@gmail.com - 30 May 2007 00:22 GMT
> Hi, I have a table of users and I have to add for each row two buttons
> (or links): "Modify" and "Delete". With JSP and Servlets I used to
> pass parameters directly in the URL like this:http://localhost/myapp/deleteUser?id=3
> but I don't know how to make this with Struts Actions..
> Can someone help me?
> Thanks :)

i guess that you have to make two forms, one for the update, and the
second for delete.

Put some hidden field with value od your id.

for ex: <input type='hidden' value='" + user.getUserID + "'
name='userID' />

and send it to JSP that sends values to your method :)

understand?
sandy - 30 May 2007 12:56 GMT
> Hi, I have a table of users and I have to add for each row two buttons
> (or links): "Modify" and "Delete". With JSP and Servlets I used to
> pass parameters directly in the URL like this:http://localhost/myapp/deleteUser?id=3
> but I don't know how to make this with Struts Actions..
> Can someone help me?
> Thanks :)

----------------------
yeh same thing i did in struts but by using dispatch action and
javascript

<input type="button" value="Edit" class="edit"
onclick="window.location.href='action.do?methodToCall=edit&id=<%= --1
or 2 or 3 --- %>';"/>
<input type="button" value="Delete" class="deleteButton"
onclick="window.location.href='action.do?methodToCall=delete&id=<%=
---- 1,2,3---%>';"/></td>
Lew - 30 May 2007 14:16 GMT
>> Hi, I have a table of users and I have to add for each row two buttons
>> (or links): "Modify" and "Delete". With JSP and Servlets I used to
[quoted text clipped - 13 lines]
> onclick="window.location.href='action.do?methodToCall=delete&id=<%=
> ---- 1,2,3---%>';"/></td>

You don't absolutely need Javascript.  You can set up Struts to decipher the
method name of the Action class and dispatch to a different method for
different submit inputs.  You can also name the submits the same with
different values and dispatch to the correct method within the Action's
execute method based on those values.

Signature

Lew

loris_p - 30 May 2007 18:35 GMT
Ok, I will try then I'll write you if I did it.
Thanks to everyone :-)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.