Meaningless Drivel is fun!*
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
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between getParameter()