• Post Reply Bookmark Topic Watch Topic
  • New Topic

display data on same jsp page

 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



This is additem.jsp

Screenshot_1.png
[Thumbnail for Screenshot_1.png]
This is my jsp page.
Screenshot_2.png
[Thumbnail for Screenshot_2.png]
If I click "add new item" button, then it goes another jsp page, i want this form in same jsp page,how it is passible?
 
L Foster
Ranch Hand
Posts: 205
11
Android Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@sarojni, Hello.

I notice that the script below has if-tests for the name of the launching button-click. You have one for "insert", which happens to be the value for two different submit buttons. One of those is the "add new item" button.



and this is from the JSP form:



Now, do you understand? Also, I do not know what you are going for here, but if I had been writing this, I would want the "Add new Item" button to land just where it is landing. Then, after completing the addition of the item, I might want it to land back on the display page.

Anyway, I hope this helps.
 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean to say when I click "add new item" then then item form should be on "gold.jsp" means on same page mentioned in image...
Screenshot_3.png
[Thumbnail for Screenshot_3.png]
this is gold.jsp
 
L Foster
Ranch Hand
Posts: 205
11
Android Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah. I've misunderstood. What you want is to combine the 2nd form with the first. That can be accomplished by just inserting the text of the 2nd form into the first. If you do that, your "Item Name" text input will always appear, whether you are trying to add anything or not.

You could also do that with JavaScript, where the new form grows into the screen in response to your button click, and can be deleted when you are done. Just look into JavaScript.

Sorry for the earlier confusion.
 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want 2nd form in first form, but I do not want , every time it appears, I want 2nd form only when when I click "add new item" button...
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't embed a form within a form. You can hide a set of forms element in the one form until you want them to appear with a button click.
 
L Foster
Ranch Hand
Posts: 205
11
Android Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case, you can make a javascript function to add the form, whenever the button is clicked. Then when the form's own button is clicked, carry out the action, and use a javascript function to remove the form again. You would need to learn JavaScript to do that, however.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
L Foster wrote:In that case, you can make a javascript function to add the form, whenever the button is clicked.

Except (see above) you can't embed one form within another. If the new elements are to be part of an independent form, it must be outside the other form.

It's also a lot easier for the "new form" to already be there hidden, and to be shown only when needed, rather than trying to create the elements on-the-fly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!