This has nothing to do with Struts. You have to put the source file in a folder structure that mirrors your package definition.
Nils-H On Fri, Jun 19, 2009 at 6:00 AM, Sam Wun<swun2...@gmail.com> wrote: > Hi, > > I have an Action java source code with package at the top of the > file. When I put the package line in the file, ant couldn't generate > any content in all *.xml files. > If I remove the package line from the java source code, all xml files > are generated, but without path (that come after the word of > "package"). > > Please see below for the source code without include the line of > "package..." in source file: > > # cat ./docroot/WEB-INF/src/OrderAction.java > //package com.ip6network.onlinepayment.struts.action; > > import java.io.IOException; > > import org.apache.struts.action.Action; > import org.apache.struts.action.ActionForward; > import org.apache.struts.action.ActionMapping; > import org.apache.struts.action.ActionForm; > > import javax.servlet.ServletException; > import javax.servlet.http.HttpServletRequest; > import javax.servlet.http.HttpServletResponse; > > > /** @struts.action name="orderForm" path="/orderUser" > * scope="request" > * validate="false" parameter="action" input="mainMenu" > * > * @struts.action-forward name="success" path="/next.jsp" > */ > > public class OrderAction extends Action{ > > public ActionForward execute(ActionMapping mapping,ActionForm > form, HttpServletRequest request, HttpServletResponse response) throws > IOException,ServletException{ > return mapping.findForward("success"); > } > } > > # cat build.xml > <?xml version="1.0"?> > > <project name="portlet" basedir="." default="deploy"> > <import file="../build-common-portlet.xml" /> > > <target name="compile"> > > <mkdir dir="docroot/WEB-INF/classes/" /> > <mkdir dir="docroot/WEB-INF/src/" /> > <path id="plugin-lib.classpath"> > <pathelement > location="${app.server.classes.portal.dir}" /> > <fileset dir="${app.server.lib.portal.dir}" > includes="*.jar" /> > <pathelement location="docroot/WEB-INF/classes" /> > > <fileset dir="${env.XDOCLET_HOME}"> > <include name="**/*.jar"/> > </fileset> > </path> > > <taskdef name="webdoclet" > classname="xdoclet.modules.web.WebDocletTask" > classpathref="plugin.classpath"> > </taskdef> > <webdoclet destdir="docroot/WEB-INF" > mergedir="metadata/web" excludedtags="@version,@author" > verbose="true"> > <fileset dir="docroot/WEB-INF/src"> > <include name="**/*Form.java" /> > <include name="**/*Action.java" /> > <include name="**/*Servlet.java" /> > </fileset> > <deploymentdescriptor validatexml="true" > servletspec="2.3" sessiontimeout="60" > destdir="WEB-INF" distributable="false"> > </deploymentdescriptor> > <strutsconfigxml validatexml="true" version="1.1"/> > <strutsvalidationxml/> > </webdoclet> > > <javac > classpathref="plugin.classpath" > compiler="${javac.compiler}" > debug="${javac.debug}" > deprecation="${javac.deprecation}" > destdir="docroot/WEB-INF/classes" > nowarn="${javac.nowarn}" > srcdir="docroot/WEB-INF/src" > > /> > > <antcall target="build-common-plugin.compile" /> > </target> > > <target name="build-lang"> > <antcall target="build-lang-cmd"> > <param name="lang.dir" > value="docroot/WEB-INF/src/content/test" /> > <param name="lang.file" value="Language" /> > </antcall> > </target> > </project> > > # pwd > /usr/liferay-portal-5.2.3/dev/portlets/online-payment/docroot/WEB-INF > twp1:WEB-INF # cat struts-config.xml > <?xml version="1.0" encoding="UTF-8" ?> > > <!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> > > <!-- ========== Data Sources Definitions > =================================== --> > <!-- > Define your Struts data sources in a file called > struts-data-sources.xml and place > it in your merge directory. > --> > > <!-- ========== Form Bean Definitions =================================== --> > <form-beans> > > <form-bean > name="OrderForm" > type="OrderForm" > /> > > <!-- > If you have non XDoclet forms, define them in a file called > struts-forms.xml and > place it in your merge directory. > --> > </form-beans> > > <!-- ========== Global Exceptions Definitions > =================================== --> > <!-- > Define your exceptions in a file called global-exceptions.xml and place > it in your merge directory. > --> > > <!-- ========== Global Forward Definitions > =================================== --> > <!-- > Define your forwards in a file called global-forwards.xml and place > it in your merge directory. > --> > > <!-- ========== Action Mapping Definitions > =================================== --> > <action-mappings> > <action > path="/orderUser" > type="OrderAction" > name="orderForm" > scope="request" > input="mainMenu" > parameter="action" > unknown="false" > validate="false" > > > <forward > name="success" > path="/next.jsp" > redirect="false" > /> > </action> > > <!-- If you have non XDoclet actions, define them in a file called > struts-actions.xml and place it in your merge directory. --> > </action-mappings> > > <!-- Define your Struts controller in a file called > struts-controller.xml and place it in your merge directory. --> > > <!-- Define your Struts message-resources in a file called > struts-message-resources.xml and place it in your merge directory. --> > > <!-- Define your Struts plugins in a file called struts-plugins.xml > and place it in your merge directory. --> > > </struts-config> > > # cat validation.xml > <?xml version="1.0" encoding="UTF-8" ?> > <!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD > Commons Validator Rules Configuration 1.1//EN" > "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd"> > > <form-validation> > <!-- > Define global validation config in validation-global.xml > --> > <formset> > <!-- > Define form validation config in validation-forms.xml > --> > > <form name="OrderForm"> > <field property="query" > depends="required"> > <msg > name="required" > key="query.required"/> > > <arg0 key="OrderForm.query"/> > </field> > </form> > </formset> > </form-validation> > > > When the line "package..." is written at the top of my java source > code, all xml config files are only written with xdoclet default > values, without the value of struts tags from the java source files. > > My expected result in the xml files for example: > > # cat struts-config.xml > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD > Struts Configuration 1.2//EN" > "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd"> > > <struts-config> > <form-beans> > <form-bean name="OrderForm" > type="com.ip6network.onlinepayment.struts.action.OrderForm"></form-bean> > </form-beans> > <action-mappings> > <action path="/contact_us_portlet/input" > type="com.ip6network.onlinepayment.struts.action.OrderAction" > name="OrderForm" scope="session" validate="true" > input="/portlet/order_portlet/input.jsp"> > <forward name="/order_portlet/input" > path="/portlet/order_portlet/input.jsp"></forward> > <forward name="/order_portlet/help" > path="/portlet/order_portlet/help.jsp"></forward> > </action> > <action path="/contact_us_portlet/help" > type="com.ip6network.onlinepayment.struts.action.OrderAction"> > <forward name="/order_portlet/help" > path="/portlet/order_portlet/help.jsp"></forward> > </action> > </action-mappings> > <message-resources parameter="resources.application" > null="true"></message-resources> > <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> > <set-property property="pathnames" > value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"></set-property> > </plug-in> > </struts-config> > > How to generate a struts-config.xml file or validation.xml files with the > correct value of "path" and "type" included like the example I shown > above? > > Your help is much appreciated. > Thanks > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org