aspose file tools*
The moose likes Struts and the fly likes struts2: how to create dynamic input field? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply locked New topic
Author

struts2: how to create dynamic input field?

hans meiser
Greenhorn

Joined: Dec 29, 2008
Posts: 22
Hi guys.

I would like to create a Form where a user can enter a text, and then enter multiple buzzwords which match to the text.

My first Idea was to make a input field and to write, that the user has to seperate each buzzword with a ; in the input field. so i could operate with string operations an fill each buzzword into the database.

now my question is, if there is a possibility to make a input form, which generates a new empty input field, if you fill in the first on? so the user can add as many buzzwords as he likes?

this would be easyier to handle for the user.

Thanks for your input!
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8708
    
    6

Are you asking how to add the text boxes? That's not a struts problem. You can do that with client-side javascript.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
hans meiser
Greenhorn

Joined: Dec 29, 2008
Posts: 22
Can you tell me how i have to implement this on one JSP site? how can i use the stored values after that in my action class?

It would be very helpful, if you could post a short example?

Thank you very much...
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8708
    
    6

You can use javascript in a JSP.
As for getting the information to an action, I assume one would use an indexed property. Our FAQ has an example for Struts 1. This example for Struts 2 is fairly similar.
Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 541
Hi,

I have similar kind of problem

I tried the below:




Idea is to use same name in Action Class property.
The above works but below does not:





Now I would use the name EmailId1 as property but the above does not work.Please advice.

Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Please do not post the same question more than once.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts2: how to create dynamic input field?
 
Similar Threads
help with this type of programa (manipulating text)
Form Problem
form navigation
jQuery-How to highlight invalid input field value after getting validation error
Validate a form