Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSP Expression Language get parameter

Tags:

java

jsp

el

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?

like image 933
Victor2748 Avatar asked Nov 05 '14 00:11

Victor2748


People also ask

What is JSP Expression Language?

JSP Expression Language (EL) makes it possible to easily access application data stored in JavaBeans components. JSP EL allows you to create expressions both (a) arithmetic and (b) logical.

What is getParameter () method?

getParameter() is the method in request object, which returns String value always. So convert that string output to Integer [ line number 21] Integer.

What is getParameter () method explain with example?

getParameter is a function name in JSP which is used to retrieve data from an HTML/JSP page and passed into the JSP page. The function is designated as getParameter() function. This is a client-side data retrieval process. The full function can be written as request. getParameter().


2 Answers

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

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

like image 185
CE ZHANG Avatar answered Sep 18 '22 09:09

CE ZHANG


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
like image 23
Santhosh Avatar answered Sep 17 '22 09:09

Santhosh