• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

few questions about design struts application

 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I changed it!
And now would anyone answer my question?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
yeah, but ... what would PIE do? Especially concerning this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic