Guido Schoepp

Greenhorn
+ Follow
since Oct 14, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Guido Schoepp

Originally posted by William Brogden:
After a session has been invalidated, it is effectively killed since it can't be used in any way ...



With one exception: you may call session.getServletContext() on an invalidated session object. You have to know this for the SCWCD exam... ;-)

Guido
15 years ago
JSP

Originally posted by pingkan paula:
webapp\examples\WEB_INF



It is not WEB_INF but WEB-INF.

Guido
15 years ago

Q2. Is the method getPreviousOut() equivalent to calling getBodyContent().getEnclosingWriter()?



This is exactly what's the reference implementation does:


Q1. As per the convention, the writer should be obtained using the tag handler's getPreviousOut()method. Why is this so ? The BodyTagSupport already has the access to the pageContext object which can be used to obtain the out writer. Can't we write the contents of body using this writer?



I assume this is because a tag implementation could return another JspWriter (e.g. for processing nested tags), which is not identical to the JspWriter object of the pageContext variable.

Guido

Originally posted by Jack Lau:
One session represent to one client (e.g.browser) or one machine(e.g. many browsers) ?



A session represents a client - not an ip address (machine). It is possible to have opened several browser windows, each working with a different session.

Guido

Originally posted by pingkan paula:
I've been developing application in cell-phone that can access the back-end database by using JSP as the middleware.
I have download open-source xml parser and place the jar file in common\lib and classes in common\endorsed.
When i run the jsp program ,the errors pointed that the xml parser package not exist.
Until now ,my application in cell-phone still failed to make a connection to jsp programs which i put in webapp\examples.



Placing the jar file in common\lib should work. But you should put jar and class files belonging to your app in your app's WEB-INF directory:
%TOMCAT_HOME%\webapps\examples\WEB-INF\lib and %TOMCAT_HOME%\webapps\examples\WEB-INF\classes

Maybe your open source xml parser depends on other packages.

Guido
15 years ago
Do you have your JAVA_HOME environment variable set?

Guido
15 years ago
I bought the ePractice exam from Sun. The good thing is that they are touching some details which aren't included in the HFS book. The bad thing is that they have errors in their questions. In one (of the three) exam I discovered 5 mistakes/typos.

Guido

Originally posted by Peixiao Lin:
my tomcat version is 5.0.29, and I can not find context element in server.xml. what I can do if I want to define my own prefix?



You can add <context> elements in server.xml below e.g. <host>:

...or you can add a context by using the admin app:
http://localhost:8080/admin/

Guido

Originally posted by Srinivasan Madhavan:
Can anyone throw light as to where in TOMCAT, it is specified that the default web-app is the ROOT directory? For instance in Weblogic6.1 it is the "config" file in C:\bea\wlserver6.1\config\mydomain.



One way to configure this is the server.xml file by adding an appropriate context for the host:
<Context path="/" docBase="C:\Tomcat 5.0\webapps\WHATEVER" ... />

Guido

Originally posted by David Jones:
A question not related with the Exam but I want to know is Tomcat support multi-CPUs? If yes, how to make Tomcat support multi-CPUs?



AFAIK it's a matter of the JVM to support multiple CPUs - not a matter of the program running in the JVM.

Guido

Originally posted by Sami Sayeed:

This is the second jsp
<%@taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c"%>

<%
java.util.Map map = new java.util.HashMap();
%>

<c:set target="${map}" property="dog" value="tom"/>// iam trying to use el to refer the map
// throws the following error
javax.servlet.ServletException
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:795)
org.apache.jsp.testsettarget_jsp._jspService(testsettarget_jsp.java:74)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
<a href="testset.jsp">click</a>
${map.dog}

<%=map.get("dog")%>



Mixing of JSP scripting and EL is not a good idea.
<c:set> takes the value out of the PageContext object. But your declaration in the script (java.util.Map map = ...) doesn't make the map accessible for PageContext.

Try to use <jsp:useBean id="map" class="java.util.HashMap"/> instead of <% java.util.Map map = ...%>

Guido

Originally posted by Sami Sayeed:

the page 448 describes how to use c:remove tag,
it states that the scope if not mentioned in the <c:remove var="blah"/> resolves to page scope.
[...]
<c:remove var="user"/>// the c:remove tag removes the user variable created under session scope even without me mentioning the scope...



You're right - the book is wrong.

The JSTL specs say: "If attribute scope is not specified, the scoped variable is removed according to the semantics of PageContext.removeAttribute(varName)."

And the API docs for JspContext.removeAttribut(String) say: "Remove the object reference associated with the given name from all scopes."

Guido

Originally posted by Eldo Zacharia:
set classpath=C:\j2sdk1.4.0\jre\lib\rt.jar;.;C:\Program Files\Tomcat\common\lib\servlet.jar;.;C:\struts\jakarta-struts-1.1-b2\lib\struts.jar;.;C:\Program Files\Tomcat\webapps\MiniHr\WEB-INF\classes;.;C:\j2sdk1.4.0\bin;;



I really don't know if the CLASSPATH is case sensitive in Windows but try it:
set CLASSPATH=%CLASSPATH%;%cp%

Otherwise try to set the classpath by parameter of javac:
javac -classpath %classpath% -d ..\..\..\classes *.java

Guido

...and use struts 1.2.4 instead of 1.1-b2...
15 years ago

Originally posted by Eldo Zacharia:
set cp = C:\Program Files\Tomcat\webapps\MiniHr\WEB-INF\lib\struts.jar
set cp =%cp%;C:\Program Files\Tomcat\common\lib\servlet.jar
set classpath=%classpath%;cp



Try this:
set classpath=%classpath%;%cp%

Guido
15 years ago
Answer F (question 18 on pg. 567) refers to the implementation of the tag file. The spec says for tag files: "For each invocation to the tag, the JSP Context Wrapper must present a clean page scope containing no initial elements." This page scope is referring to the tag file itself.

The "bang" box on page 494 refers to the usage of the tag in another JSP. Look at the sample in the book:
<myTags:header subTitle="..."/>
${subTitle} //This won't work! The attribute is out of scope

Guido