java - Accessing my Spring session from a JSP -
so, i'm using spring, , have following in spring-servlet.xml:
<bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/jsp/" /> <property name="suffix" value=".jsp" /> <property name="exposecontextbeansasattributes" value="true" /> </bean>
so have session object, thingy. i'm not call it.
@controller @sessionattributes({"cpsession"}) public class mycontroller { /** * controller uses aforementioned proprietary session object * * @return mycontrollersession */ @modelattribute("cpsession") public mycontrollersession createform() { // instantiate session object mycontrollersession sess = new mycontrollersession (); return sess; }
this sess object has method i'd call, .mymethod().
i'd call method jsp.
here's i've got:
<% myobject mo = cpsession.mymethod(); %>
my ide, eclipse, telling me cpsession can't resolved, right since don't know how access session object thing.
what mycontrollersession , how can access jsp?
<% myobject mo = ((mycontrollersession) session.getattribute("cpsession")).mymethod(); %>
Comments
Post a Comment