在 Java bean 类中设置属性
我创建了一个文本字段名称“empId”,其值通过 jsp 页面使用
标签设置为 bean 类
note:empId 为 int 输入 bean class
当我编写以下代码时
<jsp:setProperty name="mybean" property="empId" value="empId"/>
它会正常工作 但是当我编写以下代码
<jsp:setProperty name="mybean" property="empId" value="<%=request.getParameter("empId")%>"/>
时它不起作用 给出异常 JasperException
I have created a from which have a text field name 'empId' whose value is set into a bean class through a jsp page using <jsp:setProperty>
tag
note:empId is of int type in bean class
when i write the following code
<jsp:setProperty name="mybean" property="empId" value="empId"/>
It will work fine
but when i write the following code
<jsp:setProperty name="mybean" property="empId" value="<%=request.getParameter("empId")%>"/>
then it is not working
gives the exception JasperException
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
EL
表达式。如果要映射请求参数,请使用
${param.empId}
。PS:@Sheo 你必须显示异常堆栈跟踪。
Use
EL
expression.use
${param.empId}
if you want to map request parameter.<jsp:setProperty name="mybean" property="empId" value="${param.empId}
"/>PS: @Sheo you have to show exception stack trace.
希望它有效:)
........./
Hope it works :)
........../