Re: Struts Tiles Problem

2010-11-05 Thread Lukasz Lenart
2010/11/5 Rafael Medeiros :
> How to use plugin-tiles in struts 1.3.8:

Check the documentation
http://struts.apache.org/1.x/struts-tiles/installation.html


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Kapituła Javarsovia 2010 http://javarsovia.pl

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



Re: Setting css of a row

2010-11-05 Thread Dave Newton
The same way you retrieve any action property.

That said, I'm not a fan of mixing layers like that: * possibly* get
something business- oriented from the action and use CSS to style it... but
a color from the action is poor design.

Dave
 On Nov 6, 2010 12:46 AM, "cellterry"  wrote:
>
> Dear all,
>
> I want to set a table row with a color retrieved from an action class,
could
> I do that?
>
> If yes, how to do that?
>
> Terry.
>
> --
> View this message in context:
http://old.nabble.com/Setting-css-of-a-row-tp30146983p30146983.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>


Setting css of a row

2010-11-05 Thread cellterry

Dear all,

I want to set a table row with a color retrieved from an action class, could
I do that?

If yes, how to do that?

Terry.

-- 
View this message in context: 
http://old.nabble.com/Setting-css-of-a-row-tp30146983p30146983.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



How to use

2010-11-05 Thread Mead Lai
Hi All,

I am now using  tag with simple theme.
It shows two select-list fine, but if I click the button to move the items,
it doesn't work.
Any clue can help me?
Now I am trying to write a double-select with JQury & HTML.
Thank you in advance.

Regards,
Mead


Have you ever used InputConfig annotation?

2010-11-05 Thread Alfredo Manuel Osorio Martinez
Hello,

By looking at DefaultWorkflowInterceptor I saw an annotation that I
didn't know existed. I am talking about:

com.opensymphony.xwork2.interceptor.annotations.InputConfig

I think it can be used for input repopulation and can be used as an
alternative to Preparable and .

What surprised me was that there is a little documentation about the use
of the annotation or examples.

Haver you ever used this one before?

Is it a good idea to use it for input repopulation for example
collections for selects in case a validation fails?

Thanks



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



How to pass date from action to custom jsp tag?

2010-11-05 Thread holod

Hello, I want to create simple dummy tag.
I have an action:

class MyAction extends ActionSupport{

  /** Some code*/
  public Department getRoot(){
/** Some code foes here...*/
return departmentInstance;
  }
}

a tag:
<%...@tag language="java" pageEncoding="UTF-8"  body-content="empty"  %><%@
attribute name="tree" required="true"%><%@ taglib
uri="http://java.sun.com/portlet_2_0"; prefix="p"%><%...@tag
import="ejb.model.Department"%><%
Object attrTree = pageContext.getAttribute("tree");
System.out.println("TreeTagHelper->tree=["+attrTree+"]");
if(attrTree!=null){

System.out.println("TreeTagHelper->tree.class=["+attrTree.getClass().getName()+"]");
}else{
System.out.println("TreeTagHelper->tree.class=[!!NULL!!!]");
}
try{
//some code...
}catch(Exception e){
System.out.println("Error while drawing 
tree["+e.getMessage()+"]");
}
%>

and my jsp with tag:



What do I have to do if I want to pass result of MyAction#getRoot to my
dummy tag?

I've tried to these:





Nothing happens, i tag I get String with value "root" or get null. 

I can't pass an object to tag attribute... 

What do I do wrong?
-- 
View this message in context: 
http://old.nabble.com/How-to-pass-date-from-action-to-custom-jsp-tag--tp30144287p30144287.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts Tiles Problem

2010-11-05 Thread Rafael Medeiros
How to use plugin-tiles in struts 1.3.8:









*web.xml*

action

org.apache.struts.action.ActionServlet

config
/WEB-INF/config/struts-config.xml,
/WEB-INF/config/struts-config-manter-usuario.xml



convertNull
true


chainConfig

org/apache/struts/tiles/chain-config.xml

2


*tiles.xml*











*action*




*template:*
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>














good luck!

Atenciosamente,

Rafael Nunes
I'm free - Linux
http://www.linkedin.com/in/mederafael


On Fri, Nov 5, 2010 at 4:15 PM, Dave Newton  wrote:

> Is the Tiles plugin not required for S1.3? It's been several years since
> I've used Struts 1 (I hope you're not using it for a new project?)
>
> Dave
> On Nov 5, 2010 1:05 PM, "Andy T"  wrote:
> > Hi All,
> >
> > I'm having a bit of trouble trying to get my tiles to work with Struts
> > and wondered if anyone could help.
> >
> > The relevant files are shown below:
> >
> >  Web.xml 
> >
> > [code]
> > 
> >  > 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";>
> > MiniHR
> > 
> > action
> > 
> > org.apache.struts.action.ActionServlet
> > 
> > config
> > /WEB-INF/struts-config.xml
> > 
> > 
> > chainConfig
> > org/apache/struts/tiles/chain-config.xml
> > 
> > 
> > debug
> > 2
> > 
> > 
> > detail
> > 2
> > 
> > 
> > validate
> > true
> > 
> > 2
> > 
> >
> >
> > 
> > tiles
> > org.apache.tiles.web.startup.TilesServlet
> > 
> > 
> > org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
> > 
> > 
> > /WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml
> > 
> > 
> > 1
> >
> >
> >
> > 
> >
> >
> >
> >
> >
> > 
> > action
> > *.do
> > 
> > 
> > index.html
> > index.htm
> > index.jsp
> > default.html
> > default.htm
> > default.jsp
> > 
> >
> > 
> > [/code]
> >
> >
> >  tiles-defs.xml 
> >
> > [code]
> > 
> >
> >  > "-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"
> > "http://struts.apache.org/dtds/tiles-config_1_3.dtd";>
> >
> > 
> >
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> >
> > 
> > 
> > 
> > 
> >
> >
> > 
> > [/code]
> >
> >
> >  struts-config.xml 
> >
> > [code]
> > 
> >  > Struts Configuration 1.3//EN"
> > "http://struts.apache.org/dtds/struts-config_1_3.dtd";>
> > 
> >
> > 
> >
> > (Form Beans Here)
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> > 
> > 
> >
> > 
> >
> >
> >  > parameter="method"
> > type="EricEnhancement.struts.EnhancementAction"
> > cancellable="true"
> > validate="false">
> > 
> > 
> > 
> >
> >
> >  > input="/login.jsp"
> > type="EricEnhancement.struts.LoginAction"
> > name = "LoginForm"
> > cancellable="true"
> > validate="true">
> > 
> > 
> > 
> >
> >
> > 
> >
> > 
> >  > value="gov.ohio.odjfs.EricEnhancement.util.CustomRequestProcessor"/>
> > 
> >
> >  >
>
> parameter="ericenhancements.resources.MessageResources">
> >
> > 
> > 
> > 
> >
> > 
> > 
> >  > value="/org/apache/struts/validator/validator-rules.xml,
> > /WEB-INF/validation.xml"/>
> > 
> >
> >
> >
> > 
> > [/code]
> >
> >
> >
> > I'm using struts-tiles-1.3.8.jar and when I run the above I get:
> > "java.lang.IllegalArgumentException: Path Home does not start with a
> > "/" character"
> >
> > Can anyone help me with this?
> >
> > Thanks,
> >
> > Rob
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
>


Re: Struts Tiles Problem

2010-11-05 Thread Dave Newton
Is the Tiles plugin not required for S1.3? It's been several years since
I've used Struts 1 (I hope you're not using it for a new project?)

Dave
On Nov 5, 2010 1:05 PM, "Andy T"  wrote:
> Hi All,
>
> I'm having a bit of trouble trying to get my tiles to work with Struts
> and wondered if anyone could help.
>
> The relevant files are shown below:
>
>  Web.xml 
>
> [code]
> 
>  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";>
> MiniHR
> 
> action
> 
> org.apache.struts.action.ActionServlet
> 
> config
> /WEB-INF/struts-config.xml
> 
> 
> chainConfig
> org/apache/struts/tiles/chain-config.xml
> 
> 
> debug
> 2
> 
> 
> detail
> 2
> 
> 
> validate
> true
> 
> 2
> 
>
>
> 
> tiles
> org.apache.tiles.web.startup.TilesServlet
> 
> 
> org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
> 
> 
> /WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml
> 
> 
> 1
>
>
>
> 
>
>
>
>
>
> 
> action
> *.do
> 
> 
> index.html
> index.htm
> index.jsp
> default.html
> default.htm
> default.jsp
> 
>
> 
> [/code]
>
>
>  tiles-defs.xml 
>
> [code]
> 
>
>  "-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"
> "http://struts.apache.org/dtds/tiles-config_1_3.dtd";>
>
> 
>
> 
> 
> 
> 
> 
> 
> 
> 
>
>
> 
> 
> 
> 
>
>
> 
> [/code]
>
>
>  struts-config.xml 
>
> [code]
> 
>  Struts Configuration 1.3//EN"
> "http://struts.apache.org/dtds/struts-config_1_3.dtd";>
> 
>
> 
>
> (Form Beans Here)
>
> 
>
> 
>
> 
>
> 
> 
> 
>
> 
>
>
>  parameter="method"
> type="EricEnhancement.struts.EnhancementAction"
> cancellable="true"
> validate="false">
> 
> 
> 
>
>
>  input="/login.jsp"
> type="EricEnhancement.struts.LoginAction"
> name = "LoginForm"
> cancellable="true"
> validate="true">
> 
> 
> 
>
>
> 
>
> 
>  value="gov.ohio.odjfs.EricEnhancement.util.CustomRequestProcessor"/>
> 
>
> 
parameter="ericenhancements.resources.MessageResources">
>
> 
> 
> 
>
> 
> 
>  value="/org/apache/struts/validator/validator-rules.xml,
> /WEB-INF/validation.xml"/>
> 
>
>
>
> 
> [/code]
>
>
>
> I'm using struts-tiles-1.3.8.jar and when I run the above I get:
> "java.lang.IllegalArgumentException: Path Home does not start with a
> "/" character"
>
> Can anyone help me with this?
>
> Thanks,
>
> Rob
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>


Struts Tiles Problem

2010-11-05 Thread Andy T
Hi All,

I'm having a bit of trouble trying to get my tiles to work with Struts
and wondered if anyone could help.

The relevant files are shown below:

 Web.xml 

[code]

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";>
MiniHR

action

org.apache.struts.action.ActionServlet

config
/WEB-INF/struts-config.xml


chainConfig

org/apache/struts/tiles/chain-config.xml


debug
2


detail
2


validate
true

2
  



tiles
org.apache.tiles.web.startup.TilesServlet


  org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG


  /WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml


1










action
*.do


index.html
index.htm
index.jsp
default.html
default.htm
default.jsp



[/code]


 tiles-defs.xml 

[code]


http://struts.apache.org/dtds/tiles-config_1_3.dtd";>




















[/code]


 struts-config.xml 

[code]

http://struts.apache.org/dtds/struts-config_1_3.dtd";>




  (Form Beans Here)














  


  


  


  






















[/code]



I'm using struts-tiles-1.3.8.jar and when I run the above I get:
"java.lang.IllegalArgumentException: Path Home does not start with a
"/" character"

Can anyone help me with this?

Thanks,

Rob

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



Re: how does the namespace work in struts

2010-11-05 Thread Edward Seager
Hi,

I've tried to answer your questions below based on my interpretation of the
documentation.

