P
Przemek M. Zawada
Dear Friends,
Regarding to my last problems, I have few new problems, which I have no
idea how to manage them.
1. I've followed the NetBeans tutorial, which I've found here:
http://netbeans.org/kb/docs/javaee/ecommerce/intro.html (pretty nice
tutorial anyway - I recommend it!)
// I've build the website environment as described in the tutorial - all
works perfect!
2. I've created the *.jspf files including header and footer files as
described in tutorial, with web.xml annotations, as following:
<jsp-config>
<jsp-property-group>
<description>Header and footer settings.</description>
<url-pattern>/index.jsp</url-pattern>
<url-pattern>/WEB-INF/view/*</url-pattern>
<include-prelude>/WEB-INF/jspf/header.jspf</include-prelude>
<include-coda>/WEB-INF/jspf/footer.jspf</include-coda>
</jsp-property-group>
</jsp-config>
3. I've create a control servlet, named "UserControl", which is also
managed in the web.xml file:
<servlet>
<servlet-name>UserControl</servlet-name>
<servlet-class>User.UserControl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UserControl</servlet-name>
<url-pattern>/userBrowse</url-pattern>
</servlet-mapping>
(...)
4. The servlet is designed/created as tips suggested in the tutorial. In
the doGet() method, I've used suggested code:
String url = "/WEB-INF/view" + userPrefix + userPath + ".jsp";
try {
request.getRequestDispatcher(url).forward(request, response);
} catch (Exception ex) {
System.err.println("UserControl.doGet(): " + ex.getMessage());
}
Everything works fine, BUT I have problem. In example, each of sub-pages
should have dynamic elements - regarding to such schema:
[ ]
[ header.jspf ] (each time included, static)
[ ]
-------------------
[ included ]
[ page ] (non-static elements)
-------------------
[ ]
[ footer.jspf ] (each time included, static)
[ ]
What if, in the included page, I'd like to add dynamic elements (kind of
menu with subitems)?
Shall I use the <jsp:include/> with forwarded parameters (if required) ?
Shall I define and manage it somehow in the servlet-side part?
I would not like to copy&paste in each servlet-included jsp file my
different (sometimes) nor same (sometimes, too) menu elements. I'd like
to auto-manage it somehow.
What I was thinking is to generate each servlet (managing each of my
page-plugins) XML config file, which contains menu-tree, which is
parsed/displayed regarding to URL parameters (in range of servlet mappings).
Sorry if I'm still thinking in PHP-way, but I'm trying to do my best
Thank you for your help.
All the best,
Przemek M. Zawada
Regarding to my last problems, I have few new problems, which I have no
idea how to manage them.
1. I've followed the NetBeans tutorial, which I've found here:
http://netbeans.org/kb/docs/javaee/ecommerce/intro.html (pretty nice
tutorial anyway - I recommend it!)
// I've build the website environment as described in the tutorial - all
works perfect!
2. I've created the *.jspf files including header and footer files as
described in tutorial, with web.xml annotations, as following:
<jsp-config>
<jsp-property-group>
<description>Header and footer settings.</description>
<url-pattern>/index.jsp</url-pattern>
<url-pattern>/WEB-INF/view/*</url-pattern>
<include-prelude>/WEB-INF/jspf/header.jspf</include-prelude>
<include-coda>/WEB-INF/jspf/footer.jspf</include-coda>
</jsp-property-group>
</jsp-config>
3. I've create a control servlet, named "UserControl", which is also
managed in the web.xml file:
<servlet>
<servlet-name>UserControl</servlet-name>
<servlet-class>User.UserControl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UserControl</servlet-name>
<url-pattern>/userBrowse</url-pattern>
</servlet-mapping>
(...)
4. The servlet is designed/created as tips suggested in the tutorial. In
the doGet() method, I've used suggested code:
String url = "/WEB-INF/view" + userPrefix + userPath + ".jsp";
try {
request.getRequestDispatcher(url).forward(request, response);
} catch (Exception ex) {
System.err.println("UserControl.doGet(): " + ex.getMessage());
}
Everything works fine, BUT I have problem. In example, each of sub-pages
should have dynamic elements - regarding to such schema:
[ ]
[ header.jspf ] (each time included, static)
[ ]
-------------------
[ included ]
[ page ] (non-static elements)
-------------------
[ ]
[ footer.jspf ] (each time included, static)
[ ]
What if, in the included page, I'd like to add dynamic elements (kind of
menu with subitems)?
Shall I use the <jsp:include/> with forwarded parameters (if required) ?
Shall I define and manage it somehow in the servlet-side part?
I would not like to copy&paste in each servlet-included jsp file my
different (sometimes) nor same (sometimes, too) menu elements. I'd like
to auto-manage it somehow.
What I was thinking is to generate each servlet (managing each of my
page-plugins) XML config file, which contains menu-tree, which is
parsed/displayed regarding to URL parameters (in range of servlet mappings).
Sorry if I'm still thinking in PHP-way, but I'm trying to do my best
Thank you for your help.
All the best,
Przemek M. Zawada