You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by 梁炳場 <pc...@gmail.com> on 2005/09/15 16:09:02 UTC

Struts and DisplayTag CSS?

For this link, http://localhost:8080/erp/
displaytag is okay to display with css beautifully.

For this link, http://localhost:8080/erp/addUserProfile.do
all the css effect disappear.

my web.xml
  <welcome-file-list>
    <welcome-file>/user/addUserProfile.jsp</welcome-file>
  </welcome-file-list>

my jsp file has a css line
  <head>
  <link rel="stylesheet" href="css/screen.css" type="text/css"
media="screen, print" />
  </head>

my struts mapping is
    <action
      attribute="userProfileForm"
      input="/user/addUserProfile.jsp"
      name="userProfileForm"
      parameter="method"
      path="/addUserProfile"
      scope="request"
      type="com.erp.struts.user.action.UserProfileDispatchAction" >
      <forward name="success" path="/user/addUserProfile.jsp" />
    </action>

Any hints to solve?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts and DisplayTag CSS?

Posted by Ivan Rodriguez <iv...@interd4u.com>.
You have distinct code in both url's. It is imposible that one work and 
the other doesnt work if you have the *same* displaytag configuration 
and css and other needed files declared in both jsp. Because they are at 
same url level ( /erp/ )


梁炳場 escribió:

>For this link, http://localhost:8080/erp/
>displaytag is okay to display with css beautifully.
>
>For this link, http://localhost:8080/erp/addUserProfile.do
>all the css effect disappear.
>
>my web.xml
>  <welcome-file-list>
>    <welcome-file>/user/addUserProfile.jsp</welcome-file>
>  </welcome-file-list>
>
>my jsp file has a css line
>  <head>
>  <link rel="stylesheet" href="css/screen.css" type="text/css"
>media="screen, print" />
>  </head>
>
>my struts mapping is
>    <action
>      attribute="userProfileForm"
>      input="/user/addUserProfile.jsp"
>      name="userProfileForm"
>      parameter="method"
>      path="/addUserProfile"
>      scope="request"
>      type="com.erp.struts.user.action.UserProfileDispatchAction" >
>      <forward name="success" path="/user/addUserProfile.jsp" />
>    </action>
>
>Any hints to solve?
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts and DisplayTag CSS?

Posted by 梁炳場 <pc...@gmail.com>.
Thank you Wendy.

It is okay to retrieve contextpath.

Thanks


2005/9/16, Wendy Smoak <ja...@wendysmoak.com>:
> From:  <pc...@gmail.com>
> 
> > The resulting href becomes the following by display the source page on IE.
> > <link rel="stylesheet" href="/css/screen.css" type="text/css"
> > media="screen, print" />
> >
> > It is so strange that both http://localhost:8080/erp/
> > and  http://localhost:8080/erp/addUserProfile.do
> > cannot display with css.
> 
> Not so strange, unless the stylesheet is in the ROOT context (assuming this
> is standalone Tomcat).  That leading slash means the browser is requesting
> http://localhost:8080/css/screen.css.
> 
> > Then I try to get the contextpath, instead of hard code.
> > But fail, the following line return null
> > <% String contextPath=request.getContextPath(); %>
> > <c:out value="${contextPath}"></c:out>
> >  Why?
> 
> That fails because JSTL cannot "see" scripting variables.  JSTL has an
> implicit pageContext object, though which you can get to the request.
> 
> See if this does what you want:
>   <c:out value="${pageContext.request.contextPath}" />
> 
> I haven't tried it, but it looks like it should work.
> 
> --
> Wendy Smoak
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts and DisplayTag CSS?

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From:  <pc...@gmail.com>

> The resulting href becomes the following by display the source page on IE.
> <link rel="stylesheet" href="/css/screen.css" type="text/css"
> media="screen, print" />
>
> It is so strange that both http://localhost:8080/erp/
> and  http://localhost:8080/erp/addUserProfile.do
> cannot display with css.

Not so strange, unless the stylesheet is in the ROOT context (assuming this 
is standalone Tomcat).  That leading slash means the browser is requesting 
http://localhost:8080/css/screen.css.

> Then I try to get the contextpath, instead of hard code.
> But fail, the following line return null
> <% String contextPath=request.getContextPath(); %>
> <c:out value="${contextPath}"></c:out>
>  Why?

That fails because JSTL cannot "see" scripting variables.  JSTL has an 
implicit pageContext object, though which you can get to the request.

See if this does what you want:
   <c:out value="${pageContext.request.contextPath}" />

I haven't tried it, but it looks like it should work.

-- 
Wendy Smoak 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts and DisplayTag CSS?

Posted by 梁炳場 <pc...@gmail.com>.
I have tried both suggestion.
Still no luck and even worse.

The resulting href becomes the following by display the source page on IE.

<link rel="stylesheet" href="/css/screen.css" type="text/css"
media="screen, print" />

It is so strange that both http://localhost:8080/erp/
and  http://localhost:8080/erp/addUserProfile.do
cannot display with css.

Eventuallt, I change the href to this
<link rel="stylesheet" href="/erp/css/screen.css" type="text/css"
media="screen, print" />

Then both url can display with css beautifully.

Then I try to get the contextpath, instead of hard code.
But fail, the following line return null

<% String contextPath=request.getContextPath(); %>    
<c:out value="${contextPath}"></c:out>

Why?


2005/9/15, Michael Ewers <ew...@gmx.de>:
> Quick solution:
> <link rel="stylesheet" href='<bean:rewrite page="/css/screen.css />'>
> 
> And don't forget to set the requestURI-attribute in the display:table tag.
> 
> > --- Ursprüngliche Nachricht ---
> > Von: ±ç¬±³õ <pc...@gmail.com>
> > An: Struts Users Mailing List <us...@struts.apache.org>
> > Betreff: Struts and DisplayTag CSS?
> > Datum: Thu, 15 Sep 2005 22:09:02 +0800
> >
> > For this link, http://localhost:8080/erp/
> > displaytag is okay to display with css beautifully.
> >
> > For this link, http://localhost:8080/erp/addUserProfile.do
> > all the css effect disappear.
> >
> > my web.xml
> >   <welcome-file-list>
> >     <welcome-file>/user/addUserProfile.jsp</welcome-file>
> >   </welcome-file-list>
> >
> > my jsp file has a css line
> >   <head>
> >   <link rel="stylesheet" href="css/screen.css" type="text/css"
> > media="screen, print" />
> >   </head>
> >
> > my struts mapping is
> >     <action
> >       attribute="userProfileForm"
> >       input="/user/addUserProfile.jsp"
> >       name="userProfileForm"
> >       parameter="method"
> >       path="/addUserProfile"
> >       scope="request"
> >       type="com.erp.struts.user.action.UserProfileDispatchAction" >
> >       <forward name="success" path="/user/addUserProfile.jsp" />
> >     </action>
> >
> > Any hints to solve?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org