File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes jsp:getProperty Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "jsp:getProperty" Watch "jsp:getProperty" New topic


mysha ahamed

Joined: Aug 03, 2005
Posts: 22
I have dbt in action tags..I have an html whose parameter values iam setting in jave bean in a servlet code.Iam retrieving the bean values again
in a jsp..
<form action="PersonServleturi" method="post">
<b>Enter ur name : <input type="text" name="name" /><br>
<b>Enter ur city : <input type="text" name="city" /><br>
<input type="submit" />
public class PersonServlet extends HttpServlet
public void service(HttpServletRequest req,HttpServletResponse res)
String nameVal =req.getParameter("name");
String cityVal =req.getParameter("city");
PersonBean per=new PersonBean();
req.setAttribute("myper",per); //line1
RequestDispatcher rd=req.getRequestDispatcher("myUseBean.jsp");


<%@page import="java.util.*,myuseBean.*" %>

<jsp:useBean id="myper" class="myuseBean.PersonBean" scope="session"/> <b>Ur name is: :
<jsp:getProperty name="myper" property="name"/>
<br>Ur city is :
<jsp:getProperty name="myper" property="city"/>
In line 1 above iam storing the attribute "myper" in request scope..
In line 2 iam trying to retrive the value of same bean object "myper" from a session scope..I thought <jsp:getProperty >on this object shuld return null.But its returning the values of the object tht I stored in line 1..why is it so?Can anyone pls explain this?

I agree. Here's the link:
subject: jsp:getProperty
It's not a secret anymore!