如何在 JSP 中不使用 scriptlet 读取附件消息?
我想知道如何在 JSP 中不使用 scriplet 来读取附件消息?通过使用 servlet 中的 request 对象获取 Message 对象作为属性后,如何在不使用 scriplet 的情况下确认 Message 内容是否是 Multipart 的实例:
if(message.getContent() instanceOf Multipart)
How can I read the content of any file by using EL in JSP?因为我在 inputStream 子类中看不到任何 getRead 方法。
I want to know how can I read attachment messages without using scriplets in JSP? After getting Message object as an attribute by using request object from servlets, how can I confirm whether Message content is an instance of Multipart or not without using scriplets like:
if(message.getContent() instanceOf Multipart)
How can I read the content of any file by using EL in JSP? As I can't see any getRead method in inputStream subclass.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
自己将这些 getter 添加到
Message
类中:这样您就可以在 JSTL/EL 中使用它:
Add those getters to the
Message
class yourself:This way you can use it in JSTL/EL:
也在 servlet 中执行此逻辑,并且仅“发送”将用于呈现给 jsp 的数据。在本例中发送:
boolean
指示附件列表中Perform this logic in the servlet as well, and "send" only data that will be used for presentation to the jsp. In this case send:
boolean
indicating whether there are attachments