gudii9
asked on
jsp pageContext.findAttribute method
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.
Please advise. Any ideas, sample code, resources highly appreciated. Thanks
in advance.
ASKER
no link
ASKER
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.jspConfi g: org.apache.catalina.core.S tandardWra pperFacade @106daba
javax.servlet.jsp.jspRespo nse: org.apache.catalina.connec tor.Respon seFacade@1 021f34
javax.servlet.jsp.jspPageC ontext: org.apache.jasper.runtime. PageContex tImpl@4eb0 43
javax.servlet.jsp.jspSessi on: org.apache.catalina.sessio n.Standard SessionFac ade@163956
javax.servlet.jsp.jspReque st: org.apache.catalina.connec tor.Reques tFacade@10 e434d
javax.servlet.jsp.jspAppli cation: org.apache.catalina.core.A pplication ContextFac ade@16477d 9
javax.servlet.jsp.jspPage: org.apache.jsp.MyJsp_jsp@f 864fe
javax.servlet.jsp.jspOut: org.apache.jasper.runtime. JspWriterI mpl@1ae9aa a
In the Request scope:
In the Session scope:
In the Application scope:
org.apache.catalina.WELCOM E_FILES: [Ljava.lang.String;@2c17f7
javax.servlet.context.temp dir: C:\Users\ganesha\Workspace s\MyEclips e 10_workspace\.metadata\.me _tcat\work \Catalina\ localhost\ LoginApp
org.apache.catalina.jsp_cl asspath: /C:/Users/ganesha/Workspac es/MyEclip se%2010_wo rkspace/.m etadata/.m e_tcat/web apps/Login App/WEB-IN F/classes/ ;/C:/Users /ganesha/W orkspaces/ MyEclipse% 2010_works pace/.meta data/.me_t cat/webapp s/LoginApp /WEB-INF/l ib/javax.s ervlet.jsp .jstl.jar; /C:/Users/ ganesha/Wo rkspaces/M yEclipse%2 010_worksp ace/.metad ata/.me_tc at/webapps /LoginApp/ WEB-INF/li b/jsf-api. jar;/C:/Us ers/ganesh a/Workspac es/MyEclip se%2010_wo rkspace/.m etadata/.m e_tcat/web apps/Login App/WEB-IN F/lib/jsf- impl.jar;/ C:/Users/g anesha/Wor kspaces/My Eclipse%20 10_workspa ce/.metada ta/.me_tca t/webapps/ LoginApp/W EB-INF/lib /jstl-impl .jar;/C:/U sers/ganes ha/AppData /Local/MyE clipse/Com mon/plugin s/com.genu itec.eclip se.ws.xfir e_9.0.0.me 2012110115 50/lib/web services-a pi.jar;/C: /Users/gan esha/AppDa ta/Local/M yEclipse/C ommon/plug ins/com.ge nuitec.ecl ipse.ws.xf ire_9.0.0. me20121101 1550/lib/w ebservices -extra-api .jar;/C:/U sers/ganes ha/AppData /Local/MyE clipse/Com mon/plugin s/com.genu itec.eclip se.ws.xfir e_9.0.0.me 2012110115 50/lib/web services-e xtra.jar;/ C:/Users/g anesha/App Data/Local /MyEclipse /Common/pl ugins/com. genuitec.e clipse.ws. xfire_9.0. 0.me201211 011550/lib /webservic es-rt.jar; /C:/Users/ ganesha/Ap pData/Loca l/MyEclips e/Common/p lugins/com .genuitec. eclipse.ws .xfire_9.0 .0.me20121 1011550/li b/webservi ces-tools. jar;/C:/Us ers/ganesh a/AppData/ Local/MyEc lipse/Comm on/plugins /com.genui tec.eclips e.easie.to mcat.myecl ipse_9.0.0 .me2012110 11550/tomc at/lib/;/C :/Users/ga nesha/AppD ata/Local/ MyEclipse/ Common/plu gins/com.g enuitec.ec lipse.easi e.tomcat.m yeclipse_9 .0.0.me201 211011550/ tomcat/lib /annotatio ns-api.jar ;/C:/Users /ganesha/A ppData/Loc al/MyEclip se/Common/ plugins/co m.genuitec .eclipse.e asie.tomca t.myeclips e_9.0.0.me 2012110115 50/tomcat/ lib/catali na-ant.jar ;/C:/Users /ganesha/A ppData/Loc al/MyEclip se/Common/ plugins/co m.genuitec .eclipse.e asie.tomca t.myeclips e_9.0.0.me 2012110115 50/tomcat/ lib/catali na-ha.jar; /C:/Users/ ganesha/Ap pData/Loca l/MyEclips e/Common/p lugins/com .genuitec. eclipse.ea sie.tomcat .myeclipse _9.0.0.me2 0121101155 0/tomcat/l ib/catalin a-tribes.j ar;/C:/Use rs/ganesha /AppData/L ocal/MyEcl ipse/Commo n/plugins/ com.genuit ec.eclipse .easie.tom cat.myecli pse_9.0.0. me20121101 1550/tomca t/lib/cata lina.jar;/ C:/Users/g anesha/App Data/Local /MyEclipse /Common/pl ugins/com. genuitec.e clipse.eas ie.tomcat. myeclipse_ 9.0.0.me20 1211011550 /tomcat/li b/el-api.j ar;/C:/Use rs/ganesha /AppData/L ocal/MyEcl ipse/Commo n/plugins/ com.genuit ec.eclipse .easie.tom cat.myecli pse_9.0.0. me20121101 1550/tomca t/lib/jasp er-el.jar; /C:/Users/ ganesha/Ap pData/Loca l/MyEclips e/Common/p lugins/com .genuitec. eclipse.ea sie.tomcat .myeclipse _9.0.0.me2 0121101155 0/tomcat/l ib/jasper- jdt.jar;/C :/Users/ga nesha/AppD ata/Local/ MyEclipse/ Common/plu gins/com.g enuitec.ec lipse.easi e.tomcat.m yeclipse_9 .0.0.me201 211011550/ tomcat/lib /jasper.ja r;/C:/User s/ganesha/ AppData/Lo cal/MyEcli pse/Common /plugins/c om.genuite c.eclipse. easie.tomc at.myeclip se_9.0.0.m e201211011 550/tomcat /lib/jsp-a pi.jar;/C: /Users/gan esha/AppDa ta/Local/M yEclipse/C ommon/plug ins/com.ge nuitec.ecl ipse.easie .tomcat.my eclipse_9. 0.0.me2012 11011550/t omcat/lib/ servlet-ap i.jar;/C:/ Users/gane sha/AppDat a/Local/My Eclipse/Co mmon/plugi ns/com.gen uitec.ecli pse.easie. tomcat.mye clipse_9.0 .0.me20121 1011550/to mcat/lib/t omcat-coyo te.jar;/C: /Users/gan esha/AppDa ta/Local/M yEclipse/C ommon/plug ins/com.ge nuitec.ecl ipse.easie .tomcat.my eclipse_9. 0.0.me2012 11011550/t omcat/lib/ tomcat-dbc p.jar;/C:/ Users/gane sha/AppDat a/Local/My Eclipse/Co mmon/plugi ns/com.gen uitec.ecli pse.easie. tomcat.mye clipse_9.0 .0.me20121 1011550/to mcat/lib/t omcat-i18n -es.jar;/C :/Users/ga nesha/AppD ata/Local/ MyEclipse/ Common/plu gins/com.g enuitec.ec lipse.easi e.tomcat.m yeclipse_9 .0.0.me201 211011550/ tomcat/lib /tomcat-i1 8n-fr.jar; /C:/Users/ ganesha/Ap pData/Loca l/MyEclips e/Common/p lugins/com .genuitec. eclipse.ea sie.tomcat .myeclipse _9.0.0.me2 0121101155 0/tomcat/l ib/tomcat- i18n-ja.ja r;/C:/User s/ganesha/ AppData/Lo cal/MyEcli pse/Common /plugins/c om.genuite c.eclipse. easie.tomc at.myeclip se_9.0.0.m e201211011 550/tomcat /bin/boots trap.jar;/ C:/Users/g anesha/App Data/Local /MyEclipse /Common/bi nary/com.s un.java.jd k.win32.x8 6_1.6.0.01 3/lib/tool s.jar;/C:/ Users/gane sha/AppDat a/Local/My Eclipse/Co mmon/binar y/com.sun. java.jdk.w in32.x86_1 .6.0.013/j re/lib/ext /dnsns.jar ;/C:/Users /ganesha/A ppData/Loc al/MyEclip se/Common/ binary/com .sun.java. jdk.win32. x86_1.6.0. 013/jre/li b/ext/loca ledata.jar ;/C:/Users /ganesha/A ppData/Loc al/MyEclip se/Common/ binary/com .sun.java. jdk.win32. x86_1.6.0. 013/jre/li b/ext/sunj ce_provide r.jar;/C:/ Users/gane sha/AppDat a/Local/My Eclipse/Co mmon/binar y/com.sun. java.jdk.w in32.x86_1 .6.0.013/j re/lib/ext /sunmscapi .jar;/C:/U sers/ganes ha/AppData /Local/MyE clipse/Com mon/binary /com.sun.j ava.jdk.wi n32.x86_1. 6.0.013/jr e/lib/ext/ sunpkcs11. jar
org.apache.jasper.runtime. JspApplica tionContex tImpl: org.apache.jasper.runtime. JspApplica tionContex tImpl@d989 6e
org.apache.catalina.resour ces: org.apache.naming.resource s.ProxyDir Context@1c da59b
org.apache.AnnotationProce ssor: org.apache.catalina.util.D efaultAnno tationProc essor@3378 8d
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
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.jspConfi
javax.servlet.jsp.jspRespo
javax.servlet.jsp.jspPageC
javax.servlet.jsp.jspSessi
javax.servlet.jsp.jspReque
javax.servlet.jsp.jspAppli
javax.servlet.jsp.jspPage:
javax.servlet.jsp.jspOut: org.apache.jasper.runtime.
In the Request scope:
In the Session scope:
In the Application scope:
org.apache.catalina.WELCOM
javax.servlet.context.temp
org.apache.catalina.jsp_cl
org.apache.jasper.runtime.
org.apache.catalina.resour
org.apache.AnnotationProce
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
ASKER
is there is any other simple exaple to try please advise
ASKER
i could not find any good examples. please advise
The above example are some basic understanding examples . Can you clearly tell what kind of example you expect ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
>>> 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
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
http://82.157.70.109/mirrorbooks/javaserverpages24hours/0672325977_ch08lev1sec3.html