Regarding jsp:getProperty

hi
i have a bean. I am setting the values of the bean and setting that bean as an attribute in the session.
In another jsp i am able to access the bean using
<jsp:getProperty name=".." property="..">
Here the name is the same as the attribute name.
But here i am not using <jsp:useBean /> tag.
I have read some where that <jsp:getProperty> or <jsp:setProperty> should be used with the <jsp:useBean> tag.
Please correct me where i am wrong?

I too read the same.
But i done an example on my local machine and i am able to access the <jsp:getProperty> without <jsp:useBean>
Consider Testbean.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>TestBean.jsp</TITLE>
</HEAD>
<BODY>
<%
InfoBean infoBean = new InfoBean();
infoBean.setFullname("Macro");
infoBean.setAge("23");
infoBean.setOccupation("employee");
infoBean.setSex("F");
infoBean.setQualification("B-Tech");
session.setAttribute("InfoBeanObj",infoBean);
%>
<jsp:forward page = "TestBeanForward.jsp"/>
</BODY>
</HTML>
The TestBeanForward.jsp is
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>TestBeanForward.jsp</TITLE>
</HEAD>
<BODY>
<jsp:getProperty name="InfoBeanObj" property="fullname"/>
<jsp:getProperty name="InfoBeanObj" property="age"/>
<jsp:getProperty name="InfoBeanObj" property="occupation"/>
<jsp:getProperty name="InfoBeanObj" property="sex"/>
<jsp:getProperty name="InfoBeanObj" property="qualification"/>
</BODY>
</HTML>
I ran TestBean.jsp on server and i am able to print all the values onthe browser

Similar Messages

  • Populating combobox in jsp page from javabean using jsp:getProperty tag

    hi,
    i am new to jsp, so i don;t know how to populate a combobox in jsp page with productid attribute from a javabean called Bid . i want to have a code to automatically populating combobox using the attribute value from javabean.
    please reply me.
    <jsp:useBean id="bidpageid" class="RFPSOFTWARE.Bid" scope="session" />
    <jsp:setProperty name="bidpageid" property="*"/>
      <table  width="50%" align="center" border="0">
       <tr>
        <td  width="30%" align="left"><h4><b><label>Date (dd/mm/yyyy) </label></b></h4> </td>
        <td><input type="text" name="date" size="11" maxlength="10" readonly="readonly" value="<jsp:getProperty name="bidpageid" property="date"/>"  > </td>
      </tr>
      <tr> <td > </td> </tr>
      <tr>
        <td  width="30%" align="left"><h4><b><label>ProductId </label></b></h4> </td>
        <td><select name="productid" tabindex="1" size="1" >
          <option  value="<jsp:getProperty name=bidpageid" />Sachin</option>
          <option value="Hello">Vishal</option>
        </select></td>
      </tr>  and the javabean for Bid is as follow :
    import java.util.Date;
    import RFPSOFTWARE.Product;
    public class Bid{
    private Product product;
    private Integer bid_id;
    private String description;
    private Date date= new Date();
    public Integer getBid_id() {
    return bid_id;
    public Date getDate() {
    return date;
    public String getDescription() {
    return description;
    public Product getProduct() {
    return product;
    public void setBid_id(Integer bid_id) {
    this.bid_id = bid_id;
    public void setDate(Date date) {
    this.date = date;
    public void setDescription(String description) {
    this.description = description;
    public void setProduct(Product product) {
    this.product = product;
    }

    No Sir,
    I think I did not explained clearly.what I try to say is I dont want to use JSTL.I am using only Scriptlets only.I can able to receive the values from the database to the resultset.But I could not populate it in Combobox.
    My code is :
    <tr>
    <td width="22%"><font color="#000000"><strong>Assign To Engineer</strong></font></td>          
    <td width="78%">
         <select NAME="Name" size="1">
    <option><%=Username%></option>
    </select> </td>
    </tr>
    in HTML
    and in Scriptlets:
    ps1 = con.prepareStatement
              ("SELECT Username FROM Users");
              rs2=ps1.executeQuery();
              System.out.println("SECOND Succesfully Executed");
              while(rs2.next())
                   System.out.println("Coming inside rs2.next loop to process");
                   Username=rs2.getString("Username");
                   System.out.println("Success");
                   System.out.println("The value retrieved from UsersTable Username is:"+Username);
    In the server(Jboss console) I can able to display the username but I could not populate it in the Combobox .
    Can you now suggest some changes in my code,Please..
    Thanks a lot
    With kind Regds
    Satheesh

  • jsp:getProperty.... in a taglib-tag ???

    Hi !
    I have taglib where I have defined a lots of classes and one of them I have a attribute who should be dynamic. I have tryed this:
    <easyTagz:submit iteration='<jsp:getProperty name='submission' property='maxCount'/>' />
    but it dosen`t seem to work....
    Any suggestion :-)

    Dosen`t seem to work, have tryed and gets this error message:
    org.apache.jasper.JasperException: Unable to compile class for JSP
         at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:567)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:177)
    Any suggestion ???

  • Jsp:getProperty in tag attributes

    Hii....
    I have a custom tag that displays some information based on an attribute of the tag. I want to set information from a bean to the attribute using the jsp:getProperty tag...
    I want to do something like.......
    <mytagprefix:MyTag attribute1='<jsp:getProperty id="myID" property="name"/>' />
    If I do it right now I am getting the string <jsp:getProperty id="myID" property="name"/> inside the my TAG.
    any help will be appreciated.
    sanjay.

    I'm a bit rusty on custom tags, so maybe this isn't the best solution, but until you find a better one you can try '<%= myID.getName() %>' as the attribute.

  • Combining jsp getProperty with HTML EMBED

    Hi, Just a quick question, I have a couple of JSP/HTML books and I can't find a way of achieving this;
    basically I have a webpage that embeds a VRML file like so
    <EMBED SRC="/VRML/stair.WRL"
    TYPE="model/vrml"
    WIDTH="300"
    HEIGHT="300"
    VRML_SPLASHSCREEN="TRUE"
    VRML_DASHBOARD="TRUE"
    VRML_BACKGROUND_COLOR="#0066CC"
    CONTEXTMENU="TRUE"
    >
    This works fine, the problem is that I now have a servlet that dynamically generates the VRML file to be displayed, so I need a way of inserting this variable into the EMBED header, how do I do this?
    If it can't be done with JSP etc then how about a JavaScript solution?
    Anyway, ive tried a few things and Im out of ideas
    Cheers
    PS, the current JSP property finder;
    <jsp:useBean id="vrmlFileFinder"
         type="legato.VRMLBean"
         scope="request" />
    <jsp:getProperty name="vrmlFileFinder" property="fileName" />

    There are two issues here
    1 - generating the WRL file (from your servlet)
    2 - generating the EMBED tag in the HTML/JSP page
    These are two different requests to the web server.
    1- generating the WRL file:
    You say you have a servlet which generates the VRML code?
    Does it generate it to file, or output it directly?
    If it outputs it directly, just point the src of the tag to be your servlet
    ie
    <EMBED SRC= "/servlet/VRMLServlet"...
    This will invoke your servlet, and return the code to the browser. (ie as long as the servlet sends it a WRL text format, it can't tell the difference)
    2 - generating the EMBED tag:
    If you want to dynamically choose which file to include, then JSP would do it like this:
    <jsp:useBean id="vrmlFileFinder" type="legato.VRMLBean" scope="request" />
    <EMBED SRC="<jsp:getProperty name="vrmlFileFinder" property="fileName" />"...
    Remember that the JSP code gets executed first, so if the property evaluates to "/VRML/stair.WRL" all the browser will see is
    <EMBED SRC="/VRML/stair.WRL" - it doesn't see the JSP code at all.
    Hope this helps.
    Cheers,
    evnafets

  • Jsp:getProperty

    Hi!
    I create a JSP page wich is going to process a bean put in the session by other jsp page.
    The code is like this:
    <jsp:useBean id="realty" scope="session" class="com.admin.bean.Realty" />
        <jsp:setProperty name="realty" property="*" /> For the page where the user is going to enter the information and...
    <jsp:useBean id="realty" scope="session" type="com.admin.bean.Realty" />
        <jsp:getProperty name="realty" property="*"/> for the page where the data processing is going to occur.
    The problem I have is that once I enter the informacion on the page1 and press submit. I got the following error:
    Cannot find any information on property '*' in a bean of type 'com.admin.bean.Realty'
    Can sombody help me with that??
    Thanks

    There is no property "*" applicable to a get[/i]Property.
    With [i]setProperty, it makes sense, because you are telling the computer set ALL the properties of the bean which have corresponding parameters in the request.
    However getProperty is designed to display/return one property. How could you display multiple properties? So * makes no sense in that case.

  • Help with JSP:GetProperty Tag

    Howdy all,
    I have a
    <jsp:getProperty name='input' property='code01'/>
    tag and would like to be able to put a variable in the property field so that I can increment from code01 to code02 to code 03 by concatenating strings
    Is this possible?

    Thanks for your input on the forum, but I tried with no sucess to put it into action:
    <% String colname="code02"; %>
    <jsp:getProperty name='Input' property='<%=colname%>' />
    Produced this:
    Internal Servlet Error:
    org.apache.jasper.JasperException: Cannot find any information on property '' in a bean of type 'com.infomed.InputBean'
         at org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrary.java:616)
         at org.apache.jasper.compiler.GetPropertyGenerator.generate(GetPropertyGenerator.java:101)
         at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(JspParseEventListener.java:771)
         at org.apache.jasper.compiler.JspParseEventListener.generateAll(JspParseEventListener.java:220)
         at org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseEventListener.java:175)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:210)
         at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:612)
         at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
         at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:542)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:258)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:268)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
         at org.apache.tomcat.core.Handler.service(Handler.java:287)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
         at java.lang.Thread.run(Thread.java:484)
    Any Help you can give would be greatly appreciated, what I need to do is cycle through code01, code02....code15
    and use the string to do it, but use a counter integer to create the string, ie..'code0' + i and then use the sting to access
    on of the member properties in the been...(Code01, Code02) ertc.

  • How come property attribute of jsp:getProperty  knows which method to call

    Hello friends,
    I could not understand How come property attribute of <jsp:getProperty knows which method to call
    <jsp:useBean id="test" class="BeanTest.testing" scope="page" />
    <jsp:getProperty name="test" property="name" />
    there is no method "name" in testing.class file
    if u see the existing examples "date" given in TOMCAT , it is using many <jsp:getProperty tag, but the property name is not equal to the method method name in the Bean file
    thanks,

    First do you know what a
    bean property sheet is?
    If not say so.
    Second, to your question
    The Java Runtime Environment (JRE) uses introspection to identify the appropriate get() or set() methods of that bean. What is introspection?
    Introspection is a process that allows the class to expose its accessable variables and methods and allows other classes to see what they can do with that class when requested. Eg:
    public class MyBean{
    private String someValue = null;
    public MyBean(){
    someValue = "Some String Value";
    //Introspection will reveal this method
    public String getSomeValue(){
    return someValue;
    } and
    <jsp:getProperty name="...." property="someValue" />
    will call the getSomeValue() method

  • Formatting fonts within jsp:getProperty tag????

    I'd diplaying a piece of information on one of my pages using the jsp:getProperty tag.... there seems to be no way I can effect the display of the property with the font/color that I want - when I look at the resulting HTML code, I see that this tag has created a new HTML table specifying the class "inFieldSet" (a CSS class I presume, and which I also presume if overriding my desired font/color settings). Is there a way to make the page display the property using the font/color that I want without writing a custom tag?
    Scott

    All the JSP getProperty tag does, is get a string returning the value of a property. It would not apply any formatting to your page.
    I would take a look at the "getter" for this property to see what value it is returning.
    Most probably it is returning a chunk of preformatted html.

  • Using jsp:getProperty ... inside a scriptlet

    When I use the following line in a jsp file,
    <% boolean userExists=<jsp:getProperty name="xxx" property="exist/> %>
    it gives an error saying that a term is missing, when I try to load this page. Any help is appreciated.
    Thanks,
    Nalini

    Don't put the bean in the servlet context but use the HttpSession
    session.setAttribute("xxx", loginBean);
    in the JSP retrieve the bean by
    <jsp:useBean id="xxx"
    scope="session"
    class="package.LoginBean" />
    Where id = the name of the attribute in the session
    class = the full package name of the bean.
    Or
    LoginBean myBean = (LoginBean) session.getAttribute("xxx");
    Don't forget the import
    <%@ page import="package.LoginBean" %>

  • Plz help me regarding jsps

    Hi all,
    I have menu.jsp which is included in 100 jsp's
    in menu.jsp i have lots of db calls so each and evry action this menu is getting called so my application performence is getting decreasing so how can i include menu.jsp in all 100 jsps so i my application works faster and faster.., any suggetions are welcome
    Regards
    Rajani

    if you know the ans tell me or els dont make joke of
    itI wasn't making a joke, you quite clearly didn't bother reading my post. you just saw that I hadn't spoon-fed you code like you hoped, and moved on. this happens every single day. and since this is a free forum, I think I'll choose for myself what and who I reply to, and in what manner

  • Regarding JSP,Struts

    Hello , Pls reply Urgent ,
    This is my code ,
    struts-config.xml
    <form-bean name="studentForm" type="com.ltc.forms.StudentForm"></form-bean>
    <action path="/userAction" type="com.ltc.actions.StudentMaintananceAction" name="studentForm" scope="session" validate="true" input="/jsp/homePage.jsp" >
    <forward name="success" path="resultSuccess"/>
    <forward name="fail" path="resultFail"/>
    <forward name="addPage" path="userAddPage"/>
    <forward name="viewPage" path ="userViewPage"/>
    </action>
    StudentMaintananceAction
    if(strBtnValue.equals("view"))
    ArrayList viewList = sBean.viewStudentList();
    sForm.setResults(viewList);
    forward = mapping.findForward("viewPage");
    StudentForm.java
    ---------------------------->
    public class StudentForm extends ActionForm {
    private String firstName = null;
    private ArrayList results = null;
    public String getFirstName() {
    System.out.println("--- getFirstName --:"+firstName);
    return firstName;
    public void setFirstName(String firstName) {
    this.firstName = firstName;
    public ArrayList getResults() {
    return results;
    public void setResults(ArrayList results) {
    this.results = results;
    userView.jsp
    ---->
    userView.jsp
    <logic:present name="studentForm" property="results">
    <% System.out.println(" -------- logic:present 1---:"+request.getAttribute("studentForm")); %>
    <hr width="100%" size="1" noshade="true">
    <bean:size id="size" name="studentForm" property="results"/>
    <% System.out.println(" -------- bean:size ---"); %>
    <logic:equal name="size" value="0">
    <% System.out.println(" -------- bean:size 0---"); %>
    <center><font color="red"><b>No Students Found</b></font></center>
    </logic:equal>
    <logic:greaterThan name="size" value="0">
    <% System.out.println(" -------- bean:size >0---"); %>
    <TABLE BORDER="1" >
    <tr><th>Student ID</th><th>First Name</th><th>Last Name</th><th>Qualification</th>
    <th>Technology</th>
    </tr>
    <logic:iterate id="resultId" name="studentForm" property="results">
    <%System.out.println(" ----- JSP 1-----"); %>
    <tr>
    <%System.out.println(" ----- JSP 2-----"); %>
    <td><bean:write name="resultId" property="firstName"/></td>
    <%System.out.println(" ----- JSP 3-----"); %>
    <td><bean:write name="resultId" property="lastName" /></td>
    <%System.out.println(" ----- JSP 4-----"); %>
    <td><bean:write name="resultId" property="qualification" /></td>
    <%System.out.println(" ----- JSP 5-----"); %>
    <td><bean:write name="resultId" property="technology"/></td>
    <%System.out.println(" ----- JSP 6----"); %>
    </tr>
    </logic:iterate>
    </TABLE>
    </logic:greaterThan>
    </logic:present>
    This is the error I am facing ,
    javax.servlet.ServletException: No getter method for property firstName of bean resultId.
    Upto System.out.println(" ----- JSP 2-----"); Its coming ,
    Pls send me solution urgently.
    Regards,
    Praveen

    hi,
    public String getFirstname() {
    System.out.println("--- getFirstName --:"+firstName);
    return firstName;
    public void setFirstname(String firstName) {
    this.firstName = firstName;
    }now it will work,
    use upper case letter after getX & setX, remaining you to follow in small case

  • Questions regarding jsp file download from blob

    Hi developers, i'm doing jsp file download from a blob column in DB2 using struts,
    1) How do i design the jsp page such that the page will show perhaps a hyperlink for me to download the file?
    2) What about struts-config.xml? Do i need to modify any mappings there?
    It would be great if some kind developers were to provide some sample codes for me. Thanks alot. Your effort is kindly appreciated.

    http://kr.forums.oracle.com/forums/thread.jspa?threadID=1982213 - looks similar, you may need to change contentType as per use case

  • Query regarding JSP in appache server

    i have a problem with JSP .
    I am new to JSP. worked with asp with IIS, and servlet with Apachee server,
    but how am i going to run the jsp page .in appache server.
    Plz can u come on line for a help by yahoo or hotmail messenger ,or else send me reply
    Its urgent

    Go to
    http://jakarta.apache.org/tomcat/index.html
    get Tomcat 3 or 4

  • A concern regarding JSP lifecycle

    Hello Developers,
    I am totally new to JSP stuff and I seek some help. I am trying to make an application such that the user will load an HTML page and fill in the data, then a jsp file will process it and mail the result back to the address that the user specified in the initial HTML file. So, within JSP page, I have embedded java code to create object of appropriate class, loading the appropriate method etc.
    My main concern is that it takes almost an hour to process the request. So is there anyway in which the user can close the browser soon after he submits the data and the corresponding jsp will run in 'background' at the serverend? And eventually, once the result is ready after an hour, the server sends email?
    Thanx!
    Jatan

    Yes, make the request asynchronous. The proper way to do this is with message-driven beans sent to a JMS queue. If you have a more lightweight environment, spin off a separate thread to do the work. Though be sure you can manage it properly. :^)
    - Saish

Maybe you are looking for