You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mead Lai <la...@msn.com> on 2008/02/29 03:10:16 UTC

about servlet and wicket-spring sequence

Hi,
    I have a Servlet "ViewSurvey.do", it access the Spring Context from wicket Application.
MyApplication app = (MyApplication) RequestCycle.get().getApplication();

but there is some thing strange:
1,if I visit the Servlet "ViewSurvey.do" first, It will cause some error, and all the application is down
2,if I visit the Wicket application first, It's OK, and then I visit the  the Servlet "ViewSurvey.do", the servlet is OK

Maybe it's relation about the servlet start-up sequence. I really couldn't find the reason at all.






the following is my web.xml file






	CMS Message System

	

	
		applicationBean
		wicketApplication
	
	
		contextConfigLocation
		
			/WEB-INF/applicationContext.xml,/WEB-INF/cms-Context.xml,
		
	
	
		encodingFilter
		
			org.springframework.web.filter.CharacterEncodingFilter
		
		
			encoding
			GB2312
		
		
			forceEncoding
			false
		
	
	
		encodingFilter
		*.*
	
	
		org.springframework.web.context.ContextLoaderListener
	
	
		WicketApplication
		
			org.apache.wicket.protocol.http.WicketServlet
		
		
			applicationFactoryClassName
			org.apache.wicket.spring.SpringWebApplicationFactory
			
		
		1
	
	

	
		SurveyAction
		
			cn.meadlai.cms.servlet.survey.SurveyAction
		
		3
	

	
		ViewSurvey
		
			cn.meadlai.cms.servlet.survey.ViewSurvey
		
		3
	

	
	
		SurveyAction
		/surveyAction.do
	
	
		ViewSurvey
		/viewSurvey.do
	
	
	
	
		WicketApplication
		/manage/*.html
	

	
		index.html
	


_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: about servlet and wicket-spring sequence

Posted by James Carman <ja...@carmanconsulting.com>.
The context loader listener will put the Spring context into the
ServletContext at application startup.  You can access it via the
org.springframework.web.context.support.WebApplicationContextUtils
class.  You don't need Wicket at all for this.


On 2/28/08, Mead Lai <la...@msn.com> wrote:
>
>  Hi,
>     I have a Servlet "ViewSurvey.do", it access the Spring Context from wicket Application.
>  MyApplication app = (MyApplication) RequestCycle.get().getApplication();
>
>  but there is some thing strange:
>  1,if I visit the Servlet "ViewSurvey.do" first, It will cause some error, and all the application is down
>  2,if I visit the Wicket application first, It's OK, and then I visit the  the Servlet "ViewSurvey.do", the servlet is OK
>
>  Maybe it's relation about the servlet start-up sequence. I really couldn't find the reason at all.
>
>
>
>
>
>
>  the following is my web.xml file
>
>
>
>
>
>
>         CMS Message System
>
>
>
>
>                 applicationBean
>                 wicketApplication
>
>
>                 contextConfigLocation
>
>                         /WEB-INF/applicationContext.xml,/WEB-INF/cms-Context.xml,
>
>
>
>                 encodingFilter
>
>                         org.springframework.web.filter.CharacterEncodingFilter
>
>
>                         encoding
>                         GB2312
>
>
>                         forceEncoding
>                         false
>
>
>
>                 encodingFilter
>                 *.*
>
>
>                 org.springframework.web.context.ContextLoaderListener
>
>
>                 WicketApplication
>
>                         org.apache.wicket.protocol.http.WicketServlet
>
>
>                         applicationFactoryClassName
>                         org.apache.wicket.spring.SpringWebApplicationFactory
>
>
>                 1
>
>
>
>
>                 SurveyAction
>
>                         cn.meadlai.cms.servlet.survey.SurveyAction
>
>                 3
>
>
>
>                 ViewSurvey
>
>                         cn.meadlai.cms.servlet.survey.ViewSurvey
>
>                 3
>
>
>
>
>                 SurveyAction
>                 /surveyAction.do
>
>
>                 ViewSurvey
>                 /viewSurvey.do
>
>
>
>
>                 WicketApplication
>                 /manage/*.html
>
>
>
>                 index.html
>
>
>
>  _________________________________________________________________
>  Express yourself instantly with MSN Messenger! Download today it's FREE!
>  http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: about servlet and wicket-spring sequence

Posted by Mead Lai <la...@msn.com>.
sorry, the xml had been Escaped. I send it again
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE web-app      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"      "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app> <display-name>CMS Message System</display-name>
 <!-- The following should be deleted at last! -->
 <context-param>  <param-name>applicationBean</param-name>  <param-value>wicketApplication</param-value> </context-param> <context-param>  <param-name>contextConfigLocation</param-name>  <param-value>   /WEB-INF/applicationContext.xml,/WEB-INF/cms-Context.xml,  </param-value> </context-param> <filter>  <filter-name>encodingFilter</filter-name>  <filter-class>   org.springframework.web.filter.CharacterEncodingFilter  </filter-class>  <init-param>   <param-name>encoding</param-name>   <param-value>GB2312</param-value>  </init-param>  <init-param>   <param-name>forceEncoding</param-name>   <param-value>false</param-value>  </init-param> </filter> <filter-mapping>  <filter-name>encodingFilter</filter-name>  <url-pattern>*.*</url-pattern> </filter-mapping> <listener>  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!--  Spring context  <servlet>  <servlet-name>context</servlet-name>  <servlet-class>  org.springframework.web.conte
 xt.ContextLoaderServlet  </servlet-class>  <load-on-startup>1</load-on-startup>  </servlet> --> <servlet>  <servlet-name>WicketApplication</servlet-name>  <servlet-class>   org.apache.wicket.protocol.http.WicketServlet  </servlet-class>  <init-param>   <param-name>applicationFactoryClassName</param-name>   <param-value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value>   <!--<param-value>cn.meadlai.may.main.MyApplication</param-value>  -->  </init-param>  <load-on-startup>0</load-on-startup> </servlet> <!-- SurveyAction Here -->
 <servlet>  <servlet-name>SurveyAction</servlet-name>  <servlet-class>   cn.meadlai.cms.servlet.survey.SurveyAction  </servlet-class>  <load-on-startup>4</load-on-startup> </servlet>
 <servlet>  <servlet-name>ViewSurvey</servlet-name>  <servlet-class>   cn.meadlai.cms.servlet.survey.ViewSurvey  </servlet-class>  <load-on-startup>3</load-on-startup> </servlet>
 <!-- SurveyAction End --> <!--FCK config start-->
 <servlet>  <servlet-name>Connector</servlet-name>  <servlet-class>   com.fredck.FCKeditor.connector.ConnectorServlet  </servlet-class>  <init-param>   <param-name>baseDir</param-name>   <param-value>/UserFiles/</param-value>  </init-param>  <init-param>   <param-name>debug</param-name>   <param-value>true</param-value>  </init-param>  <load-on-startup>1</load-on-startup> </servlet>
 <servlet>  <servlet-name>SimpleUploader</servlet-name>  <servlet-class>   com.fredck.FCKeditor.uploader.SimpleUploaderServlet  </servlet-class>  <init-param>   <param-name>baseDir</param-name>   <param-value>/UserFiles/</param-value>  </init-param>  <init-param>   <param-name>debug</param-name>   <param-value>true</param-value>  </init-param>  <init-param>   <param-name>enabled</param-name>   <param-value>true</param-value>  </init-param>  <init-param>   <param-name>AllowedExtensionsFile</param-name>   <param-value>jpg|gif|jpeg|png|bmp|swf|fla</param-value>  </init-param>  <init-param>   <param-name>DeniedExtensionsFile</param-name>   <param-value></param-value>  </init-param>  <init-param>   <param-name>AllowedExtensionsImage</param-name>   <param-value>jpg|gif|jpeg|png|bmp</param-value>  </init-param>  <init-param>   <param-name>DeniedExtensionsImage</param-name>   <param-value></param-value>  </init-param>  <init-param>   <param-name>AllowedExtensionsFlash</param-name>   
 <param-value>swf|fla</param-value>  </init-param>  <init-param>   <param-name>DeniedExtensionsFlash</param-name>   <param-value></param-value>  </init-param>  <load-on-startup>1</load-on-startup> </servlet>
 <servlet-mapping>  <servlet-name>Connector</servlet-name>  <url-pattern>   /editor/filemanager/browser/default/connectors/jsp/connector  </url-pattern> </servlet-mapping>
 <servlet-mapping>  <servlet-name>SimpleUploader</servlet-name>  <url-pattern>   /editor/filemanager/upload/simpleuploader  </url-pattern> </servlet-mapping>
 <!--FCK config end--> <servlet-mapping>  <servlet-name>SurveyAction</servlet-name>  <url-pattern>/surveyAction.do</url-pattern> </servlet-mapping> <servlet-mapping>  <servlet-name>ViewSurvey</servlet-name>  <url-pattern>/viewSurvey.do</url-pattern> </servlet-mapping>  <!-- wicket mapping here --> <servlet-mapping>  <servlet-name>WicketApplication</servlet-name>  <url-pattern>/manage/*.html</url-pattern> </servlet-mapping>
 <welcome-file-list>  <welcome-file>/manage/index.html</welcome-file> </welcome-file-list></web-app>> From: laiqinyi@msn.com> To: users@wicket.apache.org> Subject: about servlet and wicket-spring sequence> Date: Fri, 29 Feb 2008 10:10:16 +0800> > > Hi,> I have a Servlet "ViewSurvey.do", it access the Spring Context from wicket Application.> MyApplication app = (MyApplication) RequestCycle.get().getApplication();> > but there is some thing strange:> 1,if I visit the Servlet "ViewSurvey.do" first, It will cause some error, and all the application is down> 2,if I visit the Wicket application first, It's OK, and then I visit the the Servlet "ViewSurvey.do", the servlet is OK> > Maybe it's relation about the servlet start-up sequence. I really couldn't find the reason at all.> > >
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/