Back Forum Reply New

How to go to another view/controller in Spring MVC?

Hi!

IBM WebPortal 5.1

I'm currently developing a portlet in the above environment. Problem is I cannot figure out how to go to another page....

portlet.xml

Code:
lt;portletgt;     lt;portlet-namegt;startlt;/portlet-namegt;     lt;portlet-classgt;org..web.portlet.DispatcherPortletlt;/portlet-classgt;     lt;init-paramgt;        lt;namegt;contextConfigLocationlt;/namegt;        lt;valuegt;/WEB-INF/context/start-portlet.xmllt;/valuegt;     lt;/init-paramgt;     lt;supportsgt;        lt;mime-typegt;text/htmllt;/mime-typegt;        lt;portlet-modegt;viewlt;/portlet-modegt;        lt;portlet-modegt;editlt;/portlet-modegt;        lt;portlet-modegt;helplt;/portlet-modegt;     lt;/supportsgt;     lt;portlet-infogt;        lt;titlegt;Startlt;/titlegt;     lt;/portlet-infogt;  lt;/portletgt;
start-portlet.xml

Code:
lt;beansgt;

lt;!-- Controller --gt;

lt;bean id=quot;startControllerquot; class=quot;org.ki.biobank.bims.gt.portlet.StartPortletControllerquot;/gt;

lt;bean id=quot;snpClassFormControllerquot; class=quot;org.ki.biobank.bims.gt.portlet.SNPClassFormControllerquot;gt;       lt;property name=quot;commandNamequot; value=quot;snpclassformquot;/gt;       lt;property name=quot;commandClassquot; value=quot;org.ki.biobank.bims.gt.portlet.SNPClassFormBeanquot;/gt;       lt;property name=quot;sessionFormquot; value=quot;truequot;/gt;       lt;property name=quot;formViewquot; value=quot;/org_ki_biobank_bims_gt_portlet/jsp/html/create.jspquot; /gt;   lt;/beangt;

lt;!-- Handler Mapping --gt;

lt;bean id=quot;portletModeParameterHandlerMappingquot; class=quot;org..web.portlet.handler.PortletModeParameterHandlerMappingquot;gt;       lt;property name=quot;orderquot; value=quot;1quot;/gt;
lt;property name=quot;interceptorsquot;gt;
lt;listgt;
lt;ref bean=quot;parameterMappingInterceptorquot;/gt;
lt;/listgt;
lt;/propertygt;
lt;property name=quot;portletModeParameterMapquot;gt;
lt;mapgt;
lt;entry key=quot;viewquot;gt;
lt;mapgt;
lt;entry key=quot;createSnpClassquot; value-ref=quot;snpClassFormControllerquot;/gt;
lt;/mapgt;
lt;/entrygt;
lt;/mapgt;
lt;/propertygt;
lt;/beangt;

lt;bean id=quot;portletModeHandlerMappingquot; class=quot;org..web.portlet.handler.PortletModeHandlerMappingquot;gt;       lt;property name=quot;orderquot; value=quot;2quot;/gt;
lt;property name=quot;portletModeMapquot;gt;
lt;mapgt;
lt;entry key=quot;viewquot;gt;lt;ref bean=quot;startControllerquot;/gt;lt;/entrygt;
lt;/mapgt;
lt;/propertygt;
lt;/beangt;

lt;!-- Exception Handler --gt;

lt;bean id=quot;defaultExceptionHandlerquot; parent=quot;defaultExceptionHandlerTemplatequot;/gt;

lt;/beansgt;
This ucl should pass me to the 'create' view, but nothing happens...

Code:
lt;portlet:renderucl var=quot;createuclquot; portletMode=quot;viewquot;gt;   lt;portlet:param name=quot;actionquot; value=quot;createSnpClassquot;/gt;
lt;/portlet:renderuclgt;

lt;a hrcf=quot;${createucl}quot;gt;Skapalt;/agt;
What am I missing? No error messages that enlightens me....

As usual I haven't got the hang of when to use EL and when not to use them...

This works:

Code:
lt;portlet:renderucl var=quot;createuclquot; portletMode=quot;viewquot;gt;   lt;portlet:param name=quot;actionquot; value=quot;createSnpClassquot;/gt;
lt;/portlet:renderuclgt;

lt;a hrcf=quot;lt;cut value=quot;${createucl}quot; /gt;quot;gt;Skapalt;/agt;I guess it's an issue of the JSP version getting used. I can imagine it depends on the DTD/XSD declaraion in web.xml (=gt; servlet 2.3 or 2.4, similar for JSP).

What's the HTML output of the two different versions?

Jörg

The first one literal quot;/${createucl}quot; after server mumbo-jumbo, the other one afantastic long string after server mumbo-jumbo.

It is an issue of what version of JSP is being used.

Standard-1.1 (JSTL 1.1) requires a JSP container that supports the Java Servlet 2.4 and JavaServer Pages 2.0 specifications.  (taglibs/do...doc/intro.html)

This syntax pattern:

lt;a hrcf=quot;${createucl}quot;gt;Skapalt;/agt;

requires JSTL 1.1.

This is a simplification of the syntax required for older versions of JSTL, which looks like

lt;a hrcf=quot;lt;c: out value=quot;${createucl}quot; /gt;quot;gt;Skapalt;/agt;   (added space between : and out to avoid 'smiley')From your description, I assume you are working with an older version of JSTL.   There are no real issues with this, except you need to use the older syntax pattern.
¥
Back Forum Reply New