aspose file tools*
The moose likes Struts and the fly likes Struts 2 'dojo is not defined' .....? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 Watch "Struts 2 New topic
Author

Struts 2 'dojo is not defined' .....?

prabhu pandurangan
Ranch Hand

Joined: May 23, 2008
Posts: 120

Hi Ranchers,
Im using struts-2.0.6-core.jar, freemarker,ognl,common-logging, xwork jar for struts 2 application.

JSP page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Struts 2 Login Application!</title>


<s:head theme="ajax"/>
<link href="<s:url value="/css/main.css"/>" rel="stylesheet" type="text/css"/>
</head>
<body>
<s:tabbedPanel id="rtb">

<s iv id="1" label="Administration" theme="ajax" labelposition="top">
<br>RTB Administration
</s iv>

<s iv id="admin" label="User" theme="ajax" href="setProfile.action"
refreshOnShow="true">
hjhfsjkdh
</s iv>

<s iv id="prov" label="Provisioning" theme="ajax">
fafdsfas
</s iv>
</s:tabbedPanel>
</body>

</html>

But if i run it, i get an error in firefox console; as 'dojo is not defined'
I tried a lot but i could not rectify it.
But the same code works fine for my friend.

Im not sure what is going wrong in myself.

Please anyone provide me some solutions.

Looking forward for Ranchers reply.

Thanks and Regards,
Prabhu.
Abdullah Ahmed
Greenhorn

Joined: May 11, 2008
Posts: 7
Hi prabhu,

I'm using struts-2.0.11-core.jar, freemarker, ognl, common-logging, xwork jar for struts 2 application and Apache Tomcat web server version 6.0.16, and every thing working probably there are no error.

I advise you to use Struts 2.0.11.1 which is the "best available" version of Struts.

Please do not hesitated to contact me.

Abdullah Ahmed.


Please do not hesitated to contact me.<br /> <br />Abdullah Ahmed.
prabhu pandurangan
Ranch Hand

Joined: May 23, 2008
Posts: 120

Hi Hameed,
Thank you very much for your reply. But by using tomcat 6.0.16 and struts 2.0.11 you did not face any problems. Also have you used <s:tabbedPanel> and those things. But it worked very well in tomcat 6.0.14 and tomcat 5.5 also, may be struts 2.0.6 might be the reason. Ok Hameed i will try it and let you know. But please can you explain me about the error message which I have mentioned in my last post. 'dojo is not defined'


Thanks and Regards,
Prabhu.

prabhu pandurangan
Ranch Hand

Joined: May 23, 2008
Posts: 120

Hi Hameed,
I tried using tomcat 6.0.16 and struts-2.0.11-core.jar; but still i face the same problem. 'dojo is not defined'. Im struggling a lot, Looking forward for early response.

Abdullah Ahmed
Greenhorn

Joined: May 11, 2008
Posts: 7
Hi prabhu,

If you want send to me your project and i will test it.

Thank you.
prabhu pandurangan
Ranch Hand

Joined: May 23, 2008
Posts: 120

Action class:

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

import com.opensymphony.xwork2.ActionSupport;
import java.util.Date;


/**
* <p> Validate a user login. </p>
*/
public class Login extends ActionSupport {


public String execute() throws Exception
{
System.out.println("Validating login");
if(!getUsername().equals("Admin") || !getPassword().equals("Admin"))
{
addActionError("Invalid user name or password! Please try again!");
return ERROR;
}
else
{
return SUCCESS;
}
}


// ---- Username property ----

/**
* <p>Field to store User username.</p>
* <p/>
*/
private String username = null;


/**
* <p>Provide User username.</p>
*
* @return Returns the User username.
*/
public String getUsername() {
return username;
}

/**
* <p>Store new User username</p>
*
* @param value The username to set.
*/
public void setUsername(String value) {
username = value;
}

// ---- Username property ----

/**
* <p>Field to store User password.</p>
* <p/>
*/
private String password = null;


/**
* <p>Provide User password.</p>
*
* @return Returns the User password.
*/
public String getPassword() {
return password;
}

/**
* <p>Store new User password</p>
*
* @param value The password to set.
*/
public void setPassword(String value) {
password = value;
}

}
******************************************************

Struts.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<package name="default" extends="struts-default">

<action name="login">
<result>login.jsp</result>
</action>

<action name="doLogin" class="Login">
<result name="input">/login.jsp</result>
<result name="error">/login.jsp</result>
<result>/loginsuccess.jsp</result>
</action>

</package>
</struts>

********************************************************

Login.jsp:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Struts 2 Login Application!</title>


<s:head theme="ajax"/>
<link href="<s:url value="/css/main.css"/>" rel="stylesheet" type="text/css"/>
</head>
<body>
<s:tabbedPanel id="rtb">

<s iv id="1" label="Administration" theme="ajax" labelposition="top">
<br>RTB Administration
</s iv>

<s iv id="admin" label="User" theme="ajax" href="setProfile.action"
refreshOnShow="true">
hjhfsjkdh
</s iv>

<s iv id="prov" label="Provisioning" theme="ajax">
fafdsfas
</s iv>
</s:tabbedPanel>
</body>

</html>

********************************************************888

web.xml:

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>

******************************************************************

And jar files have been included under my WEB-INF/lib.....
1. struts-2.0.11-core.jar, freemarker-2.3.8.jar, common-logging1.1.jar,ognl-2.6.11.jar,xwork-2.0.4.jar

Please im wasting more than a week, but before also i was facing this error 'dojo is not defined', but for my friend he is working in 'LINUX' machine and for him it is working fine and when i got the same project from him and ran it in my machine it is working fine and im not sure what i have changed in it, now it is not working. Very very urgent Ahmeed.

Looking forward for your reply.

Thanks.


prabhu pandurangan
Ranch Hand

Joined: May 23, 2008
Posts: 120

Hi Ahmed,

In my jsp page, within the tabbedPanel is the div tag. FYI.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 'dojo is not defined' .....?