aspose file tools
The moose likes Struts and the fly likes Struts issue Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Struts issue" Watch "Struts issue" New topic
Author

Struts issue

Santosh Ramachandrula
Ranch Hand

Joined: Apr 04, 2004
Posts: 252
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);
}
}


Thanks,
Santosh
peter cooke
Ranch Hand

Joined: Mar 16, 2004
Posts: 310
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.


CIAO Peter M. Cooke
peter cooke
Ranch Hand

Joined: Mar 16, 2004
Posts: 310
Opps it's later than I thought. forget about writting to out.
Santosh Ramachandrula
Ranch Hand

Joined: Apr 04, 2004
Posts: 252
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.
John Carnell
Author
Ranch Hand

Joined: Sep 27, 2002
Posts: 71
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


John Carnell<br />Principal Architect<br /> <br />Netchange, LLC<br />1161 HillCrest Heights<br />Green Bay, WI 54313<br /> <br />john.carnell@netchange.us<br /> <br /> <br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/159059228X/ref=jranch-20" target="_blank" rel="nofollow">Pro Jakarta Struts, Second Edition</a>
Santosh Ramachandrula
Ranch Hand

Joined: Apr 04, 2004
Posts: 252
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.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
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


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Santosh Ramachandrula
Ranch Hand

Joined: Apr 04, 2004
Posts: 252
Yes I do have *.do url pattern mapping web.xml
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Struts issue
 
Similar Threads
action mapping problem
help with validation framework
Struts Buttons
hi
Unable to find setter method for attribute: locale