Accessing bean properties in a jsp

Hi,
I am trying to access a bean in my jsp page like this,
<c:out value="${clientSession.customerName}"/>
I validate and then set the bean in my action class, I am using struts 1.1,
package com.neo.five.ereports;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpSession;
import com.neo.five.cookies.SessionCookieValidator;
import com.neo.five.beans.CustomerSessionBean;
public final class EreportAction extends Action{
     public ActionForward execute(ActionMapping mapping,
                                        ActionForm form,
                                        HttpServletRequest request,
                                        HttpServletResponse response){
          //get the session object
          HttpSession session = request.getSession(false);
          //validate the session cookie if session object dows not exist
          Cookie[] cookies = request.getCookies();
          SessionCookieValidator scv = new SessionCookieValidator(cookies);
          scv.checkCookie();
          //forward to appropriate destination
          //if there is a cookie continue
          if(scv.hasSessionCookie()){
               //check for session object
               if (session != null) {
                    //if session does not exist put bean into session that holds the cookie
                    //values
                    if(session.getAttribute("cookieSession")==null){
                         CustomerSessionBean sb = new CustomerSessionBean(scv.getCustomerid(),scv.getCustomerName(),scv.getCfid(),scv.getCftoken());
                         session.setAttribute("cookieSession", sb);
                         request.setAttribute("clientSession",sb);
                    return (mapping.findForward("success"));
               }else{
                    return (mapping.findForward("failure"));
          }else{
               return (mapping.findForward("failure"));
}this is my SessionBean
package com.neo.five.beans;
public class CustomerSessionBean {
     private int customerid;
     private String customerName;
     private int cfid;
     private int cftoken;
     public CustomerSessionBean(int customerid,String customerName,int cfid,int cftoken){
          this.customerid=customerid;
          this.customerName=customerName;
          this.cfid=cfid;
          this.cftoken=cftoken;
     public int getCustomerid(){
          return customerid;
     private String getCustomerName(){
          return customerName;
     private int getCfid(){
          return cfid;
     private int getCftoken(){
          return cftoken;
}however I am getting this error,
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An error occurred while evaluating custom action attribute "value" with value "${clientSession.customerName}": Unable to find a value for "customerName" in object of class "com.neo.five.beans.CustomerSessionBean" using operator "." (null)
     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
     at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
     at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
     at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
     at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
     at java.lang.Thread.run(Thread.java:536)
root cause
javax.servlet.ServletException: An error occurred while evaluating custom action attribute "value" with value "${clientSession.customerName}": Unable to find a value for "customerName" in object of class "com.neo.five.beans.CustomerSessionBean" using operator "." (null)
     at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
     at org.apache.jsp.eReportDeskTopRoot_jsp._jspService(eReportDeskTopRoot_jsp.java:145)
     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
     at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
     at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
     at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
     at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
     at java.lang.Thread.run(Thread.java:536)
Apache Tomcat/4.1.30
thanks for any help.

how?.... mmmm ... did ... (head scratch) ...I miss that.
Thanks a million for spotting that, I really did appreciate that.
jp.

Similar Messages

  • Accessing bean attributes in a JSP

    Hi,
    I am sending a bean from a Servlet to a JSP as follows:
    request.setAttribute("newclientTEST", ro_client);
    this.getServletContext().getRequestDispatcher("/jsp/private/research/UserAdded.jsp").forward(request,
    response);I can then access the bean in UserAdded.jsp page as follows:
    <jsp:getProperty name="newclientTEST" property="username" />This works fine and returns the username from the bean but I am a little confused why this is working. From what i have read about JSPs so far in order to access properties of a bean in a JSP we first of all have to make a reference to the bean as follows:
    <jsp:useBean id="newclientTEST" scope="request" class="ie.scourced.beans.PrivateClientBean" />Why does it work for me when I don't refer to the bean using useBean??
    Thanks

    how?.... mmmm ... did ... (head scratch) ...I miss that.
    Thanks a million for spotting that, I really did appreciate that.
    jp.

  • Accessing Bean Properties

    If a bean has a property accessor like:
    public int getID();
    , it can be accessed using the action:
    <jsp:getProperty name="Bean" property="id"/>.
    What happens if the bean accessor takes a parameter? e.g:
    public int getID(int toGet);
    How do you use the action property accessor to specify the parameter?

    From : http://java.sun.com/products/jsp/tags/11/syntaxref1111.html#8820
    "You cannot use <jsp:getProperty> to retrieve the values of an indexed property"
    An ndexed property is one that requires a parameter in the get method.
    So your only real option is to create a setter method for the parameter, then create a no-arg get method:
      private int _toGet = -1;
      public void setIDToGet(int toGet) { _toGet = toGet; }
      public int getID()
        if (_toGet == -1) throw new IllegalStateException ("The ID to get must be set before you can get the ID");
        int id = //get the id based on _toGet;
        _toGet = -1; //reset _toGet so we need to set it again later ...
        return id;
      }

  • Accessing bean properties in value attrib of jsf tags

    I am new to Alfresco and an example upon which i am working uses the following and similar code in a jsp many times. I knw it is calling getName() of DocumentDeatilsBean class but I can not figure out where is it actually configured .. I hope you understand what I am saying
    <h:outputText value="#{DocumentDetailsBean.name}" />

    In the faces-config.xml there will be a managed-bean section that associates that name with a class and a scope.

  • JSP can't  "see" bean properties

    I am trying to populate my JSP form inputs using a bean. I know the bean properties are being set, but for some reason they are not being passed to my form inputs. The bean properties are being set by a worker class just prior to hitting the JSP that segment follows. I think I may have a scope problem. Any help/thoughts would be greatly appreciated.
    <HTML>
    <HEAD>
    <TITLE></TITLE>
    <jsp:useBean id="codin" class="edu.cod.CodIn" scope="application" />
    </HEAD>
    <BODY>
    <form action='codapp' method='post'>
    <input type='hidden' name='postedFrom' value='studentInsert'>
    <br>
    student id: <input type='text' name='student_id' size='5' maxlength='5' value='<%= codin.getStudent_id() %>'>
    <br>
    last name: <input type='text' size='18' name='last_name' value="<%= codin.getLast_name() %>">
    <br>
    first name: <input type='text' size='16' name='first_name' value="<%= codin.getFirst_name() %>">
    ~
    ~
    ~
    ~
    ~
    <br>
    <input type='submit' value='submit'>
    </form>
    </BODY>
    </HTML>

    Here is a cod segment from my servlet. In it I am instantiating the bean, then setting the bean properties. If the bean is successfully populated, the gotoPage method returns to the studentInsert.jsp page. I would like to carry the name and ID fields back to the JSP so that the user doesn't have to re-key these fields to enter additional hours for the same individual. I am fairly certain the scope would only need to be request, however I'm sure how it's done.
    if ( postOperation.equals("studentInsert") )
    CodInsert codin = new CodInsert();
    codin.setStudent_id(request.getParameter("student_id"));
    codin.setFirst_name(request.getParameter("first_name"));
    codin.setLast_name(request.getParameter("last_name"));
    codin.setAi_code(request.getParameter("ai_code"));
    codin.setAi_date(request.getParameter("ai_date"));
    boolean successfulInsert = codin.doTheInsert();
    if (successfulInsert) {
    gotoPage("studentInsert.jsp",request, response);
    else {
    gotoPage("errorPage.jsp",request, response);
    private void gotoPage(String url,
    HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    RequestDispatcher dispatcher =
    getServletContext().getRequestDispatcher(url);
    dispatcher.forward(request,response);
    This is my useBean tag from the studentInsert.jsp:
    <jsp:useBean id="codin" class="edu.cod.CodInsert" scope="request" />

  • Accessing add() methods through bean properties ?!

    I hope this question is trivial...
    Is there a defined way of using add(*) methods through bean properties ?
    Seems a little odd that Swing components can't be added to a container in a simple "bean-like" way....is there a set*(*) method I've missed ? I'm aware of the getComponents() method on Container...but there's no setComponents(Component []) method.
    Thanks,
    Michael.

    Thank you for the repsonse....but..
    Wouldn't that mean that I'd have to sub-class all the Components I wanted to use....just to add the set*(*) method....isn't there a tidier way ?
    I really find this strange...(I can think of many examples where accessing the add*(*) methods through introspection (possibly by providing set*(*) methods) would be extremely useful....but, staying in a Swing context....)
    If you wanted to create an application that can load, edit and save GUI forms (as many already have). Having all Swing components stick to the javaBeans spec. is very useful. The application can use introspection to grab all the properties of a component, without having any hard-coded logic on dealing with specific classes. Users can then provide their own extensions to the components palette, and by sticking to the javaBeans convention, have the GUI editor expose those properties.
    But....to compose components together (a fundamental concept) the editor must be provided with "hard-coded" logic that knows how to deal specifically with Components (in that they have an add(*) method).
    This must also be a problem with the XMLDecoder class ?!
    When encoding a Swing component, the XMLEncoder can use all the get*() methods (including getComponents()) to persist the Container, its properties, and any sub-components....fine.
    But, when decoding this information, all the properties can be set through the usual bean mechanism (using the corresponding setPropertyName(*) method) except the sub-components....there is no setComponents(*) method.
    How does the XMLDecoder get around this problem ?
    Does it "know" that when it gets to the "components" property of a Swing component, it must call the add(*) method instead...?
    Thanks,
    Michael

  • Java Beans properties not recognized

    I'm trying to access a javabean property from jsp, but however this is what I get when I try to do so:
    org.apache.jasper.JasperException: Cannot find any information on property 'PatientIcNo' in a bean of type 'Action.Profile'
    my bean is Profile.java which is class in the package Action. I think i've compiled this successfully. But why am I still getting this error.
    In my bean I've declared the getPatientIcNo() and setPatientIcNo() methods.
    Thanks in advance.

    But how did you declare patientIcNo?
    private String patientIcNo;
    or
    private String PatientIcNo;
    Believe it or not, it makes a difference.
    Pay attention to the Java Bean Standard.
    The JavaBean spec states that properties are case sensitive and start with a lower case character.
    So in the JavaBean you should declare:
    private String patientIcNo;
    and the getter is:
    public String getPatientIcNo() {
    return patientIcNo;
    In the JSP the syntax are:
    <jsp:useBean id="patient" scope="request" class="Action.Profile" />
    <jsp:setProperty name="patient" property="patientIcNo" value="RickyBobby" />
    <jsp:getProperty name="patient" property="patientIcNo" />
    <%= patient.getPatientIcNo() %>
    <% patient.setPatientIcNo("Sidecar"); %>
    If by chance you name the property PatientIcNo instead of patientIcNo,
    <%= patient.getPatientIcNo() %>
    and
    <% patient.setPatientIcNo("Sidecar"); %>
    work, but the others won't.
    setPatientIcNo maps to the property patientIcNo.
    But there isn't such a property in your bean!!
    You named it PatientIcNo.

  • Help:accessing beans method

    hello
    i have made one application in which i have made two beans under different packages. i am trying to access beans through jsp pages. i am able to access beans and their methods but when i add new method in bean and tried to access that method with different new jsp page say page1.jsp. I am not able to access new method though i am able to access old methods of same beans with this new jsp page. then i made new bean and copied that method in this new bean . then i tried to access that method of this new bean with page1.jsp and i am able to access it can any body guide me what is the reason for this. i want to run this method in old beran rather than new bean
    my directory structure is:
    projectlms---main folder
    addstream---old jsp page
    page1---new jsp page
    web-inf/classes
    com-------main packageof beans
    ProgramManager----sub package of classes
    bean1--------old bean
    new bean------new bean just for testing
    now the problem is that i want to add one more method to bean1 and want to access it through pag1.jsp
    but i am not able to access it and same method when i take to new bean i am able to access that method through page1.jsp
    but i am able to access old methods of bean1 through page1.jsp
    thanks
    regards
    vivek

    Could be a caching issue.
    Wipe out the COMPILED jsps and try again.

  • How to access the hidden variable in jsp

    hi all,
    i need help to know how to access the hidden variable in the same jsp.
    Following is the code snippet just have a look at that.
    ArrayList arrRankingSummary = (java.util.ArrayList)session.getAttribute("arrRankingSummary");
    <logic:iterate id="rankingSummary" name="arrRankingSummary">
    <input type="hidden" name="allApplicantID" value='<bean:write name="rankingSummary" property="APPLICANTID"/>' />
    <input type="hidden" name="allAdmissionRank" value='<bean:write name="rankingSummary" property="ADMISSIONRANK"/>' />
    </logic:iterate>
    <input type="hidden" name="applicantID" value='<bean:write name="rankingSummary" property="APPLICANTID"/>' />
    <TD align=center><Input type=Text name="admissionRank" class=Textverysmall size=2 value='<bean:write name="rankingSummary" property="ADMISSIONRANK"/>' maxlength="10" /> </TD>
    I want to remove the element from arraylist on these condition
    if(allApplicantID.value ==applicantID.value){
    arrRankingSummary .remove("admissionRank");
    Now the pbm is i m not getting how to access the hidden variable in jsp or how to use the values of hidden variable for the condition.
    Pls help me out.
    Thanks in adv.
    Regards,
    Ritu

    hi ram,
    as i mentioned i m creating hidden variables & i m doing some validation on form submit.
    The following is js code snippet for validation.
    for (var i = 0; i < document.forms[0].admissionRank.length; i++)
    admissionRank = document.forms[0].admissionRank.value;
    for(var j = 0; j < document.forms[0].allAdmissionRank.length; j++)
    //alert ("admissionRank : " + admissionRank + " document.forms[0].allAdmissionRank[" + j + "].value : " + document.forms[0].allAdmissionRank[j].value + "\ndocument.forms[0].allApplicantID[" + j + "].value : " + document.forms[0].allApplicantID[j].value + " document.forms[0].applicantID[" + i + "].value : " + document.forms[0].applicantID[i].value);
    if(admissionRank == document.forms[0].allAdmissionRank[j].value && document.forms[0].allApplicantID[j].value != document.forms[0].applicantID[i].value && admissionRank != "" && document.forms[0].allAdmissionRank[j].value != "")
    flag = false;
    document.forms[0].admissionRank[i].focus();
    document.forms[0].admissionRank[i].select();
    break;
    if (flag == false)
    break;
    In this validation i want admissionRank to be removed from the original arraylist if following condition gets satisfied
    "(document.forms[0].allApplicantID[j].value == document.forms[0].applicantID[i].value )"
    Thanks in adv
    Ritu

  • Unable to call bean method at second JSP.

    I have a Bean called "Database" in that two methods
    1.public String methodReturnsString()
    2.public List methodReturnsList()
    And also i have three jsp's.
    1.First.jsp
    2.Success.jsp
    3.fail.jsp
    i called methodReturnsString of "Database" in the First.jsp ,after receiving intended String from the method methodReturnsString() i.e "success" or "fail" i can goto Success.jsp. or fail.jsp.
    Assume i got String "success" eventually leads me to Success.jsp , In this Success.jsp i was trying to access Bean method methodReturnsList() , Now the problem is I cant access the Bean method methodReturnsList() in Success.jsp, where i want to print the List that is returned by methodReturnsList().
    Can anybody tell me what is the mistake i am doing.
    here is "Success.jsp"
    <%@ page contentType="text/html"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    Login Successful
    <html>
    <f:view>
       <h:form id="result">
         <p>
                 <c:forEach var="x" items="${Database.methodWithList}" >
              ${x}
         </c:forEach>
                </p>
           </h:form>
    </f:view>
    </html>here is" Faces-config.xml"
    <?xml version="1.0"?>
    <!DOCTYPE faces-config PUBLIC
      "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
      "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
         <managed-bean>
              <managed-bean-name>Database</managed-bean-name>
              <managed-bean-class>com.persistent.parashar.database.Database</managed-bean-class>
              <managed-bean-scope>session</managed-bean-scope>
         </managed-bean>
         <navigation-rule>
              <from-view-id>/First.jsp</from-view-id>
              <navigation-case>
                   <from-action>#{Database.methodReturnsString}</from-action>
                   <from-outcome>success</from-outcome>
                   <to-view-id>/success.jsp</to-view-id>
              </navigation-case>
              <navigation-case>
                   <from-action>#{Database.methodReturnsString}</from-action>
                   <from-outcome>fail</from-outcome>
                   <to-view-id>/fail.jsp</to-view-id>
              </navigation-case>
         </navigation-rule>
    </faces-config>
    Here is Database.java
    public class Database {
         public List methodWithList()
              System.out.println("Contents in the List#########");
              List al=new ArrayList();
              al.add("jaya");
              al.add("chandra");
              al.add("raheem");
              al.add("balu");
              System.out.println("Contents in the List"+al);
              return al;
         public String methodReturnsString()
              return "success";
    }

    Thank you for reply, after making few chages by taking your suggestion i am still struggling to get the desired result in my jsp. please into the code below
    public class Database {
            public List calToDatabase;
         public static void initialCalToList()
              System.out.println("Contents in the List#########");
              List al=new ArrayList();
              al.add("JAya");
              al.add("chandra");
              al.add("raheem");
              al.add("balu");
              System.out.println("Contents in the List"+al);
              Database db= new Database();
              db.setCalToDatabase(al);  // calling the setter with list as an argument
    public List getCalToDatabase() {
              return calToDatabase;
         public void setCalToDatabase(List calToDatabase) {
              this.calToDatabase = calToDatabase;
         }I have also made changes in success.jsp
    <%@ page contentType="text/html"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    Login Successful
    <html>
    <f:view>
       <h:form id="result">
         <p>
               <c:forEach var="x" items="#{Database.getCalToDatabase}" >
                     ${x}
                   </c:forEach>
         </p>
       </h:form>
    </f:view>
    </html>

  • Hoe do I access a properties file ??

    I am developing an application using JSPs on WLS6.1. My JSPs want to
              access a properties file that will have declarative information. Where
              do I keep the properties file, and how do I access it ??
              Reply,
              Hemant.
              

              Herr Bedekar,
              The servlet spec helps you out here. Check out:
              http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletContext.html#getResource
              ga
              [email protected] (Hemant Bedekar) wrote:
              >I am developing an application using JSPs on WLS6.1. My JSPs want to
              >access a properties file that will have declarative information. Where
              >do I keep the properties file, and how do I access it ??
              >
              >Reply,
              >Hemant.
              

  • Is it possible to set all the bean properties at once in a servlet?

    Hi,
    I would like to set all the properties of a bean, that is instantiated in a servlet, at once. The values I want to set the bean properties with are kept in a request object coming from a jsp. All form parameter names of the jsp are the same as the names of all bean properties.
    I would like to set all the bean properties at once, so I don't have to use the 'getParameter' method for every bean property. Actually just like when setting properties in a jsp using the setProperty tag, but then in the servlet.
    Is there a possibility to do so?
    thanks and regards,
    dampe hin

    You have an html with a form, after submitting, forward the user to a jsp page with the following code:
    // instantiate bean
    <jsp:useBean id=�cust� class=�Northwind� />
    // set all bean properties
    <jsp:setProperty name=�cust� property=�*� />its up to you what to do next, you could simply forward the user to your servlet for database storage, etc. hope this helps, good luck!

  • How to update bean properties when using an immediate link

    Hello,
    I have a page with a find link next to an input text field. The input text field requires a valid code to be entered. If the user doesn't know the code they need to press the find link to go to a search page and select the code. The input text code field needs to have a value entered so it has its required attribute set because the validator I have and attached to the input text field does not get called unless something is entered in the field. If I don't set the link to immediate the required constraint prevents the search page from being invoked but if I do set it to immediate the values typed on the page are not updated to the bean properties they are bound to.
    I have read many posts but I fail to see a way to resolve this. The update model phase is apparently skipped because of the immediate attribute and so the values typed in by the user are lost.
    Please help.
    Thanks,
    Randall

    A UIInput holds the submitted value.
    When updating models it is cleared to null but when some error occurs it keeps to hold the submitted value.
    The TextRenderer uses the submitted value if the value is null.
    Therefore, you can see the submitted value is redrawn when some error occurs.
    Unfortunately, this mechanizm does not work beyond requests
    because the default application action listener always create a new viewroot based on the navigation rules.
    An general solution of your problem is not so easy.
    I think it may be to customize the action listener or the lifecycle.
    A temporal solution may be that the link action copys the submitted value to the managed-beans.

  • How to access System properties in xml file

    hi,
    i want to read system properties in my xml file using ${} .
    I tried it but did not find any way.But when i use log4j if i set some variable in
    System properties that properties is read by the log4j.properties .
    I am writing a simple program that read a xml properties file file
    try {
                props   = new Properties();
                fis     = new FileInputStream(xmlFile);
                props.loadFromXML(fis);
    }before reading this file i set some properties and accessing this properties from that xml .but i cant.
    Thanks

    sabre150 wrote:
    fun_with_java wrote:
    can you give some example?Not really - I would have to write the code for you and I'm not getting paid for writing your code.Thanks for your kindness.
    I dont ask you to write the code.Need some help to start it .Actually i dont have knowledge that
    whether xml file automatically read it or i have prase the system property manually. Now i got the way to
    access system property in xml..
    Ok thanks again..
    Thanks & Regards

  • How can I access the properties of Microsoft files (excel, ppt, and word)

    Hi,
    How can I access the properties of common Microsoft file formats (Excel, Word, and Powerpoint) from a Java program. You can access/modify the properties of each document type using File->Properties in each MS application. The properties are essentially name/value pairs.
    Basically, I need to write a java program that scans a directory and accesses the properties in each of the MS files in the directory.
    thanks,
    -john

    By api. That is only way to establish a contract with the MS programs you want to interface with, unless you write an api yourself! I've used POI and it was an awesome way to use Excel in java. I created an excel spreadsheet from the results of a sql query from a batch program and then it was automatically emailed using javamail to my client. I had a lot of VBA experience with Excel, Word, and Outlook and it didn't take me long to get used to using Jakarta-POI.
    Now I see there is Jakarta-POI-HWPF which works with MS Word documents. Go to: http://jakarta.apache.org/poi/

Maybe you are looking for

  • The option to make my iPhone 4 a hotspot is no longer listed in my setting APP.  How do I get it back?

    I have created the hotspot before so I know my data plan and phone support it, but it no longer can be activated.  My wife's same exact phone adn software update does work.  I'd like to not have to restore it to factory settings and start over, but I

  • Installing 9i  9.2.0.1.0  Personal Edition

    Anyone know the work around for error message: nVidia OpenGL Driver Driver components mismatch. Exit is the only option. Attempting load on a compaq laptop AMD Athlon XP-M running XP PRO SP 2 with NVIDIA GeForce4 420 Go 32M ?? THANKS

  • XI acknowledge from BPM

    HI Experts, Trying to make acknowledge from XI to R/3 through BPM but get error message “Unable to convert the sender service <BPM_Process> to an ALE logical”. The XI process flow is from SAP with Idoc to XI – BPM and to JDBC. Have check setting in A

  • Concatenate nested XML tags

    Hello, I'm looking for a solution to concatenate duplicate tags in a xml. I need only the tags 'tag' of 'type=keyword' in one field in a table. The sql statement I use I'm getting six records and I just need one record. Hope my English writing is not

  • Audio sync not consistent in FCE4.0

    I have a copy of Final Cut Express.  I am using a Zoom H1 as an external audo recorder in conjunction with a Canon SX30is.  When I attempt to sync the audio in final Cut Express, the begining of the clip remains in sync however toward the end of the