I have two doubts...
1) In the code snippet shown in page 384 of HF, to get the request method,
it has been shown like pageContext.request.method which when called using a
JSP shows like GET or POST. If i want to get a
servlet initialization parameter from config, i used like pageContext.config.ininParam but the code threw error saying.. there is no property as config in
tomcat 5.5.9. Where can i see the property like request in pageContext.request.method. I couldn't find that under javax.servlet.http.jsp. How can i get the init parameter for a jsp using config? Is that container implemented?
2) In the bullet points in page 414 of HF, the last but one shows that when jsp:useBean is used
along with jsp:setProperty only properties on type can only be set not the
property on class. Listed below are the classes
//Person.java
package com.utils;
public abstract class Person{
private
String name;
public abstract void setName(String name);
public abstract String getName();
}
//Employee.java
package com.utils;
public class Employee extends Person{
public Employee(){}
private String name;
private int empID;
private int age;
public void setName(String name)
{this.name=name;}
public void setEmpID(int id)
{this.empID=id;}
public String getName()
{return name;}
public int getEmpID()
{return empID;}
public void setAge(int age)
{this.age=age;}
public int getAge()
{return age;}
//The jsp with form
<form name="reqparamserv" method="Post" action="JSPStandardAct2.jsp">
Name: <input type="text" name="name" />
Employee ID:<input type="text" name="empID" />
<input type="submit" name="go" value="GO" />
</form>
//The jsp that sets the property
<html>
<body>
<jsp:useBean id="person" type="com.utils.Person" class="com.utils.Employee" scope="request" >
<jsp:setProperty name="person" property="name" param="name" />
<jsp:setProperty name="person" property="empID" param="empID" />
</jsp:useBean>
Person's name from servlet is:
<jsp:getProperty name="person" property="name" />
<br>
Person's ID from servlet is:
<jsp:getProperty name="person" property="empID" />
</body>
</html>
This page shows whatever i enter in the form like name and empID. I should be able to set the name only.
Pls. clarify. Thanks.
SAM
[ November 06, 2005: Message edited by: Kuppusamy Venkatasubramanian ]