Re: JSP Web-Development [newbie]
On 28-07-2010 14:54, pmz wrote:
On 28 Lip, 20:37, Chris Riesbeck<Chris.Riesb...@gmail.com> wrote:
On 7/28/2010 12:31 PM, pmz wrote:
1. At the beginning I'd like to apologize you for any mistakes or
misunderstood's, which might occur in message below, but I'm a quite
beginner in JSP so maybe some of my problems aren't really problems ;)
My Java knowledge is intermediate, but the structures of JSP or JSF or
any other frameworks is pretty bad, but I do not have any idea how to
start.
Personally, I prefer JSTL over straight JSP, to reduce jumping back and
forth between HTML and Java syntax. So iteration over a collection is
<ul>
<c:forEach var="item" items="${myObj.thingies}">
<li><c:out value="${item}" /></li>
</c:forEach>
</ul>
instead of
<ul>
<% for (Object item : myObj.getThingies()) { %>
<li><%= item %></li>
<% }<%>
</ul>
With more nesting, those separated braces get annoying fast.
That's true and I think I'll try using those, too. My question is,
shall I make any changes in environment of NetBeans to use JSTL? File
extensions? Additional libraries? But okay, if it's obvious and I'll
find it by googling for it, ignore my questions.
Maybe your servlet container comes with JSTL support.
Otherwise you can download an implementation like:
http://tomcat.apache.org/taglibs/standard/
and put the two jar files in WEB-INF/lib.
Then you need to put taglib definitions in top of your JSP pages.
Like:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
The base idea is: Let's say I have few packages which contain database
access, data management and some others, which are pure Java objects,
without any HTML stuff. What I want to achieve, is to work over the
data I fetch or I submit in JSP pages.
I'd like to have ONE default JSP page (which obviously contains a
webpage main layout - styles, scripts, tables, images, etc.). In few
places I have some dynamical stuff (such as parameter-regarded menu
display or also parameter-regarded body display).
Shall I use you<c:choose/> method for further inclusion of required
jsp-sub-pages?
You should use a servlet for that.
JSP page = View
Servlet = Control
Arne