On Fri, Nov 5, 2010 at 8:33 AM, maven apache  wrote:

> I meet some problem when I try to learn the namespace of struts2,I am using
> struts-2.2.1.
>
> After read the docs at:
> http://struts.apache.org/2.2.1/docs/namespace-configuration.html
>
> I am confused for the following reason:
>
> The example:
>
> 
>
>
>
>greeting.jsp
>
>
>
>
>
>bar1.jsp
>
>
> 
>
> 
>
>
>
>moo.jsp
>
>
> 
>
> 
>
>
>
>bar2.jsp
>
>
> 
>
> This is the explanation:
>
> *If a request is made to /barspace/foo.action, the namespace /barspace will
> be checked for action foo. If a local action is not found, the default
> namespace is checked. In the Namespace Example, there is no action foo in
> the namespace /barspace, therefore the default will be checked and
> /foo.action will be executed.*
>
> I wonder why it is '/foo.action' rather than 'foo.action",it said that it
> will find the foo.action at the default namespace,and the default namespace
> is "",so it should be foo.action,why there is a '/'??
>


I read this as, the default namespace is also relative to the context path.
so http://mycompany.com/myapp/foo.action. The default action has to be
relative to something afterall right? The difference between the default and
/ namespace is that the / namespace isn't checked in the fall back.



>
> ALso problem 2:
>
> *Namespace are not hierarchical like a file system path. There is one
> namespace level. For example if the URL /barspace/myspace/bar.action is
> requested, the framework will first look for namespace /barspace/myspace.*
>
> For the request url "/barspace/myspace/bar.action", the '/barspace/myspace'
> will be splitted as a namespace,so what is the action now? is it the
> "/bar.action" or "bar.action",since the "/" may stand for a root namespace.
>
> I am really confused,anyone can give me a detailed suggestion??
>
>
>
Namespaces not being hierarchical means that you do not have separate
namespaces for /barspace or /myspace in this case. Just one namespace for
/barspace/myspace. It's not like a directory structure on a file system. So
/barspace/myspace/bar.action will look up an action called bar in the
namespace /barspace/myspace/.

Hope this helps.


-- 
Eddy Seager


Re: UpDownSelect & JPA

2010-11-05 Thread Nick Broadhurst
Thanks guys! String setup was legacy for single select which worked fine.
Select is populated with entity list so will re-work form entity to have
select list entity as property and go from there. Cheers!
On Nov 5, 2010 6:02 AM, "Maurizio Cucchiara" 
wrote:
> You should re-shape your DB design IMHO. If you expect multiple values
> for an entity property why do you declare as a plain string? You
> should consider to represent as at least an integer array (or even as
> an entity).
>
>
> 2010/11/5 Nick Broadhurst :
>> Hi All,
>>
>> I am using the struts2 updownselect for getting multiple selections from
>> user. It is populated by a list and works great as long as only one item
is
>> selected. The datatype in mysql where the field is being persisted to is
a
>> string. If one item is selected, the ID (listKey) goes into the db and
when
>> I retrieve the object for re-display in the form, that item is selected
in
>> the updownselect. Perfect! But when multiple items are selected, a comma
>> seperated list of the selected listKeys go in the db field. The problem
is
>> when this comes back out, the updownselect doesn't display the previously
>> selected items. I am guessing because it does not know how to interpret
the
>> comma separated list.
>>
>> I am just wondering what it would take to get struts to translate the
list
>> and display the populated values. An array datatype or something? MySql
>> doesn't have that does it? Serialize it? Doesnt sound like a good fit and
I
>> just don't know what struts is expecting when it needs to display
multiple
>> items selected. Thanks for any ideas.
>>
>> Nick
>>
>
>
>
> --
> Maurizio Cucchiara
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>


Re: how does the namespace work in struts

