Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 17th, 2006, 09:16 AM
Authorized User
 
Join Date: Apr 2005
Location: Arequipa, Arequipa, Peru.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem wit struts and spring

Hello guys

the spring forum section , is almost empty, so here is better :p

i am in hell trying to run a simple test with Spring and struts
i have already readed an important chapter from abook and this
web page http://www-128.ibm.com/developerwork...ary/j-sr2.html,
both have almost the same content

here is my web.xml,located in tomcat5.5.8/webapps/projectname/WEB-INF/

Code:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">


<web-app>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
                /WEB-INF/xml/applicationContext.xml
                /WEB-INF/xml/applicationContext-db.xml
                /WEB-INF/xml/applicationContext-hibernate.xml 
                /WEB-INF/xml/applicationContext-scheduling.xml
                /WEB-INF/xml/applicationContext-javamail.xml 
                /WEB-INF/xml/applicationContext-aop.xml
                /WEB-INF/applicationContext-servlet.xml
        </param-value>
    </context-param>
    <servlet>
        <servlet-name>context</servlet-name>
        <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>applicationContext</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
              <param-name>config</param-name>
              <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>    

    <servlet-mapping>
        <servlet-name>applicationContext</servlet-name>
        <url-pattern>*.html</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>applicationContext</servlet-name>
        <url-pattern>*.tile</url-pattern>    
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>applicationContext</servlet-name>
        <url-pattern>*.xml</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>applicationContext</servlet-name>
        <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <welcome-file-list>

        <welcome-file>jsp/login.jsp</welcome-file>
        <welcome-file>/jsp/login.jsp</welcome-file>
    </welcome-file-list>

    <taglib>
        <taglib-uri>/WEB-INF/tlds/struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>/WEB-INF/tlds/struts-bean.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
    </taglib>    
    <taglib>
        <taglib-uri>/WEB-INF/tlds/struts-logic.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/tlds/struts-tiles.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-tiles.tld</taglib-location>
    </taglib>        
</web-app>
here my struts-config.xml located in tomcat5.5.9/webapps/projectname/WEB-INF/

check please that only applicationContext-servlet.xml is in the WEB-INF and the
others context's are in the "xml folder"

Code:
<?xml version="1.0"?>

<!DOCTYPE struts-config PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
  "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>
    <form-beans>
          <form-bean name="loginForm" 
                    type="com.actionforms.LoginForm" />                      
         </form-beans>

    <global-forwards>
        <forward name="inicio" path="inicio.page" />
    </global-forwards>

    <action-mappings>    
    <!--
        <action path="/inicio" 
                type="org.apache.struts.actions.ForwardAction" 
                parameter="inicio.page" />    
                -->                        
        <action path="/loginAction"
                type="org.springframework.web.struts.DelegatingActionProxy" 
                name="loginForm"
                scope="request"
                validate="true"
                input="/jsp/login.jsp">
            <exception     key="error.exception.MiLoginException"
                        type="com.bo.Excepciones.MiLoginException"
                        path="/jsp/login.jsp"/>
            <exception key="error.exception.MiGlobalException"
                           type="com.bo.Excepciones.MiGlobalException"
                           path="/jsp/login.jsp" />            
            <forward name="loginAction" path="inicio.page"/>
        </action>
    </action-mappings>        
    <message-resources parameter="ApplicationResources"/>



    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames"
                  value="/WEB-INF/xml/validator-rules.xml,/WEB-INF/xml/validation.xml"/>
    </plug-in>

   <plug-in className="org.apache.struts.tiles.TilesPlugin">
        <set-property property="definitions-config" value="/WEB-INF/xml/tiles-defs.xml"/>
        <set-property property="moduleAware" value="true" />
        <set-property property="definitions-parser-validate" value="true" />
        <set-property property="definitions-debug" value="2" />
   </plug-in> 

   <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
        <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext-servlet.xml"/>
   </plug-in>     
</struts-config>
and to end the mentionated applicationContext-servlet.xml
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
    <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles.TilesConfigurer">
        <property name="definitions">
            <list>
                <value>/WEB-INF/xml/tiles-defs.xml</value>
            </list>
        </property>
    </bean>        
    <bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
        <property name="basename">
                <value>views</value>
        </property>    
    </bean>    
    <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename">
                <value>messages</value>
        </property>
    </bean>    
    <bean name="/loginAction" class="com.jordan.actions.LoginAction">
        <property name="defaultLoginManager">
                <ref bean="idLoginManager"/>
        </property>
    </bean>    
</beans>
i only want to work with struts, if i comment viewResolver and messageSource i have the same results above

i dont have any error of compilation (using eclipse compiler for tomcat) or ant, the ubications of the files with the path
is all correct!

well this is the error , when i write this in my browser http://localhost:8080/springtest/
should load jsp/login.jsp or if even i write http://localhost:8080/springtest/jsp/login.jsp
show this error (note ,not appear nohing in the console window for the tomcat report and neither in the log file of the tomcat)

(i translated to english)

Code:
STATE HTTP 404 -

type Inform of state

message

description: the required resource () is not available

Apache Tomcat/5.5.9
yes "()" ???? whats mean????
this is my login.jsp

but before inclusive if i write http://localhost:8080/springtest/jsp/ i can see and select some files included the login.jsp
,so if i choice the jsp file i recieve the same message error

Code:
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<html>
    <head>
        <title>Login</title>
        <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/jsp/utilerias/css/micss.css" />
    </head>

    <body>
        <center>
        <html:errors/>
        <html:form action="/loginAction" focus="usr">
        <table>        
            <tr>
                <td>
                    <bean:message key="label.login.usr"/>
                </td>
                <td>
                    <html:text property="usr"/>
                </td>
            </tr>
            <tr>
                <td>
                    <bean:message key="label.login.pwdusr"/>
                </td>
                <td>
                    <html:password property="pwdusr"/>        
                </td>
            <tr>
        </table>
        <html:submit/>
        </html:form>    
    </body>
    </center>
</html>
so, what could be wrong???? , i dont have any idea

thanks so much for advanced

LIVE AT POMPEII 1972
__________________
LIVE AT POMPEII 1972
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is advantageous of spring over struts jomet Spring 2 April 29th, 2010 10:27 AM
There is already an open datareader associated wit yasinirshad ADO.NET 1 August 12th, 2007 03:37 AM
There is already an open DataReader associated wit jayanp ADO.NET 1 July 2nd, 2006 01:10 PM
Spring Integration with Struts Demeter Struts 0 May 31st, 2006 05:31 PM
There is already an open DataReader associated wit flyin ADO.NET 14 February 20th, 2004 07:41 AM



All times are GMT -4. The time now is 07:38 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.