Skip to content

map

March 3, 2011

Trying to push the war to webapps – but because the project was marked as tomcat project with the path and integration specified so the server.xml was modified with the Context element tag. So while the outputDirectory tag pushes the war to the output folder, the webappDirectory tag ensures that the contents of assembled webapp directory are copied over. Both of these are not required if project is integrated with tomcat in eclipse itself.

Then the mapping for the jsp file was not working for some reason? . Needed to switch on logging – so enabled dependency for slf4j and log4j. Attempting to first get jsp displayed and then the controller.

The problem was that you cannot get the jsp to be displayed directly without having the controller come into picture even if it is a plain vinalla jsp . The point is that if the control is passing through the DispatcherServlet then the handler for that should be existing – it cannot just pass it to the viewResolver without the controller.

 

Now issue was even after setting the urlFileNameController and the internalviewresolver the jsp was not being displayed. It was showing error as /snail/WEB-INF/jsp/home.jsp path not found.

The reason is the path setting in the internal view resolver. if you set prefix as :

/WEB-INF/jsp  – then this is a relative prefix- results in dispatcher path: /WEB-INF/jsp/home.jsp

If you set prefix as WEB-INF/jsp – then this is an absolute uri redirection : results in dispatcher path as  – WEB-INF/jsp/home.jsp

 

So the whole point is – in what format the redirection is taking place using the core RequestDispatcher class of the servlet API. Also , when one defines the mappings for the SimpleUrlHandlerMapping then the key should not include the servlet-mapping path – eg: not like /app/home but instead **/home/* or /home or home. That is also a point to take care for ensuring that uri mapping is found.

 

So then – the built in controller for this is URLFileNameViewController

read on maven clean prepare-package war:exploded

what is the goal and what is the phase?

when can we stop – how do we use the lifecycle list?

———–

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: