Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

including a file in jsp

 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am including a jsp inside one of my jsps as follows

<form method="post">
......some code
<%@ include file="addressFind.jsp" %>
.....some more code
</form>

now in my javascript function when I say document.forms[0].element then it gets the form from addressFind.jsp and not the current form. and when i say document.forms[1].element then it says forms[1] has no properties. How can I include the file and still be able to access my current form. This page is a popup page.
Thanks
Imad
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are including a form within another form then you are generating invalid HTML. It has nothing to do with the include -- the same thing would happen if you didn't use the include and generated an HTML file with a form within a form.

Remember, JSP is just a templating technology to generate the HTML page to send to the browser. It's your repsonsibility to ensure that the HTML that gets generated is valid.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic