Java J2EE

Posted by : Johan
Difference between get parameter value
Hi,

I am new to jsp so maybe my question is stupid. But what is the
difference between

${param.parametername}

and

<%= request.getParameter("parametername") %>

to get the value of the parameter

regards

Johan

 
 
Posted by : Justin Hogg
Re : Difference between get parameter value
Hi Johan,

There is no real difference in functionality.

${param.parametername} uses the expression language syntax (EL) and is generally prefered for JSP's.

<%= request.getParameter("parametername") %> is an expression and bad practice.

Although both will work and ok for a 'home' project, most corporate coding standards stipulate that any Java syntax in JSP's is a no-no as it is harder to read and maintain (especially for non Java web designers/authors).

Please have a look at the following as it explains in more detail:

http://java.sun.com/developer/EJTechTips/2004/tt0126.html

 
 
If you have the better reply, then send it to us. We will display your reply after the approval.
Name : 
Email Id :   
Reply :