2010-11-05 Thread Maurizio Cucchiara
In this case you could interface to ActionMapping through url tag
(http://struts.apache.org/2.2.1/docs/url.html).


2010/11/5 maven apache :
> 2010/11/5 Maurizio Cucchiara 
>
>> Note that without S2 tag you will not appreciate S2 potential.
>>
> So I wonder if the web ui are built by some javascript framework for exmaple
> the ext -we used to build a form by the exe library:
>
> var form=new *Ext*.*form*.FormPanel({});
>
> And the form are submitted by a ajax request,so how about the s2 tag at this
> moment?
>
>
>> Furthermore they are not hard to learn (take a look at
>> http://struts.apache.org/2.2.1/docs/tag-reference.html)
>>
>> 2010/11/5 maven apache :
>> > :)
>> >
>> > In fact the reason I do not want to use tag now is that I do not want
>> > everything done by the framework,since I am new in struts2,so I want to
>> > learn struts step by step,I always thought that unless we know how the
>> > framework work we can not take the  most advantage of it.
>> >
>> > When I know the work mechanism of the action mapping,then I will use the
>> tag
>> > :)
>> > 2010/11/5 Maurizio Cucchiara 
>> >
>> >> Struts tags are not mandatory in order to deploy an application, but
>> >> as Li suggested make your life easier :)
>> >>
>> >> 2010/11/5 maven apache :
>> >> > Thanks for all your guys reply.
>> >> >
>> >> > That's to say I have no choice but using the struts tag if I decide to
>> >> use
>> >> > the struts??
>> >> >
>> >>
>> >> --
>> >> Maurizio Cucchiara
>> >>
>> >> -
>> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> >> For additional commands, e-mail: user-h...@struts.apache.org
>> >>
>> >>
>> >
>>
>>
>>
>> --
>> Maurizio Cucchiara
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>



-- 
Maurizio Cucchiara

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



Re: how does the namespace work in struts

2010-11-05 Thread maven apache
2010/11/5 Maurizio Cucchiara 

> Note that without S2 tag you will not appreciate S2 potential.
>
So I wonder if the web ui are built by some javascript framework for exmaple
the ext -we used to build a form by the exe library:

var form=new *Ext*.*form*.FormPanel({});

And the form are submitted by a ajax request,so how about the s2 tag at this
moment?


> Furthermore they are not hard to learn (take a look at
> http://struts.apache.org/2.2.1/docs/tag-reference.html)
>
> 2010/11/5 maven apache :
> > :)
> >
> > In fact the reason I do not want to use tag now is that I do not want
> > everything done by the framework,since I am new in struts2,so I want to
> > learn struts step by step,I always thought that unless we know how the
> > framework work we can not take the  most advantage of it.
> >
> > When I know the work mechanism of the action mapping,then I will use the
> tag
> > :)
> > 2010/11/5 Maurizio Cucchiara 
> >
> >> Struts tags are not mandatory in order to deploy an application, but
> >> as Li suggested make your life easier :)
> >>
> >> 2010/11/5 maven apache :
> >> > Thanks for all your guys reply.
> >> >
> >> > That's to say I have no choice but using the struts tag if I decide to
> >> use
> >> > the struts??
> >> >
> >>
> >> --
> >> Maurizio Cucchiara
> >>
> >> -
> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> >> For additional commands, e-mail: user-h...@struts.apache.org
> >>
> >>
> >
>
>
>
> --
> Maurizio Cucchiara
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: how does the namespace work in struts

2010-11-05 Thread Maurizio Cucchiara
Note that without S2 tag you will not appreciate S2 potential.
Furthermore they are not hard to learn (take a look at
http://struts.apache.org/2.2.1/docs/tag-reference.html)

2010/11/5 maven apache :
> :)
>
> In fact the reason I do not want to use tag now is that I do not want
> everything done by the framework,since I am new in struts2,so I want to
> learn struts step by step,I always thought that unless we know how the
> framework work we can not take the  most advantage of it.
>
> When I know the work mechanism of the action mapping,then I will use the tag
> :)
> 2010/11/5 Maurizio Cucchiara 
>
>> Struts tags are not mandatory in order to deploy an application, but
>> as Li suggested make your life easier :)
>>
>> 2010/11/5 maven apache :
>> > Thanks for all your guys reply.
>> >
>> > That's to say I have no choice but using the struts tag if I decide to
>> use
>> > the struts??
>> >
>>
>> --
>> Maurizio Cucchiara
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>



