• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How To Submit A Property/Value PairThat Is Not Selected/Filled-Out By Visitors

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the welcome page, all visitors of the web site can choose to view any article that is available in the database. But, visitors will not be able to delete or update any of those articles (DELETE, UPDATE, etc. buttons are not provided). This part of my struts application works well. I have a drop-down list enclosed in <html:form> for visitors to make a selection and submit it for an action to be taken:

Visitor can choose articles by title, author, category, content, or article ID. If "author" is selected from the drop-down list and the name of the author "Victor Hugo" is supplied, keyName will be set as creator and keyValue will be set as Victor Hugo for further processing as shown in my struts-config.xml below:

After a registered visitor successfully logs in, a user specific page is displayed. For example, after the author Victor Hugo who has submitted several of his articles at the web site logs in, he will see a page with "Submit Article" and "View Article" (IT IS A LINK OR A BUTTON. IT IS NOT A DROP DOWN LIST), etc. The author can view his own articles only because DELETE, UPDATE, etc. buttons will be provided.
I am stuck here. There is no drop-down list for Victor Hugo. How do I supply keyName (which is "creator") and keyValue (request.getRemoteUser) to the action below if Victor Hugo clicks on the "View Article" button?
 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
How about subclassing ParameterAction to add keyValue to the path?

I think that would be the easiest...?
-Yoo-Jin
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to follow your suggestion. While I still have a couple of questions regarding how it can be done, let me present the first problem that I encountered.
The ParameterAction.java is in the org.apache.struts.scaffold. I put the struts.jar and struts-scaffold.jar in my classpath while compiling the sub-class. Nonetheless, I got


cannot resolve symbol
symbol: class ParameterAction


Here is my AuthorParameterAction that extends ParameterAction:
 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure whether i understood the problem correctly but from my interpretation, here are your answers.
I understand that you want to pass the user who is trying to update/delete the article(your creater attribute value) and also the method to call(your parameter action setting which is keyValue, since it seems like you are using dispatchaction/lookupdispatchaction). when you have buttons like update and delete, you can make 2...n*2 forms around them(one for update and one for delete and 2 per article) on the same page. In these forms you can set the creater (which you can get from the session since the user is logging in, you should have something in the session to identify him) and the keyvalue as a hidden variable which tells you what action is called and also the article id as a hidden variable which tells you which article the action has been called for.
HTH
Sahil
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have decided to use "hidden field" to do it. Thanks for your effort and advices.
 
Where does a nanny get ground to air missles? Protect this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic