aspose file tools*
The moose likes Struts and the fly likes not able to run jsp's using struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "not able to run jsp Watch "not able to run jsp New topic
Author

not able to run jsp's using struts

anthony ryan
Greenhorn

Joined: Sep 26, 2007
Posts: 11
Hi there,
I am learning how to use struts and I am not able to connect 2 jsps using struts, although both are working fine if I use them separately. I am using tomcat 5.0.28 and struts 1.3.8.
codes are as follows:

index.jsp
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<HTML>
<HEAD>
<TITLE>My Human Resources Portal</TITLE>
</HEAD>
<BODY>
<font size="+1"> My Human Resources Portal</font><br>
<hr width="100%" noshade="true">
Add an employee<br>
<html:link forward="search"> search for employees</html:link><br>
</BODY>
</HTML>

search.jsp
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<html>
<head><title>My Human resources portal - Employee search</title></head>
<body>
My human resources portal - employee search
<hr>
</body>
</html>

web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/WEB-INF/tlds/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location>
</taglib>

</web-app>
Tamas Jano
Ranch Hand

Joined: Feb 21, 2007
Posts: 55
Hi and welcome to the ranch!

Where is your struts-config file?
You have to register an action class in the web.xml and a configuration file with the action mappings.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Could you expand on "not able to connect 2 jsps using struts"? What error do you see in the browser?

- Brent
anthony ryan
Greenhorn

Joined: Sep 26, 2007
Posts: 11
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">

<struts-config>
<global-forwards>
<forward name="search" path="/search.jsp"/>
</global-forwards>
</struts-config>

this is my struts-config file

I am not sure, but I think I need to add reference of struts-config.xml in web.xml. If you guys think I should be then how can I add without using servlets.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
You should have entries in your web.xml that look something like this:



- Brent
anthony ryan
Greenhorn

Joined: Sep 26, 2007
Posts: 11
Dear Brent,
your code seems to be ok but I haven't started using servlet in my code yet. Only wants to join 2 jsps using struts. Is that possible.
anthony ryan
Greenhorn

Joined: Sep 26, 2007
Posts: 11
Dear Brent,
Thanks for your help. I have got it my mistake. It's all your help to got me over the problem. Thanks once again.
regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: not able to run jsp's using struts
 
Similar Threads
Tiles problem
Configuring First Struts Application
help on taglib and properties file in struts?
Struts basic
Struts module problem