aspose file tools*
The moose likes Struts and the fly likes calling action while loading the home page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "calling action while loading the home page" Watch "calling action while loading the home page" New topic
Author

calling action while loading the home page

abheeshek reddy
Ranch Hand

Joined: Nov 28, 2008
Posts: 41
I have an application in which i have to load a set values while loading the page itself.

below is the code i wrote


welcome.jsp

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<script>
function getAction(){
alert('inside getAction');
var i = document.forms[0].action="/getAction.do";

alert(i);
document.forms[0].action=request.getContextPath+"/getAction";
document.forms[0].submit();
}

</script>

<html:html locale="true">
<head>
<title><bean:message key="welcome.title"/></title>
<html:base/>
</head>
<body bgcolor="white" onLod="getAction()">

<html:form action="/getAction">

<table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" >
<tr>
<%@ include file="top.jsp"%>
</tr>

<tr>
<td VALIGN=TOP WIDTH="17%">
<table BORDER=2 CELLSPACING=0 CELLPADDING=0 WIDTH="137" BGCOLOR="WHITE" >
<tr>
<td HEIGHT="2"> </td>
</tr>

<tr ALIGN=LEFT>

</tr>

<tr ALIGN=LEFT>
<td><a href="advantage.htm" ><CENTER>JDBC</CENTER></a></td>
</tr>
<tr>
<html:submit/>
</tr>

<tr ALIGN=LEFT>
<td><a href="students.htm" ><CENTER>SERVLETS</CENTER></a></td>
</tr>

<tr ALIGN=LEFT>
<td><a href="curriculum.htm" ><CENTER>JSP</CENTER></a></td>
</tr>

<tr ALIGN=LEFT>
<td><a href="faculty.htm" ><CENTER>STRUTS</CENTER></a></td>
</tr>

<tr ALIGN=LEFT>
<td><a href="visitors.htm" ><CENTER>SPRING</CENTER></a></td>
</tr>

<tr ALIGN=LEFT>
<td HEIGHT="7"><a href="press.htm" ><CENTER>HIBERNATE</CENTER></a></td>
</tr>

<tr ALIGN=LEFT>
<td HEIGHT="23"><a href="contact.htm" ><CENTER>EJB</CENTER></a></td>
</tr>

<tr ALIGN=LEFT>
<td HEIGHT="23"> </td>
</tr>
</table>

</td>
<td valign="top">Here is the space for insertion create a table and insert
</td>

</tr>



<logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">
<font color="red">
ERROR: Application resources not loaded -- check servlet container
logs for error messages.
</font>
</logic:notPresent>

<h3><bean:message key="welcome.heading"/></h3>

<tr>
<center><%@ include file="./footer.jsp"%></center>
</tr>
</table>
</html:form>
</body>
</html:html>

Struts-config.xml
<action
path="/getAction"
name="TopicListForm"
scope="session"
input="/pages/Welcome.jsp"
type="roseindia.web.struts.action.TopicListAction">
<forward name="success" path="/pages/Welcome.jsp"/>
</action>


<form-bean name="TopicListForm"
type="roseindia.web.struts.form.TopicListForm">
</form-bean>


project is my root folder.

pages and web-inf are sub-folders

welcome.jsp is in pages folder
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8866
    
    8

And your problem is?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
abheeshek reddy
Ranch Hand

Joined: Nov 28, 2008
Posts: 41
Thanks

My problem is ....My action is not called.

I am not sure what is happening, No error messages in console or logs..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: calling action while loading the home page