Premetto che sono un neofita in Struts........
Vorrei creare una pagina di benvenuto (welcome.jsp) con un button e al click di questo pulsante andare sulla pagina "login.jsp".
Come faccio? Devo creare una action? come la creo?
La pagina di welcome l'ho creata così:
mentre il fle struts-config.xml è questo:codice:<%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <html:html lang="true"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title><bean:message key="welcome.title"/></title> <html:base/> </head> <body style="background-color: white"> <html:form action="login.do"> <logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application"> <div style="color: red"> ERROR: Application resources not loaded -- check servlet container logs for error messages. </div> </logic:notPresent> <h3><bean:message key="welcome.heading"/></h3> <bean:message key="welcome.message"/></p> <html:submit value="Avanti"/> </html:form> </body> </html:html>
ma ottengo il seguente errore:codice:<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd"> <struts-config> <form-beans> </form-beans> <global-exceptions> </global-exceptions> <global-forwards> <forward name="welcome" path="/Welcome.do"/> </global-forwards> <action-mappings> <action path="/Welcome" forward="/welcomeStruts.jsp"/> <action path="/Login" forward="/login.jsp"/> </action-mappings> <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/> <message-resources parameter="com/myapp/struts/ApplicationResource"/> <!-- This plugin initialize Tiles definition factory. This later can takes some parameters explained here after. The plugin first read parameters from web.xml, thenoverload them with parameters defined here. All parameters are optional. The plugin should be declared in each struts-config file. - definitions-config: (optional) Specify configuration file names. There can be several comma separated file names (default: ?? ) - moduleAware: (optional - struts1.1) Specify if the Tiles definition factory is module aware. If true (default), there will be one factory for each Struts module. If false, there will be one common factory for all module. In this later case, it is still needed to declare one plugin per module. The factory will be initialized with parameters found in the first initialized plugin (generally the one associated with the default module). true : One factory per module. (default) false : one single shared factory for all modules - definitions-parser-validate: (optional) Specify if xml parser should validate the Tiles configuration file. true : validate. DTD should be specified in file header (default) false : no validation Paths found in Tiles definitions are relative to the main context. --> <plug-in className="org.apache.struts.tiles.TilesPlugin" > <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" /> <set-property property="moduleAware" value="true" /> </plug-in> <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/> </plug-in> </struts-config>
Cannot retrieve mapping for action: "/login"
saluti
tulipan

Rispondi quotando