Solved

jsp  pageContext.findAttribute method

Posted on 2013-01-29
9
1,147 Views
Last Modified: 2013-03-06
I would like to know more about jsp  pageContext.findAttribute method. I would like to know where, when, how, why we use it. I am not able to find good examples on it.
Please advise. Any ideas, sample code, resources highly appreciated. Thanks
in advance.
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 16

Expert Comment

by:Valeri
ID: 38834320
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 38834648
0
 
LVL 7

Author Comment

by:gudii9
ID: 38835276
no link
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
LVL 7

Author Comment

by:gudii9
ID: 38835803
I ran this example from below link

http://82.157.70.109/mirrorbooks/javaserverpages24hours/0672325977_ch08lev1sec3.html


I have not understood the output i got as below

This page has access to the following attributes:
In the Page scope:
javax.servlet.jsp.jspConfig: org.apache.catalina.core.StandardWrapperFacade@106daba
javax.servlet.jsp.jspResponse: org.apache.catalina.connector.ResponseFacade@1021f34
javax.servlet.jsp.jspPageContext: org.apache.jasper.runtime.PageContextImpl@4eb043
javax.servlet.jsp.jspSession: org.apache.catalina.session.StandardSessionFacade@163956
javax.servlet.jsp.jspRequest: org.apache.catalina.connector.RequestFacade@10e434d
javax.servlet.jsp.jspApplication: org.apache.catalina.core.ApplicationContextFacade@16477d9
javax.servlet.jsp.jspPage: org.apache.jsp.MyJsp_jsp@f864fe
javax.servlet.jsp.jspOut: org.apache.jasper.runtime.JspWriterImpl@1ae9aaa

In the Request scope:

In the Session scope:

In the Application scope:
org.apache.catalina.WELCOME_FILES: [Ljava.lang.String;@2c17f7
javax.servlet.context.tempdir: C:\Users\ganesha\Workspaces\MyEclipse 10_workspace\.metadata\.me_tcat\work\Catalina\localhost\LoginApp
org.apache.catalina.jsp_classpath: /C:/Users/ganesha/Workspaces/MyEclipse%2010_workspace/.metadata/.me_tcat/webapps/LoginApp/WEB-INF/classes/;/C:/Users/ganesha/Workspaces/MyEclipse%2010_workspace/.metadata/.me_tcat/webapps/LoginApp/WEB-INF/lib/javax.servlet.jsp.jstl.jar;/C:/Users/ganesha/Workspaces/MyEclipse%2010_workspace/.metadata/.me_tcat/webapps/LoginApp/WEB-INF/lib/jsf-api.jar;/C:/Users/ganesha/Workspaces/MyEclipse%2010_workspace/.metadata/.me_tcat/webapps/LoginApp/WEB-INF/lib/jsf-impl.jar;/C:/Users/ganesha/Workspaces/MyEclipse%2010_workspace/.metadata/.me_tcat/webapps/LoginApp/WEB-INF/lib/jstl-impl.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.ws.xfire_9.0.0.me201211011550/lib/webservices-api.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.ws.xfire_9.0.0.me201211011550/lib/webservices-extra-api.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.ws.xfire_9.0.0.me201211011550/lib/webservices-extra.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.ws.xfire_9.0.0.me201211011550/lib/webservices-rt.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.ws.xfire_9.0.0.me201211011550/lib/webservices-tools.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/annotations-api.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/catalina-ant.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/catalina-ha.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/catalina-tribes.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/catalina.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/el-api.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/jasper-el.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/jasper-jdt.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/jasper.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/jsp-api.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/servlet-api.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/tomcat-coyote.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/tomcat-dbcp.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/tomcat-i18n-es.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/tomcat-i18n-fr.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/lib/tomcat-i18n-ja.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550/tomcat/bin/bootstrap.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/lib/tools.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/lib/ext/dnsns.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/lib/ext/localedata.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/lib/ext/sunjce_provider.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/lib/ext/sunmscapi.jar;/C:/Users/ganesha/AppData/Local/MyEclipse/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/lib/ext/sunpkcs11.jar
org.apache.jasper.runtime.JspApplicationContextImpl: org.apache.jasper.runtime.JspApplicationContextImpl@d9896e
org.apache.catalina.resources: org.apache.naming.resources.ProxyDirContext@1cda59b
org.apache.AnnotationProcessor: org.apache.catalina.util.DefaultAnnotationProcessor@33788d






can you please explain.

why are they setting scopes to array.

why only request  and session scopes coming in output as below.

In the Request scope:

In the Session scope:

 why not applicaion scope
0
 
LVL 7

Author Comment

by:gudii9
ID: 38837756
is there is any other simple exaple to try please advise
0
 
LVL 7

Author Comment

by:gudii9
ID: 38856173
i could not find any good examples. please advise
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 38858355
The above example are some basic understanding examples . Can you clearly tell what kind of example you expect ?
0
 
LVL 16

Accepted Solution

by:
Valeri earned 500 total points
ID: 38868157
the output of the example shows attributes in the different scopes.
Request and Session sections are empty, because you still have not put any attributes in this scopes. If for example you put some attribute in the session scope, for example : session.setAttribute("user", someUserObject); it has to be shown there.
That is the meaning - example loops through all kind of scopes and shows the attributes in each one of them. Hope it will help you.
0
 
LVL 7

Author Comment

by:gudii9
ID: 38873009
>>> If for example you put some attribute in the session scope, for example : session.setAttribute("user", someUserObject); it has to be shown there.



I am looking for simple example which uses
pageContext.findAttribute



Can you please advise. Above example is still not clear why they are setting scopes( i thought scopes are implicit right, what is the necessity of declaring and assigning seperately) and then scope names and then simply printing.






How can i modify above code to make it more meaningful. Please advise
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HashTable highest marks enumeration alternative 9 48
web application structure 18 114
designing in object programming 12 106
by zero exception 10 70
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question