Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Nested Form problem with IE. How to avoid using struts?

 
DimuthuDeeJay Jayamanna
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all java gurus,

My JSP:




Here I have a collection of keywords, and printing them in a loop with submit buttons and the user can delete whatever the keyword they like. (action will remove the corresponding entry from the ArrayList). Also the user can add a keyword to the collection using another submit button. (adding a new entry to arraylist)

The problem is this code segment don't work in IE, and later I found out that the sitemesh in my program is adding another fom element to the JSP. I googled and found out that the nested forms are not working in IE. (and it is not recommended?)

I tried to fix this by removing my form tag, but my keyword removal function failed (the action can't distinguish which keyword is to be removed). only the adding keyword was working.

I tried it using javascript but I couldn't find a way to get the remove-button index the user presses. (because keywords are rendered dynamically)


Am I doing something wrong? I'm not much familiar with using JSPs. Please help me!!!

 
satya nara
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi use form outside inner form

like

use this way

 
DimuthuDeeJay Jayamanna
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

But my sitemesh configuration added a <form> tag to the upper section and closes it at the lower. (its a header and footer)
So I dont have a control over it
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then you had better change the SiteMesh configuration, hadn't you? It's a weird design to use a library like SiteMesh for opening/closing form tags anyway, and even more so to do it in the page header/footer.
 
DimuthuDeeJay Jayamanna
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf Dittmer,

I agree with you.
However I looked through the sitemesh configurations and the include pages and couldnt find any form tags inside the header and footer. But after I render the page, it appears in the JSP (page->view source)

Apart from that, I'm not sure about the consequences of changing since so many share the same config.
Thats why I tried to change my JSP.

 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd advise not to change anything until (and unless) you fully understand which parts of the final HTML originate from which JSP pages or page fragments, in whichever way they may be included.
 
DimuthuDeeJay Jayamanna
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
solved it like this. I wonder why struts submit buttons passes parameters incorrectly.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic