在包含页的方法中能不能嵌入 html

1981520baby 2003-09-12 02:12:07
我做了2个JSP文件,其中 a.jsp 包含 b.jsp
a.jsp--------------->
<%@ include file=b.jsp%>

b.jsp-------------->
<%!
String ttt="ttt";
public String lilili() throws Exception{
//我想在这里嵌入HTML 却提示出错~
%>
<img src="abc.gif">
<%
return "1";
}

----------------------------------错误提示如下:
Note: sun.tools.javac.Main has been deprecated.
/test2.jsp:3: '}' expected.
public String lilili() throws Exception{
^
/test2.jsp:7: Statement expected.
public void
^
/test2.jsp:11: 'try' without 'catch' or 'finally'.
pageContext.write(_jsp_string1, 0, _jsp_string1.length);
^
c:\wwwroot\test.jsp:7: Type expected.
} catch (java.lang.Throwable _jsp_e) {
^
4 errors, 1 warning
---------------------------------我想实现这样的功能的话有什么好的方法吗?
...全文
31 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Geranium 2003-09-12
  • 打赏
  • 举报
回复
你的test2.jsp和test.jsp里有几个错误。
Geranium 2003-09-12
  • 打赏
  • 举报
回复
<%! 》》》》》》》》》》》》》》》》》 <%
String ttt="ttt";
public String lilili() throws Exception{
//我想在这里嵌入HTML 却提示出错~
%>
你其他还有不少出错的地方呢
ejbcreate 2003-09-12
  • 打赏
  • 举报
回复
<%@ include file=b.jsp%>
-->
<%@ include file="b.jsp" %>

建议你贴代码。
junyi2003 2003-09-12
  • 打赏
  • 举报
回复
你不觉得你的b.jsp代码有问题吗?

初学者很容易漏括号等等。建议先打上括号。养成好的编程习惯。
dmhorse 2003-09-12
  • 打赏
  • 举报
回复
Not accept your desgin
dooluby 2003-09-12
  • 打赏
  • 举报
回复
在你想嵌入的地方用out.print("HTML代码");

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