Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Struts issue

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I click the link as shown in the jsp file below I expect the console to print the System.out.println in the handler class but the struts application does not do anything it shows up a blank HTML file. I have put the same contents in a <html:form> tag just below it and it also does not print anything on the console and shows a blank page.

<------------------- struts-config.xml -------------------->

<form-bean name="availableClassesForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="toDo" type="java.lang.String"/>
</form-bean>


<action
name="availableClassesForm"
path="/availableclasses"
scope="request" parameter="toDo"
type="org.stjude.hc.onlineregistration.action.viewclasses.ViewAvaliableClassesHandler"
validate="false">
<forward name="Success" path="/webFront/jsp/class/AvailableClasses.jsp"/>
</action>

<-------------------------jsp ---------------->

<a href="<c:url value="/availableclasses.do"><c aram name="toDo" value="viewAvailableClasses"/> </c:urlAvailable Classes 2</span></a>




<html:form action="/availableclasses.do">
<html:hidden property="toDo" value="viewAvailableClasses"/>
<a href="javascript ocument.availableClassesForm.submit()"> Available Classes </a>
</html:form>



<-------------------- Handler --------------------->

public class ViewAvaliableClassesHandler extends RegistrationAction {
public ActionForward viewAvailableClasses(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
System.out.println("toDo view Available Classes");


return mapping.findForward(FORWARD_Success);
}
}
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I remember the system.out.printlin issue was part of my studies for SCWCD.
I forget what the reason but use "out" or the ServletConext.log().

Darn the amount of infomation cluterting my mind.
 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Opps it's later than I thought. forget about writting to out.
 
Santosh Ramachandrula
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter I did not get your point! Can u please explain it again. System.out.println() works in the other handlers. Problems seems to be with form-bean or action setting.
 
Author
Posts: 93
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Santosh,

My guess is that you are never even getting to the Action class. Did you throw this in a debugger and step through to see if you ever get to the action class. Usually when you get to a blank screen, something is causing Struts to never get to handler.

Thanks,
John
 
Santosh Ramachandrula
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
John,
Thanks for the response. Exactly it is not going to the handler class. I want to figure what exactly is going on. I don't see any exceptions on the browser/console.
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Santosh Ram:
I don't see any exceptions on the browser/console.




<html:form action="/availableclasses.do">
<html:hidden property="toDo" value="viewAvailableClasses"/>
<a href="javascript ocument.availableClassesForm.submit()"> Available Classes </a>
</html:form>




Why you cong action with "="/availableclasses.do" ???

I think ,In web.xml have some servlet-mapping with *.do pattern-url or not
 
Santosh Ramachandrula
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I do have *.do url pattern mapping web.xml
 
Run away! Run away! Here, take this tiny ad with you:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic