<html:text/>标签如何得到sesion中的对象属性? ( 积分: 50 )

F

ff_ff

Unregistered / Unconfirmed
GUEST, unregistred user!
我想实现
编辑单位信息的功能.
在action中把用户信息类bur放入到session中
UBureauDAO burDao = UBureauDAO
.getFromApplicationContext(new ClassPathXmlApplicationContext(
&quot;classpath*:applicationContext.xml&quot;));
UBureau bur = burDao.findById(Integer.parseInt(bureauId));
/*
* 放入request中
*/
session.setAttribute(&quot;bur&quot;, bur);
跳转到编辑页面editBur.jsp
在这里想把单位信息显示在文本框中.
单位名称: <html:text property=&quot;burName&quot;
value=&quot;<bean:write name=&quot;bur&quot;
property=&quot;bureauName&quot;
/>&quot;
/>
<html:errors property=&quot;burName&quot;
/>
报错.
小弟对struts标签不熟悉.
请高手指点一下.
热心朋友也可
qq:258268936
联系。
 
标签不能含有另一个标签。<html:text><bean:write>都是标签,肯定会报错的
<html:text property=&quot;burName&quot;
value=&quot;<bean:write name=&quot;bur&quot;
property=&quot;bureauName&quot;
/>&quot;
/>
搂主这样写看看
<%
String burName=(String)session.getAttribute(&quot;burName&quot;);
%>
<html:text property=&quot;burName&quot;
value=&quot;<%=burName%>&quot;
/>
 
这样写jsp中加杂java代码,符合规范吗?
你是怎么实现编辑单位信息这样的功能的。
 
标签能不能含有另一个标签,这个要看struts的版本,你可以用&quot;和'进行匹配
<html:text property=&quot;burName&quot;
value=&quot;<bean:write name='bur' property='bureauName' />&quot;
/>
<html:errors property=&quot;burName&quot;
/>
测试一下,我以前用过,是可以的。
 
多人接受答案了。
 

Similar threads

顶部