这里的写法是错误的。<html:text property="burName" value="<bean:write name="bur" property="bureauName" />" />标签中,是不能含有另一个标签的。
<html:text>是个标签。 <bean:write>也是个标签。
所以,这样用的话,编译JSP的时候会出错。楼主可以试一下,把上面改写成:
<%
String burName=(String)session.getAttribute("burName");
%>
<html:text property="burName" value="<%=burName%>" />应该是可以的。
但是在某些情况下,<%= %>也不能包含在自定义标签中,例如FCKEditor的<fck:editor>标签就不行。有一种情况是肯定可以的:就是,基本的HTML标签中,都可以插入JSP标签,呵呵
<html:text>是个标签。 <bean:write>也是个标签。
所以,这样用的话,编译JSP的时候会出错。楼主可以试一下,把上面改写成:
<%
String burName=(String)session.getAttribute("burName");
%>
<html:text property="burName" value="<%=burName%>" />应该是可以的。
但是在某些情况下,<%= %>也不能包含在自定义标签中,例如FCKEditor的<fck:editor>标签就不行。有一种情况是肯定可以的:就是,基本的HTML标签中,都可以插入JSP标签,呵呵
解决方案 »
- JSP页面数据导出为excel
- Join ftech的异常 org.hibernate.hql.antlr.HqlBaseParser.recover
- hibernate中报错 表is not mapped
- 一句简单SQL的性能问题
- 散分,庆祝转向JAVA开发
- 关于 struts 标签中调用 onload 属性,谢谢
- struts2 表单数据封装问题
- 为什么filter拿不到request中的数据
- 高分求! IIS的FTP服务器,如果付权限可写,则匿名用户也可写;如果不可写,则操作员(Administrator)也不可写! 如何实现匿名用户只读
- 如何利用JDOM,把JTree中所有节点写入到一个XML文件中?最好有现成的例子。谢谢了。
- hibernate 的映射问题, 请高手指点下
- struts的validator框架在应用中的几个问题
例一:<logic:iterate id="cl" name="Ids"> //循环取得id
//比较beanname中的id是否和cl中的id相同,如果相同就显示cl中的name
<logic:equal name="beanname" property="id" value="<bean:write name="cl" property="id"/>">
<bean:write name="cl" property="name"/>
</logic:equal>
</logic:iterate>
紅色文字區就是錯誤的嵌套了,這樣是得不到想要的結果的,可改爲
<logic:iterate id="cl" name="Ids"> //循环取得id
<bean:define id="temId" name="cl" property="id" type="temId.toString()"/>
//比较beanname中的id是否和cl中的id相同,如果相同就显示cl中的name
<logic:equal name="beanname" property="id" value="<%=temId%>">
<bean:write name="cl" property="name"/>
</logic:equal>
</logic:iterate>
這樣先定義,后使用,就ok了。
例二:<html:submit value="<bean:message key="welcome.login" bundle="base"/>"/>
應該為
<html:submit>
<bean:message key = "welcome.logon" bundle = "base"/>
</html:submit>
-----------------------------------------------------
给你个参考..
但我有一个html:select标签.
如何设置html:select默认选某一项.jicken_woo先定義,后使用.学了一招.
request.setAttribute("bur", session.getAttribute("bur"));
就能够找到了<bean:write name="bur"/>
<html:text property="burName" value="${bur}" />
完事,不行你咬我
<logic:iterate id="burId" name="burs"
type="hibernate.UBureau"> <html:option value="我这里要填burs的property:burId">
<bean:write name="burId" property="bureauName" />
</html:option> </logic:iterate>
</logic:present>
****************************************************
<html:option value="">
value里想填burId,怎么做?
按你的意思,改成这样
<html:select property="burId">
<logic:present name="burs">
<logic:iterate id="id" name="burs"
type="hibernate.UBureau">
<bean:define id="temId" name="id" property="burId"
type="temId.toString()">
<html:option value="<%=temId %>">
<bean:write name="id" property="bureauName" />
</html:option>
</bean:define>
</logic:iterate>
</logic:present>
</html:select>出错.
org.apache.jasper.JasperException: Unable to compile class for JSPGenerated servlet error:
Syntax error, insert ";" to complete Statement很奇怪额.