2013-03-04 114 views
1

嗨,我有一個Jsp頁面,我想在另一個jsp頁面中調用該jsp頁面。比如我有includefile.jsp頁我該如何調用一個jsp頁面到另一個jsp頁面

<html> 
<body> 
    <b><font color='red'> Hello World</font></b><br> 
    <b><font color='red'> HTML file is included in JSP page<font></b> 
</body> 
</html> 

和我有include.jsp頁面,在這裏我要撥打的第一個JSP

<html> 
<body> 
<%@ include file='includedFile.jsp' %> 
</body> 
</html> 

但是這個代碼不工作。如果有人能幫助我解決這個問題,我將非常感激。

+0

你見過這個http://stackoverflow.com/questions/9110148/include-another-jsp-file,並且確定目錄結構是否給出了includedFile.jsp的正確路徑 – Freak 2013-03-04 07:13:24

+0

是的我我正在給正確的道路。這兩個jsp都在同一個文件夾中,我不知道它有什麼問題,我也看到了堆棧溢出的例子,但我無法讓我的代碼與該示例一起工作。 – Saurabh 2013-03-04 07:39:08

+0

嘗試從includedFile.jsp中刪除和標籤,然後檢查 – Freak 2013-03-04 07:46:52

回答

2

在你include.jsp頁

<html> 
<body> 
<form action = "includeFile.jsp"> 
<input type="submit" value="open other jsp"> 
</form> 
</body> 
</html> 

**一定要放在同一文件夾兩個JSP文件。

相關問題