JSP packages

R

Roedy Green

I have been digging around trying to find out how you specify the
package for JSP code. I can't seem to find any tag. You would think
there would be one since Servlets come in packages. Have I just
overlooked it or do they all live in the default package?
 
K

kaeli

look- said:
I have been digging around trying to find out how you specify the
package for JSP code. I can't seem to find any tag. You would think
there would be one since Servlets come in packages. Have I just
overlooked it or do they all live in the default package?

You can do that if you precompile to a servlet and then add it to the
servlet. The point of JSP is to make such things as packages
transparent, so few users will want to do such a thing anyway.
I believe the server (weblogic, tomcat, etc) usually makes a package for
you - it is NOT the default package, IIUC.

There IS the "extends" attribute of the page directive, but it is
recommended to use it with 'extreme caution'.
----------------------------
<%@page extends="package.class" %>
This indicates the superclass of servlet that will be generated. Use
this with extreme caution, since the server may be using a custom
superclass already.
----------------------------


--
--
~kaeli~
I can't sleep.
The clowns might eat me.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
N

Neill

Roedy Green said:
I have been digging around trying to find out how you specify the
package for JSP code. I can't seem to find any tag. You would think
there would be one since Servlets come in packages. Have I just
overlooked it or do they all live in the default package?

You don't have to specify the package, just place them in a directory. For
security, you can place them in a subdir of WEB-INF and call them using
RequestDispatcher.forward();

Here's a link to some best practices articles,
http://www-106.ibm.com/developerwor...&view_by=Search&search_by=JSP+best+practices:


Neill Laney
http://www.laneyconsulting.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top