Differences

This shows you the differences between two versions of the page.

Link to this comparison view

java:new-app [06/03/2015 14:28]
Anthony Arents [JSP Pages]
java:new-app [04/10/2017 11:37] (current)
Anthony Arents [New Java Web Applications]
Line 1: Line 1:
 ====== New Java Web Applications ====== ====== New Java Web Applications ======
 +
 +End of life December 2016.
  
 If you are making a company project : If you are making a company project :
Line 14: Line 16:
   * Tomcat 7   * Tomcat 7
   * Use Java 7 for compiling, I recommend Java 8 for running tomcat (no permgen errors) ;-).   * Use Java 7 for compiling, I recommend Java 8 for running tomcat (no permgen errors) ;-).
 +
 +Tomcat settings \\ 
 +<code>-Xmx2048m -Xms512m -XX:MaxPermSize=768m -Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true</code>
  
 ====== Package structure : ====== ====== Package structure : ======
Line 438: Line 443:
 ===== web.xml : ===== ===== web.xml : =====
  
-Now we need the following in our ''WEB-INF/web.xml''+Now we need the following in our ''WEB-INF/web.xml'' \\  
 +Remove Spring Security if you are not using it!
  
 <code xml><?xml version="1.0" encoding="UTF-8"?> <code xml><?xml version="1.0" encoding="UTF-8"?>
Line 1295: Line 1301:
     </bean>     </bean>
          
-    <bean id="loginController" class="de.jcpis.analyse.presentation.LoginController">+    <bean id="loginController" class="be.mentoringsystems.applicationname.presentation.LoginController">
         <property name="methodNameResolver" ref="paramResolver" />         <property name="methodNameResolver" ref="paramResolver" />
         <property name="loginService" ref="loginService" />         <property name="loginService" ref="loginService" />
 +    </bean>
 +
 +    <bean id="indexController" class="org.springframework.web.servlet.mvc.ParameterizableViewController">
 +        <property name="viewName" value="app" />
     </bean>     </bean>
  
     <bean id="urlFileViewer" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"></bean>     <bean id="urlFileViewer" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"></bean>
 +
 +    <bean id="jspViewResolver"
 +   class="org.springframework.web.servlet.view.InternalResourceViewResolver">
 + <property name="prefix" value="/WEB-INF/jsp/"/>
 + <property name="suffix" value=".jsp" />
 +    </bean>
  
     <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">     <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
Line 1306: Line 1322:
         <property name="mappings">         <property name="mappings">
             <props>             <props>
-                <prop key="/login.html">loginController</prop> 
                 <prop key="/login.json">loginController</prop>                 <prop key="/login.json">loginController</prop>
 +                <prop key="/">indexController</prop>
             </props>             </props>
         </property>         </property>
Line 1317: Line 1333:
  
 ====== JSP Pages ====== ====== JSP Pages ======
 +===== Login =====
  
 Add ''login.jsp'' to ''/WEB-INF/jsp'' \\  Add ''login.jsp'' to ''/WEB-INF/jsp'' \\ 
Line 1348: Line 1365:
                 </div>                 </div>
         </form>         </form>
-</div>+</div></div>
     </body>     </body>
 </html> </html>
 </code> </code>
  
 +You are free to change the implementation of the loginpage, \\ 
 +you'll find it easier to rely on an old fashioned form submit to login a user, the system will then redirect to app.html (app.jsp)
 +===== App =====
 +
 +Add ''app.jsp'' to ''/WEB-INF/jsp'' \\ 
 +
 +this should be the index.html of your extjs application
 ====== Static resources (javascript, css, ...) ====== ====== Static resources (javascript, css, ...) ======
  
Line 1592: Line 1616:
         <security:intercept-url pattern="/ws/**" filters="none" />         <security:intercept-url pattern="/ws/**" filters="none" />
         <security:intercept-url pattern="/login.html" filters="none" />         <security:intercept-url pattern="/login.html" filters="none" />
-        <security:intercept-url pattern="/j_spring_security_switch_user" filters="ROLE_ADMIN" />+        <security:intercept-url pattern="/j_spring_security_switch_user" access="ROLE_ADMIN" />
         <!-- useful if we need app.html to also be available for anonymous users -->         <!-- useful if we need app.html to also be available for anonymous users -->
         <!--security:intercept-url pattern="/app.html" access="ROLE_ANONYMOUS, ROLE_USER" /-->         <!--security:intercept-url pattern="/app.html" access="ROLE_ANONYMOUS, ROLE_USER" /-->