File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use html:submit to send value

 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Hello, guys:

How should I do if I want to send a selected value once
submit button is clicked?

Here is the scenario:
I have a logic:iterate tag looping through and display a
collection of rows, there is a html:submit button at the end
of each row. If I want to send a property of a specific row
once button is clicked, how should I do?

I tried property attribute of html:submit:
html:submit property="title" ... (title is property of a row)

But it only send over button value -"Get".

Greatly appreciate any input.

(sorry, I could not post for detailed code because of posting errors)
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, clicking any button will submit the entire form and include the <buttonName>=<buttonText> as a parameter.

Assuming that you don't use crazy Javascript tricks: If your buttons all have the same <buttonText> (Get), they will have to have different <buttonName>s. Otherwise there's no way to tell them apart.

Try using indexes on the names. Note that your getGet(String) method will need to change to getGet(String[]).
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Thanks. I am trying to know which button is clicked, but which
associated row was chosen.

What I am asking is actually to achieve what html:link can do.

For html:link, we can use paramName, paramProperty to send over
a property value of a specific row of a collection using getParameter() method. Can html:submit do the same? I know its a tough question
since I have not seen anyone do this or given an clear answer.

I am wondering if Struts actually does not add the same functionality
to html:submit as to html:link. A negligence?

Originally posted by Marc Peabody:
Well, clicking any button will submit the entire form and include the <buttonName>=<buttonText> as a parameter.

Assuming that you don't use crazy Javascript tricks: If your buttons all have the same <buttonText> (Get), they will have to have different <buttonName>s. Otherwise there's no way to tell them apart.

Try using indexes on the names. Note that your getGet(String) method will need to change to getGet(String[]).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic