You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Mok <mo...@hotmail.com> on 2001/01/29 16:58:13 UTC

Server Port Problem HELP

Hi

Sorry to post such a long email. I am absolutely stump with a session
problem that have been bugging my STRUTS based application.

I have encountered some session persistence problem with my application
trying to track if the user has logged on. I am not sure if it is due to the
fact that the website uses Tomcat 3.1 or STRUTS.

My application presents a logon page which when the user logons on
successfully, a session is created and a "user" object stored in the session

eg LogonAction.class
    HttpSession session = request.getSession();
    session.setAttribute(Constants.USER_KEY, user);

Next the application will forward the user to the main page. User can then
click on an action such "view data from a table" which will forward to an
action class to display the rows.


All my action class check if  the "user" object exists within the session
otherwise they will be directed to the logon page.

eg ShowColumnAction.class

 org.teatimej.initialise.User user = (org.teatimej.initialise.User)
session.getAttribute(Constants.USER_KEY);
 if (user == null) {
  if (servlet.getDebug() >= 1)
      servlet.log(" User is not logged on in session "
                      + session.getId());
  return (servlet.findForward("logon"));
 }

The odd thing here is that user will always be directed back to the logon
page upon clicking on the first action URL on the main page. However after
they logon the second time, all action URL works fine.

The website support personnel said that it could be due to the fact that my
URL have a server port attached even though the server port is port 80.

I noticed that my logon form does not have a base html tag (if that may be
the problem) and the form URL (does not contain port 80) is

http://www.webappcabaret.com/teatimej/logon_wac.jsp

The form action (after logon_wac.jsp is displayed on the browser) is

<form name="logonForm" method="POST" action="logonwac.do">

The URL found on the main page have the following URL

<a href="http://webappcabaret.com:80/teatimej/edittable.do?action=new">

The subsequent logon form action (logon_wac.jsp) is

<form name="logonForm" method="POST"
action="logonwac.do;jsessionid=To1015mC34669985688752114At">

What have I done to STRUTS such that the logon page above includes a
jsessionid as compared to the first logon exact form (but with no
jsessionid) ?

I have been advised by the website support personnel to remove the port
number from the URL.

I check the STRUTS link tag and found that the server port is always append
to the server name. Here is the code where STRUTS builds up the URL..

RequestUtils.class

    public static String absoluteURL(HttpServletRequest request, String
path) {

        try {
            URL url = new URL(request.getScheme(),
                              request.getServerName(),
                              request.getServerPort(),
                              request.getContextPath() + path);
            return (url.toString());
        } catch (MalformedURLException e) {
            return (null);
        }

    }

I cannot see any option to instruct STRUTS not to include the serverport
when building the URL. However the server port may be a red herring.

Have I got off the rails?

TIA

Michael Mok
www.webappcabaret.com/teatimej

Re: JSP probleme

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
"Steven D. Wilkinson" wrote:

>
> Maybe Craig can answer you direct concern about 'error-less version' as compared
> to 0.5 version?
>

My feeling is that the currently nightly builds are pretty solid -- several bugs in
0.5 have been fixed here, and the new code seems to work well for lots of folks.

You can still use the 0.5 syntax, but this will only be supported through version 1.0
-- I would suggest using the new syntax for any current development efforts.

Craig



Re: JSP probleme

Posted by "Steven D. Wilkinson" <st...@acm.org>.
Fredric,

I started with a sample application.  I'm going to use it for a production
version once the specifications are complete.  FYI, I watch the commits on the
struts-dev list to see if any of the fixes are bugs that I'm having.  I suggest
the same especially when you are in production.

If you start with 1.0 now and you need to deploy later in February I would think
you would be ok.  I can't comment on error-less.  I know there have been
significant changes since 0.5 that make it easier to use.  BTW, I'm told that
1.0 supports the 0.5 syntax.

Maybe Craig can answer you direct concern about 'error-less version' as compared
to 0.5 version?

I assume, since you have looked at this quite a while you don't have the
struts.jar in your classpath right?

Sorry I was of no help.  You will have to wait for one of the more 'seasoned'
people to help.

Steve

Frederic BAGES wrote:
> 
>         Thank you Steven for your remarks. I had checked all of these before
> sending my first mail but it was not any of these. I've tried anything i had
> in mind and now it's working. I don't really know why but i think it can be
> a case (not all in uppercase ?) problem on the WEB-INF directory (I'm using
> a Win.. named OS that don't show the case in the file explorer).
> 
>         You also said that struts 1.0 is comming soon but do you think it can be
> considered as an error-less version ? (i.e. can I use it on a production
> server ?)
> 
>         Frederic
> 
> -----Message d'origine-----
> De : Steven D. Wilkinson [mailto:stevendwilkinson@acm.org]
> Envoyé : lundi 29 janvier 2001 18:38
> À : struts-user@jakarta.apache.org
> Objet : Re: JSP probleme
> 
> Which version of struts are you using?
> 
> Note my answer is how you do it in struts 1.0 (actually form the 01-28-2001
> source download)
> I'm not sure how to do it in 0.5.  If you are just starting and trying to
> use
> 0.5, I suggest you start with one of the nightly source distributions
> because
> 1.0 should be released shortly.  Just some bug fixes and documentation
> updates
> as I hear on the mail lists.
> 
> That said....
> 
> The tag library descriptors must be in your WEB-INF and registered in your
> web.xml and you must reference them properly in the JSP page.
> 
> <tomcat-home>/webapps/animation/WEB-INF/struts-bean.tld
>                                         struts-html.tld
>                                         struts-logic.tld
>                                         struts-template.tld
>                                         struts.tld
> In your web.xml
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <!DOCTYPE web-app
>   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> 
> <web-app>
>   .. other stuff here Note, refer to DTD about location of taglib.  it's at
> the
> bottom if you are not using any ejb stuff.
>   <!-- Struts Tag Library Descriptors -->
>   <taglib>
>     <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
>     <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
>   </taglib>
> 
>   <taglib>
>     <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
>     <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
>   </taglib>
> 
>   <taglib>
>     <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
>     <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
>   </taglib>
> 
> </web-app>
> 
> You only need to enter the ones that you are using.  This is from the
> struts-example/WEB-INF/web.xml file.
> 
> Then in you JSP page put this...
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
> 
> Note, the file in the uri determines the name and location of the tlds.  The
> prefix is upto you.
> 
> Good luck,
> Steve
> 
> Frederic BAGES wrote:
> >
> >  Hi all, i'm new to Struts and i have i problem that seems to concern
> Tomcat
> > and Struts.
> >
> >         I've installed Strut and the two exemples WAR files under tomcat
> 3.2. the
> > exemples are just running fine but when i try to run my own jsp file i
> have
> > an error from the jsp compiler.
> >
> > org.apache.jasper.compiler.CompileException:
> > C:\jakarta-tomcat-3.2.1\webapps\animation\logon.jsp(1,0) Unable to open
> > taglibrary /WEB-INF/struts.tld : Could not locate TLD META-INF/taglib.tld
> >         at
> >
> org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve
> > ntListener.java, Compiled Code)
> >         at
> >
> org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList
> > ener.java:116)
> >         at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java,
> Compiled
> > Code)
> >         at org.apache.jasper.compiler.Parser.parse(Parser.java, Compiled
> Code)
> >         at org.apache.jasper.compiler.Parser.parse(Parser.java:1042)
> >         at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
> >         at org.apache.jasper.compiler.Compiler.compile(Compiler.java,
> Compiled
> > Code)
> >         at
> org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
> >         .....
> >
> >  My JSP file and the corresponding classes (LogonForm and LogonAction) are
> > just copies of the examples with some little changes.
> >
> >         Does anyone could help me ?
> >
> >         Thanks.
> >
> >         Frederic.
> >
> > The JSP file is following :
> >
> > <%@ page language="java" %>
> > <%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
> >
> > <html>
> > <head>
> > <title>Titletitle>
> > </head>
> > <body bgcolor="white">
> >
> > <struts:errors/>
> >
> > <struts:form action="logon.do" name="logonForm" focus="username"
> >                type="com.infusio.gamezilla.portal.LogonForm">
> > <table border="0" width="100%">
> >
> >   <tr>
> >     <th align="right">
> >       User name :
> >     </th>
> >     <td align="left">
> >       <struts:text property="username" size="16" maxlength="16"/>
> >     </td>
> >   </tr>
> >
> >   <tr>
> >     <th align="right">
> >       Password :
> >     </th>
> >     <td align="left">
> >       <struts:password property="password" size="16" maxlength="16"/>
> >     </td>
> >   </tr>
> >
> >   <tr>
> >     <td align="right">
> >       <struts:submit property="submit" value="Submit"/>
> >     </td>
> >     <td align="left">
> >       <struts:reset/>
> >     </td>
> >   </tr>
> >
> > </table>
> >
> > </struts:form>
> >
> > </body>
> > </html>

-- 
-----------------------------------------------------------------
Steven D. Wilkinson, stevendwilkinson@acm.org

RE: JSP probleme - ms windows specific

Posted by Frederic BAGES <fr...@in-fusio.com>.
	Yes, it was what I would have done if i could, but i can't manage to make
it fail now. Remeber that under windows (and dos i think)  you don't really
control how your names are stored. I've just tried under dos and all is
written using upercase characters ... But you know, I'm a mad guy : I'm just
programming under Win 98. Yes, I know, devil is my master ;-)

	Frederic


-----Message d'origine-----
De : Justin Kennedy [mailto:justink@consortio.com]
Envoyé : lundi 29 janvier 2001 19:18
À : struts-user@jakarta.apache.org
Objet : RE: JSP probleme - ms windows specific


If you really really think it's a case problem, go to a dos window and check
out the offending directory. dos won't hide the case from you.

-----Original Message-----
From: Frederic BAGES [mailto:fredba@in-fusio.com]
Sent: Monday, January 29, 2001 9:49 AM
To: struts-user@jakarta.apache.org
Subject: RE: JSP probleme




	Thank you Steven for your remarks. I had checked all of these before
sending my first mail but it was not any of these. I've tried anything i had
in mind and now it's working. I don't really know why but i think it can be
a case (not all in uppercase ?) problem on the WEB-INF directory (I'm using
a Win.. named OS that don't show the case in the file explorer).

	You also said that struts 1.0 is comming soon but do you think it can be
considered as an error-less version ? (i.e. can I use it on a production
server ?)

	Frederic


-----Message d'origine-----
De : Steven D. Wilkinson [mailto:stevendwilkinson@acm.org]
Envoyé : lundi 29 janvier 2001 18:38
À : struts-user@jakarta.apache.org
Objet : Re: JSP probleme


Which version of struts are you using?

Note my answer is how you do it in struts 1.0 (actually form the 01-28-2001
source download)
I'm not sure how to do it in 0.5.  If you are just starting and trying to
use
0.5, I suggest you start with one of the nightly source distributions
because
1.0 should be released shortly.  Just some bug fixes and documentation
updates
as I hear on the mail lists.

That said....

The tag library descriptors must be in your WEB-INF and registered in your
web.xml and you must reference them properly in the JSP page.

<tomcat-home>/webapps/animation/WEB-INF/struts-bean.tld
                                        struts-html.tld
                                        struts-logic.tld
                                        struts-template.tld
                                        struts.tld
In your web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
  .. other stuff here Note, refer to DTD about location of taglib.  it's at
the
bottom if you are not using any ejb stuff.
  <!-- Struts Tag Library Descriptors -->
  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>

</web-app>

You only need to enter the ones that you are using.  This is from the
struts-example/WEB-INF/web.xml file.

Then in you JSP page put this...
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

Note, the file in the uri determines the name and location of the tlds.  The
prefix is upto you.

Good luck,
Steve


Frederic BAGES wrote:
>
>  Hi all, i'm new to Struts and i have i problem that seems to concern
Tomcat
> and Struts.
>
>         I've installed Strut and the two exemples WAR files under tomcat
3.2. the
> exemples are just running fine but when i try to run my own jsp file i
have
> an error from the jsp compiler.
>
> org.apache.jasper.compiler.CompileException:
> C:\jakarta-tomcat-3.2.1\webapps\animation\logon.jsp(1,0) Unable to open
> taglibrary /WEB-INF/struts.tld : Could not locate TLD META-INF/taglib.tld
>         at
>
org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve
> ntListener.java, Compiled Code)
>         at
>
org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList
> ener.java:116)
>         at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java,
Compiled
> Code)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java, Compiled
Code)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:1042)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
>         at org.apache.jasper.compiler.Compiler.compile(Compiler.java,
Compiled
> Code)
>         at
org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
>         .....
>
>  My JSP file and the corresponding classes (LogonForm and LogonAction) are
> just copies of the examples with some little changes.
>
>         Does anyone could help me ?
>
>         Thanks.
>
>         Frederic.
>
> The JSP file is following :
>
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
>
> <html>
> <head>
> <title>Titletitle>
> </head>
> <body bgcolor="white">
>
> <struts:errors/>
>
> <struts:form action="logon.do" name="logonForm" focus="username"
>                type="com.infusio.gamezilla.portal.LogonForm">
> <table border="0" width="100%">
>
>   <tr>
>     <th align="right">
>       User name :
>     </th>
>     <td align="left">
>       <struts:text property="username" size="16" maxlength="16"/>
>     </td>
>   </tr>
>
>   <tr>
>     <th align="right">
>       Password :
>     </th>
>     <td align="left">
>       <struts:password property="password" size="16" maxlength="16"/>
>     </td>
>   </tr>
>
>   <tr>
>     <td align="right">
>       <struts:submit property="submit" value="Submit"/>
>     </td>
>     <td align="left">
>       <struts:reset/>
>     </td>
>   </tr>
>
> </table>
>
> </struts:form>
>
> </body>
> </html>


RE: JSP probleme - ms windows specific

Posted by Justin Kennedy <ju...@consortio.com>.
If you really really think it's a case problem, go to a dos window and check
out the offending directory. dos won't hide the case from you.

-----Original Message-----
From: Frederic BAGES [mailto:fredba@in-fusio.com]
Sent: Monday, January 29, 2001 9:49 AM
To: struts-user@jakarta.apache.org
Subject: RE: JSP probleme




	Thank you Steven for your remarks. I had checked all of these before
sending my first mail but it was not any of these. I've tried anything i had
in mind and now it's working. I don't really know why but i think it can be
a case (not all in uppercase ?) problem on the WEB-INF directory (I'm using
a Win.. named OS that don't show the case in the file explorer).

	You also said that struts 1.0 is comming soon but do you think it can be
considered as an error-less version ? (i.e. can I use it on a production
server ?)

	Frederic


-----Message d'origine-----
De : Steven D. Wilkinson [mailto:stevendwilkinson@acm.org]
Envoyé : lundi 29 janvier 2001 18:38
À : struts-user@jakarta.apache.org
Objet : Re: JSP probleme


Which version of struts are you using?

Note my answer is how you do it in struts 1.0 (actually form the 01-28-2001
source download)
I'm not sure how to do it in 0.5.  If you are just starting and trying to
use
0.5, I suggest you start with one of the nightly source distributions
because
1.0 should be released shortly.  Just some bug fixes and documentation
updates
as I hear on the mail lists.

That said....

The tag library descriptors must be in your WEB-INF and registered in your
web.xml and you must reference them properly in the JSP page.

<tomcat-home>/webapps/animation/WEB-INF/struts-bean.tld
                                        struts-html.tld
                                        struts-logic.tld
                                        struts-template.tld
                                        struts.tld
In your web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
  .. other stuff here Note, refer to DTD about location of taglib.  it's at
the
bottom if you are not using any ejb stuff.
  <!-- Struts Tag Library Descriptors -->
  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>

</web-app>

You only need to enter the ones that you are using.  This is from the
struts-example/WEB-INF/web.xml file.

Then in you JSP page put this...
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

Note, the file in the uri determines the name and location of the tlds.  The
prefix is upto you.

Good luck,
Steve


Frederic BAGES wrote:
>
>  Hi all, i'm new to Struts and i have i problem that seems to concern
Tomcat
> and Struts.
>
>         I've installed Strut and the two exemples WAR files under tomcat
3.2. the
> exemples are just running fine but when i try to run my own jsp file i
have
> an error from the jsp compiler.
>
> org.apache.jasper.compiler.CompileException:
> C:\jakarta-tomcat-3.2.1\webapps\animation\logon.jsp(1,0) Unable to open
> taglibrary /WEB-INF/struts.tld : Could not locate TLD META-INF/taglib.tld
>         at
>
org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve
> ntListener.java, Compiled Code)
>         at
>
org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList
> ener.java:116)
>         at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java,
Compiled
> Code)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java, Compiled
Code)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:1042)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
>         at org.apache.jasper.compiler.Compiler.compile(Compiler.java,
Compiled
> Code)
>         at
org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
>         .....
>
>  My JSP file and the corresponding classes (LogonForm and LogonAction) are
> just copies of the examples with some little changes.
>
>         Does anyone could help me ?
>
>         Thanks.
>
>         Frederic.
>
> The JSP file is following :
>
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
>
> <html>
> <head>
> <title>Titletitle>
> </head>
> <body bgcolor="white">
>
> <struts:errors/>
>
> <struts:form action="logon.do" name="logonForm" focus="username"
>                type="com.infusio.gamezilla.portal.LogonForm">
> <table border="0" width="100%">
>
>   <tr>
>     <th align="right">
>       User name :
>     </th>
>     <td align="left">
>       <struts:text property="username" size="16" maxlength="16"/>
>     </td>
>   </tr>
>
>   <tr>
>     <th align="right">
>       Password :
>     </th>
>     <td align="left">
>       <struts:password property="password" size="16" maxlength="16"/>
>     </td>
>   </tr>
>
>   <tr>
>     <td align="right">
>       <struts:submit property="submit" value="Submit"/>
>     </td>
>     <td align="left">
>       <struts:reset/>
>     </td>
>   </tr>
>
> </table>
>
> </struts:form>
>
> </body>
> </html>


RE: JSP probleme

Posted by Frederic BAGES <fr...@in-fusio.com>.

	Thank you Steven for your remarks. I had checked all of these before
sending my first mail but it was not any of these. I've tried anything i had
in mind and now it's working. I don't really know why but i think it can be
a case (not all in uppercase ?) problem on the WEB-INF directory (I'm using
a Win.. named OS that don't show the case in the file explorer).

	You also said that struts 1.0 is comming soon but do you think it can be
considered as an error-less version ? (i.e. can I use it on a production
server ?)

	Frederic


-----Message d'origine-----
De : Steven D. Wilkinson [mailto:stevendwilkinson@acm.org]
Envoyé : lundi 29 janvier 2001 18:38
À : struts-user@jakarta.apache.org
Objet : Re: JSP probleme


Which version of struts are you using?

Note my answer is how you do it in struts 1.0 (actually form the 01-28-2001
source download)
I'm not sure how to do it in 0.5.  If you are just starting and trying to
use
0.5, I suggest you start with one of the nightly source distributions
because
1.0 should be released shortly.  Just some bug fixes and documentation
updates
as I hear on the mail lists.

That said....

The tag library descriptors must be in your WEB-INF and registered in your
web.xml and you must reference them properly in the JSP page.

<tomcat-home>/webapps/animation/WEB-INF/struts-bean.tld
                                        struts-html.tld
                                        struts-logic.tld
                                        struts-template.tld
                                        struts.tld
In your web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
  .. other stuff here Note, refer to DTD about location of taglib.  it's at
the
bottom if you are not using any ejb stuff.
  <!-- Struts Tag Library Descriptors -->
  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>

</web-app>

You only need to enter the ones that you are using.  This is from the
struts-example/WEB-INF/web.xml file.

Then in you JSP page put this...
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

Note, the file in the uri determines the name and location of the tlds.  The
prefix is upto you.

Good luck,
Steve


Frederic BAGES wrote:
>
>  Hi all, i'm new to Struts and i have i problem that seems to concern
Tomcat
> and Struts.
>
>         I've installed Strut and the two exemples WAR files under tomcat
3.2. the
> exemples are just running fine but when i try to run my own jsp file i
have
> an error from the jsp compiler.
>
> org.apache.jasper.compiler.CompileException:
> C:\jakarta-tomcat-3.2.1\webapps\animation\logon.jsp(1,0) Unable to open
> taglibrary /WEB-INF/struts.tld : Could not locate TLD META-INF/taglib.tld
>         at
>
org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve
> ntListener.java, Compiled Code)
>         at
>
org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList
> ener.java:116)
>         at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java,
Compiled
> Code)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java, Compiled
Code)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:1042)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
>         at org.apache.jasper.compiler.Compiler.compile(Compiler.java,
Compiled
> Code)
>         at
org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
>         .....
>
>  My JSP file and the corresponding classes (LogonForm and LogonAction) are
> just copies of the examples with some little changes.
>
>         Does anyone could help me ?
>
>         Thanks.
>
>         Frederic.
>
> The JSP file is following :
>
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
>
> <html>
> <head>
> <title>Titletitle>
> </head>
> <body bgcolor="white">
>
> <struts:errors/>
>
> <struts:form action="logon.do" name="logonForm" focus="username"
>                type="com.infusio.gamezilla.portal.LogonForm">
> <table border="0" width="100%">
>
>   <tr>
>     <th align="right">
>       User name :
>     </th>
>     <td align="left">
>       <struts:text property="username" size="16" maxlength="16"/>
>     </td>
>   </tr>
>
>   <tr>
>     <th align="right">
>       Password :
>     </th>
>     <td align="left">
>       <struts:password property="password" size="16" maxlength="16"/>
>     </td>
>   </tr>
>
>   <tr>
>     <td align="right">
>       <struts:submit property="submit" value="Submit"/>
>     </td>
>     <td align="left">
>       <struts:reset/>
>     </td>
>   </tr>
>
> </table>
>
> </struts:form>
>
> </body>
> </html>


Re: JSP probleme

Posted by "Steven D. Wilkinson" <st...@acm.org>.
Which version of struts are you using?

Note my answer is how you do it in struts 1.0 (actually form the 01-28-2001
source download)
I'm not sure how to do it in 0.5.  If you are just starting and trying to use
0.5, I suggest you start with one of the nightly source distributions because
1.0 should be released shortly.  Just some bug fixes and documentation updates
as I hear on the mail lists.

That said....

The tag library descriptors must be in your WEB-INF and registered in your
web.xml and you must reference them properly in the JSP page.

<tomcat-home>/webapps/animation/WEB-INF/struts-bean.tld
                                        struts-html.tld
                                        struts-logic.tld
                                        struts-template.tld
                                        struts.tld
In your web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
  .. other stuff here Note, refer to DTD about location of taglib.  it's at the
bottom if you are not using any ejb stuff.
  <!-- Struts Tag Library Descriptors -->
  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>

</web-app>

You only need to enter the ones that you are using.  This is from the
struts-example/WEB-INF/web.xml file.

Then in you JSP page put this...
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

Note, the file in the uri determines the name and location of the tlds.  The
prefix is upto you.

Good luck,
Steve


Frederic BAGES wrote:
> 
>  Hi all, i'm new to Struts and i have i problem that seems to concern Tomcat
> and Struts.
> 
>         I've installed Strut and the two exemples WAR files under tomcat 3.2. the
> exemples are just running fine but when i try to run my own jsp file i have
> an error from the jsp compiler.
> 
> org.apache.jasper.compiler.CompileException:
> C:\jakarta-tomcat-3.2.1\webapps\animation\logon.jsp(1,0) Unable to open
> taglibrary /WEB-INF/struts.tld : Could not locate TLD META-INF/taglib.tld
>         at
> org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve
> ntListener.java, Compiled Code)
>         at
> org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList
> ener.java:116)
>         at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java, Compiled
> Code)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java, Compiled Code)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:1042)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
>         at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled
> Code)
>         at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
>         .....
> 
>  My JSP file and the corresponding classes (LogonForm and LogonAction) are
> just copies of the examples with some little changes.
> 
>         Does anyone could help me ?
> 
>         Thanks.
> 
>         Frederic.
> 
> The JSP file is following :
> 
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
> 
> <html>
> <head>
> <title>Titletitle>
> </head>
> <body bgcolor="white">
> 
> <struts:errors/>
> 
> <struts:form action="logon.do" name="logonForm" focus="username"
>                type="com.infusio.gamezilla.portal.LogonForm">
> <table border="0" width="100%">
> 
>   <tr>
>     <th align="right">
>       User name :
>     </th>
>     <td align="left">
>       <struts:text property="username" size="16" maxlength="16"/>
>     </td>
>   </tr>
> 
>   <tr>
>     <th align="right">
>       Password :
>     </th>
>     <td align="left">
>       <struts:password property="password" size="16" maxlength="16"/>
>     </td>
>   </tr>
> 
>   <tr>
>     <td align="right">
>       <struts:submit property="submit" value="Submit"/>
>     </td>
>     <td align="left">
>       <struts:reset/>
>     </td>
>   </tr>
> 
> </table>
> 
> </struts:form>
> 
> </body>
> </html>

JSP probleme

Posted by Frederic BAGES <fr...@in-fusio.com>.
 Hi all, i'm new to Struts and i have i problem that seems to concern Tomcat
and Struts.

	I've installed Strut and the two exemples WAR files under tomcat 3.2. the
exemples are just running fine but when i try to run my own jsp file i have
an error from the jsp compiler.

org.apache.jasper.compiler.CompileException:
C:\jakarta-tomcat-3.2.1\webapps\animation\logon.jsp(1,0) Unable to open
taglibrary /WEB-INF/struts.tld : Could not locate TLD META-INF/taglib.tld
	at
org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve
ntListener.java, Compiled Code)
	at
org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList
ener.java:116)
	at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java, Compiled
Code)
	at org.apache.jasper.compiler.Parser.parse(Parser.java, Compiled Code)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:1042)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled
Code)
	at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
	.....


 My JSP file and the corresponding classes (LogonForm and LogonAction) are
just copies of the examples with some little changes.

	Does anyone could help me ?

	Thanks.

	Frederic.

The JSP file is following :

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>

<html>
<head>
<title>Titletitle>
</head>
<body bgcolor="white">

<struts:errors/>

<struts:form action="logon.do" name="logonForm" focus="username"
               type="com.infusio.gamezilla.portal.LogonForm">
<table border="0" width="100%">

  <tr>
    <th align="right">
      User name :
    </th>
    <td align="left">
      <struts:text property="username" size="16" maxlength="16"/>
    </td>
  </tr>

  <tr>
    <th align="right">
      Password :
    </th>
    <td align="left">
      <struts:password property="password" size="16" maxlength="16"/>
    </td>
  </tr>

  <tr>
    <td align="right">
      <struts:submit property="submit" value="Submit"/>
    </td>
    <td align="left">
      <struts:reset/>
    </td>
  </tr>

</table>

</struts:form>

</body>
</html>


Re: Server Port Problem HELP

Posted by Chris Smith <li...@lombardydrive.com>.
I found a bug a while back in the encodeURL() method in Tomcat 3.1.  I 
was using the struts link tag to generate all my links so that struts 
would append the session id to the urls.  Struts uses Tomcat's 
encodeUrl() method, which only adds the session id if the link is within 
your own app, e.g. it won't add a session id if you try to link to yahoo 
(unless you're developing a web page for yahoo!).

Anyway, if you run Tomcat 3.1 on port 80, its encodeUrl() method 
incorrectly thinks the url is outside of your app and does not append the 
session id.  When my app tried to go to a page that required a login, it 
kept redirecting back to the login page because the session id was 
missing.  I couldn't get off the login page!

This is fixed in Tomcat 3.2.  Alternatively, run Tomcat 3.1 on anything 
but port 80 (not usually practical).

Hope this helps.  It sounds similar to your problem.

Chris Smith


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 1/29/01, 3:58:13 PM, "Michael Mok" <mo...@hotmail.com> wrote regarding 
Server Port Problem HELP:


> Hi

> Sorry to post such a long email. I am absolutely stump with a session
> problem that have been bugging my STRUTS based application.

> I have encountered some session persistence problem with my application
> trying to track if the user has logged on. I am not sure if it is due to 
the
> fact that the website uses Tomcat 3.1 or STRUTS.

> My application presents a logon page which when the user logons on
> successfully, a session is created and a "user" object stored in the 
session

> eg LogonAction.class
>     HttpSession session = request.getSession();
>     session.setAttribute(Constants.USER_KEY, user);

> Next the application will forward the user to the main page. User can 
then
> click on an action such "view data from a table" which will forward to an
> action class to display the rows.


> All my action class check if  the "user" object exists within the session
> otherwise they will be directed to the logon page.

> eg ShowColumnAction.class

>  org.teatimej.initialise.User user = (org.teatimej.initialise.User)
> session.getAttribute(Constants.USER_KEY);
>  if (user == null) {
>   if (servlet.getDebug() >= 1)
>       servlet.log(" User is not logged on in session "
>                       + session.getId());
>   return (servlet.findForward("logon"));
>  }

> The odd thing here is that user will always be directed back to the logon
> page upon clicking on the first action URL on the main page. However 
after
> they logon the second time, all action URL works fine.

> The website support personnel said that it could be due to the fact that 
my
> URL have a server port attached even though the server port is port 80.

> I noticed that my logon form does not have a base html tag (if that may 
be
> the problem) and the form URL (does not contain port 80) is

> http://www.webappcabaret.com/teatimej/logon_wac.jsp

> The form action (after logon_wac.jsp is displayed on the browser) is

> <form name="logonForm" method="POST" action="logonwac.do">

> The URL found on the main page have the following URL

> <a href="http://webappcabaret.com:80/teatimej/edittable.do?action=new">

> The subsequent logon form action (logon_wac.jsp) is

> <form name="logonForm" method="POST"
> action="logonwac.do;jsessionid=To1015mC34669985688752114At">

> What have I done to STRUTS such that the logon page above includes a
> jsessionid as compared to the first logon exact form (but with no
> jsessionid) ?

> I have been advised by the website support personnel to remove the port
> number from the URL.

> I check the STRUTS link tag and found that the server port is always 
append
> to the server name. Here is the code where STRUTS builds up the URL..

> RequestUtils.class

>     public static String absoluteURL(HttpServletRequest request, String
> path) {

>         try {
>             URL url = new URL(request.getScheme(),
>                               request.getServerName(),
>                               request.getServerPort(),
>                               request.getContextPath() + path);
>             return (url.toString());
>         } catch (MalformedURLException e) {
>             return (null);
>         }

>     }

> I cannot see any option to instruct STRUTS not to include the serverport
> when building the URL. However the server port may be a red herring.

> Have I got off the rails?

> TIA

> Michael Mok
> www.webappcabaret.com/teatimej