-- 
Maurizio Cucchiara

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



Re: UpDownSelect & JPA

2010-11-05 Thread Maurizio Cucchiara
You should re-shape your DB design IMHO. If you expect multiple values
for an entity property why do you declare as a plain string? You
should consider to represent as at least an integer array (or even as
an entity).


2010/11/5 Nick Broadhurst :
> Hi All,
>
> I am using the struts2 updownselect for getting multiple selections from
> user. It is populated by a list and works great as long as only one item is
> selected. The datatype in mysql where the field is being persisted to is a
> string. If one item is selected, the ID (listKey) goes into the db and when
> I retrieve the object for re-display in the form, that item is selected in
> the updownselect. Perfect! But when multiple items are selected, a comma
> seperated list of the selected listKeys go in the db field. The problem is
> when this comes back out, the updownselect doesn't display the previously
> selected items. I am guessing because it does not know how to interpret the
> comma separated list.
>
> I am just wondering what it would take to get struts to translate the list
> and display the populated values. An array datatype or something? MySql
> doesn't have that does it? Serialize it? Doesnt sound like a good fit and I
> just don't know what struts is expecting when it needs to display multiple
> items selected. Thanks for any ideas.
>
> Nick
>



-- 
Maurizio Cucchiara

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



Re: how does the namespace work in struts

2010-11-05 Thread maven apache
:)

In fact the reason I do not want to use tag now is that I do not want
everything done by the framework,since I am new in struts2,so I want to
learn struts step by step,I always thought that unless we know how the
framework work we can not take the  most advantage of it.

When I know the work mechanism of the action mapping,then I will use the tag
:)
2010/11/5 Maurizio Cucchiara 

> Struts tags are not mandatory in order to deploy an application, but
> as Li suggested make your life easier :)
>
> 2010/11/5 maven apache :
> > Thanks for all your guys reply.
> >
> > That's to say I have no choice but using the struts tag if I decide to
> use
> > the struts??
> >
>
> --
> Maurizio Cucchiara
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: how does the namespace work in struts

2010-11-05 Thread Maurizio Cucchiara
Struts tags are not mandatory in order to deploy an application, but
as Li suggested make your life easier :)

2010/11/5 maven apache :
> Thanks for all your guys reply.
>
> That's to say I have no choice but using the struts tag if I decide to use
> the struts??
>

-- 
Maurizio Cucchiara

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



Re: how does the namespace work in struts

2010-11-05 Thread maven apache
Thanks for all your guys reply.

That's to say I have no choice but using the struts tag if I decide to use
the struts??

2010/11/5 Li Ying 

> >>  
>
> This HTML code, will post your form to the RELATIVE path [space/register].
> So, the ABSOLUTE path which is requested will depend on the current
> URL of this page.
>
> If ABSOLUTE path is not right, no doubt struts2 can not map it to a
> right namespace/action.
>
>
>
> >> I will get a 404 error if I set the action to "/space/register"
>
> This HTML code, will post your form to the ABSOLUTE path [/space/register].
> But your web app is running under the [context path].
> So the valid URL should be something like
> [/contextPath/space/register.action]
>
> My suggestion is:
> (1)Use the Struts2 tag lib, get it works.
> (2)Read the HTML code generated by tag lib, study how it works
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: how does the namespace work in struts

2010-11-05 Thread Li Ying
>>  

This HTML code, will post your form to the RELATIVE path [space/register].
So, the ABSOLUTE path which is requested will depend on the current
URL of this page.

If ABSOLUTE path is not right, no doubt struts2 can not map it to a
right namespace/action.



>> I will get a 404 error if I set the action to "/space/register"

This HTML code, will post your form to the ABSOLUTE path [/space/register].
But your web app is running under the [context path].
So the valid URL should be something like [/contextPath/space/register.action]

My suggestion is:
(1)Use the Struts2 tag lib, get it works.
(2)Read the HTML code generated by tag lib, study how it works

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



Re: how does the namespace work in struts

2010-11-05 Thread Li Ying
>>  


Are you rendering html code by your self?
Don't do this.
Try Struts2's tag lib instead.

Example:


The tag lib will convert the namespace/action to a valid URL for you.
And then,when you submit this form, on the server side, struts2 will
map your request URL to an action.

See:
http://struts.apache.org/2.2.1/docs/form.html

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



how does the namespace work in struts

2010-11-05 Thread maven apache
I meet some problem when I try to learn the namespace of struts2,I am using
struts-2.2.1.

After read the docs at:
http://struts.apache.org/2.2.1/docs/namespace-configuration.html

I am confused for the following reason:

The example:





greeting.jsp





bar1.jsp








moo.jsp








bar2.jsp




This is the explanation:

*If a request is made to /barspace/foo.action, the namespace /barspace will
be checked for action foo. If a local action is not found, the default
namespace is checked. In the Namespace Example, there is no action foo in
the namespace /barspace, therefore the default will be checked and
/foo.action will be executed.*

I wonder why it is '/foo.action' rather than 'foo.action",it said that it
will find the foo.action at the default namespace,and the default namespace
is "",so it should be foo.action,why there is a '/'??

ALso problem 2:

*Namespace are not hierarchical like a file system path. There is one
namespace level. For example if the URL /barspace/myspace/bar.action is
requested, the framework will first look for namespace /barspace/myspace.*

For the request url "/barspace/myspace/bar.action", the '/barspace/myspace'
will be splitted as a namespace,so what is the action now? is it the
"/bar.action" or "bar.action",since the "/" may stand for a root namespace.

I am really confused,anyone can give me a detailed suggestion??


 so I do some test:

This is the struture of my test project:

Struts_TestProject
WebContent
js(floder)
jsp()
reg.jsp
thank.jsp
WEB-INF
web.xml
lib()
index.jsp

1)Default namespace test
First I did not define the namespace in the struts.xml:



/jsp/thank.jsp


This is the HTML form(I am not intend to use the tag now):


It works well, the page will jump to thank.jsp,the only problem is I have
not found any way to pass some parameters to the thank.jsp and render them
in the page.However this is not the main problem, I think I will make it
clear oneday.

2)set a namespace
Then I tried to test the namespace, I add a namespace to the package:


...Other configuration are same as it in the above.

Then I call it by this manner:


Then the struts show me the exception:

**There is no Action mapped for action name register**

(The following parameter is I get from debugging step by step at the IDE
:(:(

String servletPath = request.getServletPath()=== /jsp/space/register

String requestUri = request.getRequestURI()
/Struts_Test/jsp/space/register
Then the "/jsp/space/register" is used to parsed the namespace and action
name,at last the namespace is set to "" since there is not a mached
namespace named "/jsp/space".And the name is set to "register". Obviously,
it is wrong. Since the brower add the "jsp" prefix in the action.
)

To avoid the browser add a "jsp" prefix in the action, I tried to set the
action in form like:

The exception is the same as before.

Then I se the namespace from "space" to "/space",I also get the same
excetpion as before if I use the action to "space/register" in the HTML
form,however I will get a 404 error if I set the action to
"/space/register".


I am crazying!!! How the hell does the namespace work 

BTW, how does the "result" element in the "action" location the page?That's
to say ,for exmaple
/jsp/thank.jsp
how to locat the thank.jsp? Is it based the base path of the web context? Is
the first "/" required?