• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

struts module navigation problem

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI ALL,

In my application i am using struts module concept..

In the Home page I am having two links

1.<html:link forward="Guest" styleClass="linksorangebold">Emergency login</html:link>

2.<html:link forward="NewPatient" styleClass="linksorangebold">Patient registration</html:link>

---------------------
here is my web.xml
------------------
<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>
<init-param>
<param-name>config/pd</param-name>
<param-value>/WEB-INF/struts-pd-config.xml</param-value>
</init-param>

</servlet>

my struts-config.xml
------------------------
<global-forwards>
<forward
name="NewPatient"
path="/switch.do?page=/npregistration.do&prefix=/pd"/>

<forward
name="Guest"
path="emergencylogin.do"/>

</global-forwards>

<action-mappings>
<action
path="/emergencylogin"
parameter="/guestlogin.jsp"
type="org.apache.struts.actions.ForwardAction"/>

<action
path="/switch"
type="org.apache.struts.actions.SwitchAction"/>

</ation-mappings>

-----------------
struts-pd-config.xml
------------------------
<global-forwards>

<forward
name="NewPatient"
path="/patientregistration.jsp"/>
<forward
name="Home"
path="/switch.do?page=/home.do&prefix="/>

</global-forwards>

<action-mappings>

<action
path="/npregistration"
parameter="/patientregistration.jsp"
type="org.apache.struts.actions.ForwardAction"/>

<action
path="/switch"
type="org.apache.struts.actions.SwitchAction"/>


</action-mappings>
-----------------------------------

In home page when i click on emergency login ,emergency login is displayed,and same with the new Patient link.

In the New patient page i v link called
<html:link forward="Home" styleClass="linksorangebold">Home</html:link>

now when i click on Home from the new Patient page,Home page is displayed.
My problem is here,now when i am in home page and again click on emergency login link,following error is showing.

type Status report

message Invalid path /emergencylogin was requested

description The requested resource (Invalid path /emergencylogin was requested) is not available.

url showing in ths way...
http://localhost:8080/mystruts/pd/emergencylogin.do
instead of..
http://localhost:8080/mystruts/emergencylogin.do

where the misktake is?



All pages are directly benath WEB-INF

Help me out...

Regards
Sreenivas
 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when i placed the code

<html:link forward="Home" styleClass="linksorangebold" module="pd">Patient registration</html:link> following error occured

SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:446)
at org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:329)
at org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:475)
at org.apache.struts.taglib.html.LinkTag.doStartTag(LinkTag.java:334)
at org.apache.jsp.patientregistration_jsp._jspx_meth_html_link_0(org.apache.jsp.patientregistration_jsp:1012)
at org.apache.jsp.patientregistration_jsp._jspService(org.apache.jsp.patientregistration_jsp:714)
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you look at the fine print in the documentation, it says that module is only valid if the link refers to an action instead of a forward. I had briefly put up a post suggesting this, but deleted it after I re-read the documentation.

Why all this convoluted business with a forward calling the switch action which in turn calls another action? why not just do this?

<html:link action="/home" module="">home</html:link>
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi sreenivas
Merril is right and moreover you may also try
<forward
name="Guest"
path="/emergencylogin.do"/>

Please refer to the foll also.
http://mail-archives.apache.org/mod_mbox/struts-user/200507.mbox/%3Cdbv3mf$dtm$1@sea.gmane.org%3E
 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Merrilli and Roshani.

I gone thru documentation and placed this code

<html:link forward="Home" styleClass="linksorangebold" module="">

its working fine..

Thanks again..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic