• 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

MalformedURLException

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
my struts config file has
and my index.jsp has
when i click on html:link i get the following exception,
Cannot create rewrite URL: java.net.MalformedURLException: Cannot retrieve ActionForward named search
org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:479)
org.apache.struts.taglib.html.LinkTag.doStartTag(LinkTag.java:334)
org.apache.jsp.index_jsp._jspx_meth_html_link_0(index_jsp.java:97)
org.apache.jsp.index_jsp._jspService(index_jsp.java:72)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
thanks,
Shabarish
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Everything looks fine,
this script gets called ,



when your JSP page saw this ,




I'm worried about those double quotes , remove them !
And hope you are not using any module relative URI, because this is what Struts Docs says about html:link forward

The base URL for this hyperlink is calculated based on which of the following attributes you specify (you must specify exactly one of them):

* forward - Use the value of this attribute as the name of a global ActionForward to be looked up, and use the module-relative or context-relative URI found there. If the forward is module-relative then it must point to an action and NOT to a page.

 
shabarish vai
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
does html:link look only into global-forwardings? what in case if i want container to look into action mapping.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by shabarish vai:
does html:link look only into global-forwardings? what in case if i want container to look into action mapping.



Yes, It looks into Global ActionForwards and Local forwards can be nested within an <action> element and only available to an Action object when it is invoked through that ActionMapping.

and you post .

..when i click on html:link i get the following exception,
Cannot create rewrite URL: java.net.MalformedURLException: Cannot retrieve ActionForward named search
org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:479)..



I dont think this exception comes when you click on <html:link tag , This error comes when you load index.jsp, Am I correct ?
 
shabarish vai
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Sagar Rohankar,
am able to laod index.jsp and when i click on the link sometime i get he above mentioned exception , and when i changed the html form tag to struts form tag i get
where ever i use struts tags say html,form etc i get exception
thanks,
Shabarish
 
shabarish vai
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my search.jsp is


i get
 
shabarish vai
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if i use the search.jsp by removing struts tag to html tag like

am able to load search.jsp
i want to use struts tag anybody please help me
Thanks,
Shabarish
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by shabarish vai:
my search.jsp is


i get



You need to put action attribute in html:form tag and the post the server logs entry, which give better view of that particular exception !!
 
shabarish vai
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i actually made changes in html tld file ie inside attribute tag i changed the tag <required>true</required> to <required>false</required>
so that attribute in form tag(struts tag) is not mandatory and i can provide submit button and there i can foward it to different/same jsp.
when i use html tag am able to load search.jsp but its not same with struts tag.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by shabarish vai:
i actually made changes in html tld file ie inside attribute tag i changed the tag <required>true</required> to <required>false</required>
so that attribute in form tag(struts tag) is not mandatory



No NO, You cant do that ! Its prohibited to change the original schema/DTD unless and until you are not creator of your own Struts TAG !

This Struts TAG has there own working java TAG code, see this file, which comes with exception trace



So when that search.jsp file complies and run (when request comes for it ), The class FormTag.java (for html:form) throws an NPE , cause he's expecting an valid value for "action" variable , but it's not coming at all, because your DTD modifications !
 
shabarish vai
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
now will the control go inside <action> tag? if i provide html:form with action? like<html:form action="search.do">
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by shabarish vai:
now will the control go inside <action> tag? if i provide html:form with action?



provided, you revert the changes made in DTD !!

and , will works !
 
shabarish vai
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i made reverted back those changes and added action attribute my code in search.jsp is : am getting the following exception

please help am not able to proceed from this.
Thanks
Shabarish
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried to add a .do at the end (search.do)?
 
shabarish vai
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is how my html:form tag looks:

i have added .do at the end before only but am getting same exception
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Change it to


Try it .
 
If you're gonna buy things, buy this thing and I get a fat kickback:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic