http://www.shinco.net/jjx/activeubb
一、 JSP 技术概述
作 者 : 仙人掌工作室
在 Sun 正式发布 JSP(JavaServer Pages) 之后,这种新的
Web 应用开发技术很快引起了人们的关注。 JSP 为创建高度动态的
Web 应用提供了一个独特的开发环境。按照 Sun 的说法, JSP 能够
适应市场上包括 Apache WebServer 、 IIS4.0 在内的 85% 的服务
器产品。即使您对 ASP “一往情深”,我们认为,关注 JSP 的发展
仍旧很有必要。
㈠ JSP 与 ASP 的简单比较
JSP 与 Microsoft 的 ASP 技术非常相似。两者都提供在 HTML
代码中混合某种程序代码、由语言引擎解释执行程序代码的能力。在
ASP 或 JSP 环境下, HTML 代码主要负责描述信息的显示样式,而
程序代码则用来描述处理逻辑。普通的 HTML 页面只依赖于 Web 服
务器,而 ASP 和 JSP 页面需要附加的语言引擎分析和执行程序代码
。程序代码的执行结果被重新嵌入到 HTML 代码中,然后一起发送给
浏
I have a login.jsp page and it directs to welcome.jsp page. Inside welcome.jsp
page, it has one link to call struts action and another link to call another
jsp. All jsp and struts are running within the same browser.
However, I debug and find struts one always creates a new session, because I
print out its session id and the id is different from the one in welcome.jsp.
The jsp one still keeps the same session (session id). Weird to me. I am using
tomcat 5.5.17.
Any idea about where I should chec
或者tomcat的CLASSPATH应该怎么设?
An error occurred at line: 1 in the jsp file: /jsp/GetName.jsp
Generated servlet error:
/.../jsp/GetName$jsp.java:56: Class org.apache.jsp.UserData not found.
UserData user = null;
^
Here I defined a class UserData. Where should I put it to? I just installed
a new tomcat 4.0.3. I haven't changed any path yet.
请大虾们指教! 多谢了.
Yeah. Nowadays, mostly, web layer with jave technology would be java +
jstl(part of jsp). I rarely use embedded java code in jsp like what most old
jsp books would show. No serious programmer will use jsp with lots of
embedded java code. So not really a good starting point at all.
JSPs are all translated into sevlets automatically by jsp container (tomcat/
jetty/google app engine) first. Then those generated sevlets are run along
with the sevlets you write by hand.
Here is my jsp file and I defined Login.java class under WEB-INF/classes/
users. But when I compile it, I get the error:
The value for the useBean class attribute users.Login is invalid.
What is wrong? Please help me. Here is my jsp code:
<%@ page import="java.util.*" %>
Java Server Pages for the ASP Developer
JSP (Java Server Pages) is similar to ASP, the difference
being that the code embedded between the <% and %> tags in
JSP is exclusively Java. According to Sun Microsystems, JSP
works with 85% of the market including Apache WebServer,
NetscapeTM, and Microsoft IIS 4.0 (with required pluggins
from IBM's WebSphere, LiveSoftware's JRun or New Atlanta's
ServletExec).
JSP does require plug-ins on IIS, so there aren't too many
ASP developers running to the JSP ar
Jbuilder
server
This is a design concern, what I will do is, using whatever html web designer
to code html, and then include the html file by include directive in jsp, code
in this way so you do not have to modify the jsp file if there is any change
in you html code, however, if you must mix html and jsp code together, just
copy the related part into jsp file and use include or forward if necessary.
Tags can be of two types: external tag library, or predefined tags.
Predefined tags start with jsp: characters
J2EE Tutorial 里面接二连三的冒出下面的东西,
jsp:element,
jsp:root,
jsp:output
jsp:attribute
请问到哪里找关于这些Predefined tags 的 reference 文档?
Ok, thx.
I got the following from http://www.techinterviews.com/?p=92 , but honestly, I don't quite understand the explanation. In particular, is a translation unit necessarily related to jsp include?
What is a translation unit? JSP page can include the contents of other HTML
pages or other JSP files. This is done by using the include directive. When
the JSP engine is presented with such a JSP page it is converted to one
servlet class and this is called a translation unit, Things to remember in
当session timeout时,跳到timeout.jsp,并提供Click Here to login again
连接返回login.jsp,并能成功登陆。问题是,如果用户click IE的Refresh button,页面
同样返回login.jsp,但此时登陆,仍然返回timeout.jsp,登陆不成功,
不知道有没有人遇到类似情况,是否可以在web.xml什么的设置redirect
的target?(Tomcat 4.1)
have
part
Yes, all JSP pages are converted into Servlet, right?
How about this, does a single JSP page without any include elements
constitute a translation unit?
How many translation units are there if a JSP page has one dynamic include?
How many translation units are there if a JSP page has one static include?
Maybe answers to these questions will crack the mystery.
Guys, I'm playing with Spring 3.0 but this little jsp keeps getting an error
that I could not figure out:
<%@ page import="com.mcnz.spring.*, org.springframework.context.*, org.
springframework.web.context.support.*"
contentType="text/html; %>
<%
ApplicationContext beanFactory = WebApplicationContextUtils.
getRequiredWebApplicationContext(getServletContext());
ClickCounter counter = (ClickCounter)beanFactory.getBean("clickCounter",
ClickCounter.class);
String clickedButton = request.getParameter... 阅读全帖
Thx man, in .jsp, the system return me the java-class-path is
{Tomcat_Home}/lib/tomcat.jar, instead of mm.mysql.jar in the same directoy.
Also, in profile , i set classpath to {Tomcat_Home}/lib/ and to
{Tomcat_Home}/lib/mm.mysql.jar, but not {Tomcat_Home}/lib/tomcat.jar.
And when i try this statement in .java file, it returns all paths which i set
in profile's classpath.
Again, when i move the driver to {my-jsp-home}/WEB-INF/lib/, which makes .jsp
link mysql working well as .java does, the syste
For your reference, JSP is compiled to servlet before
running. However, it's supposed to be in presentation tier
in J2EE structure. You'd better put your logic in an servlet
for C/S or EJB if it's 3 tiers.
In a work applet+JSP works, better not put logic in JSP.
Here is another argument on Swing GUI vs JSP Web Solution.
We have lots of client application made by Swing GUI. In order to support both
Unix and window, we have to save our jar to different location though they are
the same. We are thinking about if we should move to JSP/Servlet web solution
so that we only maintain one copy in one location. But I am not very strong on
web solution. I wonder if JSP/Servlet+JavaScript can fully implement Swing GUI
very well, like those listener, thread ...
Than
well then it's not JSP problem, rather javac. nowadays nobody write
that kind big source file anyway. try break your JSP into subpages, and
use dynamic includes.
that being said, JSP IS rubbish, I agree, for a handful reasons.
I have been annoyed by several hundred warning messages generated by
Eclipse (3.2.2) WTP (1.5.3, Dynamic Web Project). There are two major sets
of warnings, one for JSP tag files ("Unknown tag") and the other for "EL
Syntax Error".
My project structure is:
/
|- src (for all java source files, including servlets)
|- web
|- images
|- scripts
|- styles
|- ...
|- resources (JSP files for serving AJAX calls)
|- services (JSP files)
|- ...
|- WEB-INF
|- classes
Well, from the quote you posted,
"When the JSP engine is presented with such a JSP page it is converted to
one servlet class and this is called a translation unit, ..."
I guess that's what a translation unit is. 8-)
If I understand it correctly, what it's trying to say is that when you have
static includes, they are dealt with at translation time, hence become part
of the same translation unit formed by the jsp including them.
Don't know whether the concept makes sense with request-time includes
I would think so. The criteria is pretty clear - whatever gets compiled into
one servlet is one unit. So any single jsp, as long as it's not included by
another (i.e. not a jsp fragment), it's a translation unit.
Dynamic includes get "included" at request-time, so they don't have to do
with translation at all.
Still one, I would think. A spec compliant jsp compiler would include the
fragment verbatim, and then do the compilation.
Well... you could say that, and nobody can say you are wrong, but there is
the subtle point that a dynamic include can in fact be including the
response of any URL, which isn't necessarily a JSP, or, in turn, a "
translation unit" at all.
In fact, we all need to be a little careful with the terms "static" and "
dynamic" here. There is the "static vs. dynamic" as in "a static html page
vs. a dynamic jsp", and then there is the "translation-time vs. request-time
" as in "a jsp gets translated int
o. Not about the fixing of the compilation.
We have group of site designers they only develops JSP pages but
knows little about java.
What they complain is that when they wrote JSP, they could not have any clue
where is the JSP is wrong, they want to see the error message on their
browser.
they have no clue about what is printed to the tomcat console...
I have some form handling code. The form posts to the
current URL.
So I have these two lines at the early part of the JSP file:
...
But I always get complaint from eclipse at "%>" for
the code below:
Multiple annotations found at this line:
- Syntax error, insert ")" to complete Expression
- Syntax