This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes difference between getParameter() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "difference between getParameter()" Watch "difference between getParameter()" New topic
Author

difference between getParameter()

naveen jayant
Greenhorn

Joined: Jun 11, 2007
Posts: 6
hi i could not understand the difference between the following statement
both produce same result

<%=request.getParameter("email")%>
<%out.print(request.getParameter("email"))
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The first (which is called a JSP expression) is shorthand for the second.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Fabian Gutierrez
Greenhorn

Joined: Aug 15, 2004
Posts: 22
Thats right,

this is an expresion
<%=request.getParameter("email")%>

this is a scriplet
<%out.print(request.getParameter("email"))

basically you can use both, however the idea of JSP 2.0 is that you avoid those and instead use EL, for example:

${param.email}

regards,


SCJP 1.4, SCWCD 1.4, SCBCD 5, SCJD 5
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Also, I think it's worth pointing out that, in JSP 2.0 neither should be used.
They are both part of the scriptlet syntax.

In JSP 2.0 MVC architecture, JSTL (JavaServer Pages" Standard Tag Library), and EL (Expression Language) have replaced the need for scriptlets altogether.
 
jQuery in Action, 2nd edition
 
subject: difference between getParameter()