JSP Expression Language get parameter

纵饮孤独 提交于 2019-12-17 16:44:35

问题


I am trying to get a String parameter "username" from the request with Expression Language. I've done some research, but couldn't find a way to do so, I would like something similar to ${pageContext.request.parameter.username}

How get a specific request parameter, using only expression language?


回答1:


If get an attribute from 'session', try this ${username}.

If get an parameter from 'request', try this ${param.username}.




回答2:


The syntax to get the attributes from session would be,

${sessionScope[name]}

And for the request attributes , you can use

${param[name]}

For more info,

  • Examples of EL expressions
  • Java ee tutorial


来源:https://stackoverflow.com/questions/26747831/jsp-expression-language-get-parameter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!