aspose file tools*
The moose likes Struts and the fly likes few questions about design struts application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "few questions about design struts application" Watch "few questions about design struts application" New topic
Author

few questions about design struts application

ashish kulkarni
Ranch Hand

Joined: Aug 15, 2002
Posts: 130
Hi,
I have to develop a website using struts, most all my webpages will be
add, change, delete, display type.
Like, i will show about 20 records per page, each one will have a
checkbox, there will be 3 buttons on bottom.. Add, Change, Delete,
so if the user clicks add, i will show him add screen and add the
record, if user selects one record and presses change i will show the user
data where he can change and same in delete..
now how can i decide on the action class on my first display page, also
the form tag, so when the user clicks add direct him to add.jsp, if
change or delete to change or delete.jsp with the selected value and also
have validtion like user cannot use change unless he clicks one row,
also cannot click more then one row for change etc.

Any comments will be appreciated


A$HI$H
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
ashishkulkarni,
JavaRanch has a naming policy which is strictly enforced. Please read the policy and change your display name if you wish to continue posting here.
You can change your name:
here


Matthew Phillips
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
Using the scenario as you've outlined it...
jsp1.jsp

struts-config.xml

UpdateAction.java

ChangeAction.java

DeleteAction.java

Personally, since you only want one record to be changed or at a time, I would do something in jsp1.jsp like when each row is displayed, the "name" or whatever field, on each row is a hyperlink to the "change" action which passes the correct parameter identifying which record to change.
Additionally I would display checkboxes next to each row, which when checked, indicate that you want that record deleted. Let's say you give your checkboxes names of "deleted" and values corresponding to the record number you want deleted. In that case your code would look something like this:
jsp1.jsp

struts-config.xml

UpdateAction.java

ChangeAction.java

DeleteAction.java

Hope this helps.
[ August 27, 2002: Message edited by: Jason Menard ]
ashish kulkarni
Ranch Hand

Joined: Aug 15, 2002
Posts: 130
Hi Jason,
I really appreciate you giving such a nice answer for my question, i will build the application keeping it in mind..
thanx again
Erik Hatcher
Author
Ranch Hand

Joined: Jun 11, 2002
Posts: 111
Please take this advice: do not hardcode values of buttons into an Action subclass. What if your user/client says "please make this button say 'OK' instead of 'Save'". Then you are stuck modifying Java code when simply changing ApplicationResources.properties would have sufficed.
Have a look at DispatchAction or (my creation) LookupDispatchAction.


Co-author of Lucene in Action
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
Originally posted by Erik Hatcher:
Please take this advice: do not hardcode values of buttons into an Action subclass. What if your user/client says "please make this button say 'OK' instead of 'Save'". Then you are stuck modifying Java code when simply changing ApplicationResources.properties would have sufficed.
Have a look at DispatchAction or (my creation) LookupDispatchAction.

This is good advice. The example is only provided for brevity and to get the point across.
rock cordial
Greenhorn

Joined: Jul 22, 2002
Posts: 6
I got perhaps the same question with it,but I want to delete or select one or more items at a time,what should I do?
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
cordialreal,
JavaRanch has a naming policy which is strictly enforced. Please read the policy and change your display name if you wish to continue posting here.
You can change your name: here
rock cordial
Greenhorn

Joined: Jul 22, 2002
Posts: 6
I changed it!
And now would anyone answer my question?
Venkata Hari
Greenhorn

Joined: Dec 26, 2005
Posts: 1
Hi, Could any of you suggest on how to use LookupDispatchAction with hyper links? I have a hyper link (with <a> tag) and I need to direct this to a LookupDispatchAction. I know when you click on a <html:submit> button, it carries the key of <bean:message>, but how can I pass the same information when I click on a hyper link?
I would greatly appreciate your thoughts.
Thanks in advance!!!

Cheers,
Venkat
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: few questions about design struts application
 
Similar Threads
object oriented programming in javascript
Performance Problem?
Row locking using oracle database
controlling jsp:forward
back button after logout