• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

<global-forwards> problem in struts-config.xml

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the below code. but i am getting below error. Please help me on this.

requested resource () is not available.

Thanks



<html:link forward="register">Register</html:link>

<global-forwards>
<forward name="register" path="/onClickRegister"/>

</global-forwards>

<action-mappings>
<action path="/onClickRegister" forward="Register.page"/>
<action path="/onClickURL" forward="Register.page"/>
<action path="/submitRegisterForm" type="com.example.registerAction" name="registerActionForm" scope="session" validate="true" input="Register.page">
<forward name="failure" path="Register.page"/>
<forward name="success" path="Success.page"/>
</action>

</action-mappings>

<definition name="Register.page" path="/siteLayOut.jsp">
<put name="title" value="Welcome to Online Bank"/>
<put name="Header" value="/Register/Header.jsp"/>
<put name="menuBar" value="/Register/menuBar1.jsp"/>
<put name="Body" value="/Register/Register.jsp"/>
<put name="Footer" value="/Register/Footer.jsp"/>
</definition>
 
Ranch Hand
Posts: 50
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just thinking.. did you declare action forms in your struts-config???
 
hari ann
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is my struts-config.xml.


<struts-config>
<form-beans>
<form-bean name="registerActionForm" type="org.apache.struts.validator.DynaValidatorActionForm">
<form-property name="userid" type="java.lang.String"/>
<form-property name="password" type="java.lang.String"/>
<form-property name="email" type="java.lang.String"/>
<form-property name="address" type="java.lang.String"/>
<form-property name="phno" type="java.lang.String"/>
</form-bean>

</form-beans>

<global-exceptions>

</global-exceptions>

<global-forwards>
<forward name="register" path="/onClickRegister"/>

</global-forwards>

<action-mappings>
<action path="/onClickRegister" forward="Register.page"/>
<action path="/onClickURL" forward="Register.page"/>
<action path="/submitRegisterForm" type="com.example.registerAction" name="registerActionForm" scope="session" validate="true" input="Register.page">
<forward name="failure" path="Register.page"/>
<forward name="success" path="Success.page"/>
</action>

</action-mappings>

<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

<message-resources parameter="com/myapp/struts/ApplicationResource"/>

<!-- ========================= Tiles plugin ===============================-->
<!--
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="com.example.HibernatePlugin">
<set-property property="path" value="/hibernate.cfg.xml" />
</plug-in>


<!-- ========================= Validator plugin ================================= -->
<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>
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's handy to post code inside code tags so it's more legible, and remove unneeded things like 30-line comment blocks and so on.
 
hari ann
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

sorry for posting very lengthy odd code.I updated struts-config.xml and posted latest one.Could you please tell me where it went wrong

<struts-config>
<form-beans>
<form-bean name="registerActionForm" type="org.apache.struts.validator.DynaValidatorActionForm">
<form-property name="userid" type="java.lang.String"/>
<form-property name="password" type="java.lang.String"/>
<form-property name="email" type="java.lang.String"/>
<form-property name="address" type="java.lang.String"/>
<form-property name="phno" type="java.lang.String"/>
</form-bean>
<form-bean name="signInActionForm" type="org.apache.struts.validator.DynaValidatorActionForm">
<form-property name="userid" type="java.lang.String"/>
<form-property name="password" type="java.lang.String"/>
</form-bean>

</form-beans>

<global-exceptions>

</global-exceptions>

<global-forwards>
<forward name="login" path="/onClickLogIn.do" />
</global-forwards>

<action-mappings>
<action path="/onClickRegister" forward="Register.page"/>
<action path="/onClickURL" forward="Register.page"/>
<action path="/onClickLogIn.do" forward="LogIn.page"/>

<action path="/onClickSignIn" type="com.example.signInAction" name="signInActionForm" scope="session" validate="true" input="LogIn.page">
<forward name="success" path="Success.page"/>
<forward name="failure" path="LogIn.page"/>
</action>

<action path="/submitRegisterForm" type="com.example.registerAction" name="registerActionForm" scope="session" validate="true" input="Register.page">
<forward name="failure" path="Register.page"/>
<forward name="success" path="Success.page"/>
</action>

</action-mappings>

<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

<message-resources parameter="com/myapp/struts/ApplicationResource"/>

<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="com.example.HibernatePlugin">
<set-property property="path" value="/hibernate.cfg.xml" />
</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>

Example.jsp


<td ><html:link forward="login">LogIn</html:link></td>

tiles-def.xml

<definition name="LogIn.page" path="/siteLayOut.jsp">
<put name="title" value="LogIn Page"/>
<put name="Header" value="/LogIn/Header.jsp"/>
<put name="menuBar" value="/LogIn/menuBar.jsp"/>
<put name="Body" value="/LogIn/LogIn.jsp"/>
<put name="Footer" value="/LogIn/Footer.jsp"/>
</definition>




 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's the code, tidied and put inside code tags--much easier to read. Also, it's best to disable HTML in posts containing... HTML.

Some initial thoughts:

- The login action should not have the ".do" in the action mapping.
- Have you confirmed the link is rendering properly?
- Does the JSP page with the link contain the HTML taglib directive?
 
It runs on an internal combustion engine. This ad does not:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic