Nithya Venkatraman

Ranch Hand
+ Follow
since Apr 11, 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 Nithya Venkatraman

Hi

I am not able to access the id. It says Username and password do not match. Please help.. my email is nithyavenkatraman@yahoo.com

TIA
Nithya
Hi

Sorry for a delayed reply...
I wrote the exam in India - Hyderabad. I got some Drag and Drop Questions. But they worked fine. No issues. Its better to go thru the API. Know the methods available in important classes and interfaces.


Nithya
16 years ago
Hi all,
I got thru SCWCD 1.4 with 88% today. Thanks to all the ranchers.
I read only HFS and the Servlet API.
It was great book.
I got some questions on topics not covered in the book.


Thanks Again

Nithya
16 years ago
Thanks a lot...

I am just going thru the explanation by Kathy...


Thanks

Nithya
Abstract class - Person

package myclasses;

public abstract class Person{
private String name ;

public Person(){
System.out.println("Person Constructor");
}

public void setName(String name){
this.name= name ;
}

public String getName(){
return name;
}
}


Concrete subclass - Employee

package myclasses;

public class Employee extends Person{
private int empId;

public Employee(){
System.out.println("Employee Constructor");
}

public void setEmpId(int empId){
this.empId = empId;
}

public int getEmpId(){
return empId;
}
}


Servlet - EmployeeServlet

package myclasses;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class EmployeeServlet extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException{
Employee e =new Employee();
req.setAttribute("employee", e);
RequestDispatcher rd = getServletContext().getRequestDispatcher("/EmployeeJsp.jsp");
rd.forward(req,res);
}
}



The JSP thats called EmployeeJsp
<html>
<body>
Testing the forwarded page
<jsp:useBean id="employee" type="myclasses.Person" scope="request"/>
<jsp:setProperty name="employee" property="name" value="Nithya"/>
<jsp:setProperty name="employee" property="empId" value="1"/>
The name is ${employee.name}
The empId is ${employee.empId}
</body>
</html>

My web.xml has:
<servlet>
<servlet-name>MyEmployee</servlet-name>
<servlet-class>myclasses.EmployeeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyEmployee</servlet-name>
<url-pattern>/MyServlet.do</url-pattern>
</servlet-mapping>


When i type http://localhost:8080/mywebapp/MyServlet.do, I get the following output

Testing the forwarded page The name is Nithya The empId is 1

As per the book and other resources we should get an error because:
If only the type is given for an existing bean, then only the types properties can be set and not that of concrete class.
But the jsp does not throw any error.


Why so??
Hi

This is my tag handler class:
package myclasses;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.*;
import java.io.*;

public class SimpleTag1 extends SimpleTagSupport{
public void doTag() throws IOException{
getJspContext().getOut().print("Hi This is a Simple Tag example");
}
}


When I try to compile the .java class I am getting the foll: errors:
SimpleTag1.java:6: cannot resolve symbol
symbol : class SimpleTagSupport
location: class myclasses.SimpleTag1
public class SimpleTag1 extends SimpleTagSupport{
^
SimpleTag1.java:8: cannot resolve symbol
symbol : method getJspContext ()
location: class myclasses.SimpleTag1
getJspContext().getOut().print("Hi This is a Simple Tag example"
);
^
2 errors

Why am I getting this error?
16 years ago
JSP
Hi

This is my tag handler class:
package myclasses;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.*;
import java.io.*;

public class SimpleTag1 extends SimpleTagSupport{
public void doTag() throws IOException{
getJspContext().getOut().print("Hi This is a Simple Tag example");
}
}


When I try to compile the .java class I am getting the foll: errors:
SimpleTag1.java:6: cannot resolve symbol
symbol : class SimpleTagSupport
location: class myclasses.SimpleTag1
public class SimpleTag1 extends SimpleTagSupport{
^
SimpleTag1.java:8: cannot resolve symbol
symbol : method getJspContext ()
location: class myclasses.SimpleTag1
getJspContext().getOut().print("Hi This is a Simple Tag example"
);
^
2 errors

Why am I getting this error?
Hi

I found the issue. There are 2 standard.jar files. One is 500K and the other 287K. I had initially copied the 500K stuff. After replacing it with 287K, its working fine.


Thanks,
Nithya
Hi

I tried that also. But I am still getting the same error.
Please help


Nithya
Hi,

I am trying to use JSTL in my JSP.
My class is like this:
package myclasses;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class MyJstl extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{
String[] music = {"1","2","3","4","5"};
req.setAttribute("music",music);
RequestDispatcher rd = getServletContext().getRequestDispatcher("/MyJstlJsp.jsp");
rd.forward(req,res);
}
}

And Jsp is
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html><body>
<c:forEach var=arr items=${music} scope="session">
<tr>
<td>
${arr}
</td>
</tr>
</c:forEach>
</body></html>

And DD is like this:
<servlet>
<servlet-name>MyJstl</servlet-name>
<servlet-class>myclasses.MyJstl</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>MyJstl</servlet-name>
<url-pattern>/MyJstl.do</url-pattern>
</servlet-mapping>

But when i Try to call the Servlet with servletcontext/MyJstl.do
I get the error:
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:365)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:151)
at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:351)
at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:171)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:455)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:516)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1564)
at org.apache.jasper.compiler.Parser.parse(Parser.java:173)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:251)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:152)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:139)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:250)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:444)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:300)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:288)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:756)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:524)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:452)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:361)
at myclasses.MyJstl.doGet(MyJstl.java:11)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:288)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:562)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:930)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:183)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:562)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:930)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2735)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:177)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:562)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:930)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:562)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:930)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:203)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:637)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:463)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:568)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:631)
at java.lang.Thread.run(Thread.java:536)


I have already added the jstl.jar inside the lib folder under WEB-INF.
Please help
Hi,

I am also having a problem with this Question.
1,2 & 3 are not working for me, but the Book says 3rd one is correct. Can someone clearly explain this please?


Thanks,
Nithya
Hi.. Good Score.. I am also planning to take my WCD this month.. Can u give ur prep strategy... Like how many days of prep, how many hours each day, mock exams apart from whats in HFS...


TIA
Nithya Venkatraman
Hi..

Even I am getting the same error.. I just tried out that example.
I have the DiceRoller class in WEB-INF/classes/ch1/
And have given the function-class in tld as ch1.DiceRoller
But I get that error..

Please help
Hi

I am planning to take SCWCD next month. How good is the SCWCD exam simulator? Is it worth purchasing it? Please lemme know.


TIA
Nithya