You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alex Shneyderman <a....@gmail.com> on 2008/03/14 13:07:53 UTC

Codebehind + zero config options

I am a bit confused by how it works maybe you guys could shed some light :-)

I have a package structure and JSP pages structure that match. To be
concrete actions are placed like this:

/com/mypackge/my/namespace/IndexAction.java
/com/mypackge/my/namespace/EditAction.java

and pages are placed like so:

/WEB-INF/pages/my/namespace/index.jsp
/WEB-INF/pages/my/namespace/edit.jsp

now when I request a page I would like to configure struts/codebehind
combo so if I user requests:

/my/namespace -> index.action should kick in (of course it does not
exists so index.jsp should be the result with the help of codebehind
plugin. And in that page I can do what I need to

So, I tried to make an entry in struts.xml

<struts>

	<constant name="struts.codebehind.pathPrefix" value="/WEB-INF/pages/" />
	
	<package name="my.namespace" namespace="/my/namesapce">
		<default-action-ref name="index" />
	</package>

</struts>

this does not seem to work as I get

HTTP ERROR: 404
NOT_FOUND

Any idea on how I could achieve this ?

Thanks,
Alex.

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


Re: Codebehind + zero config options

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
CodeBehind doesn't provide automatic index actions.  Only the URL 
/my/namespace/index.action maps to IndexAction

You may be thinking of the SmartURLs plugin or Convention plugin in 2.1 
(or my own alpha struts2urlsplugin plugin at googlecode that was 
discussed recently)

Also, the default-action-ref is used to specify the class to use where 
the class attribute is omitted on an action definition.  It does not 
specify the action to execute in the case that no other actions were 
matched.

cheers,
Jeromy Evans

Alex Shneyderman wrote:
> hmm, is this question too stupid to be answered ?
>
> On Fri, Mar 14, 2008 at 1:07 PM, Alex Shneyderman
> <a....@gmail.com> wrote:
>   
>> I am a bit confused by how it works maybe you guys could shed some light :-)
>>
>>  I have a package structure and JSP pages structure that match. To be
>>  concrete actions are placed like this:
>>
>>  /com/mypackge/my/namespace/IndexAction.java
>>  /com/mypackge/my/namespace/EditAction.java
>>
>>  and pages are placed like so:
>>
>>  /WEB-INF/pages/my/namespace/index.jsp
>>  /WEB-INF/pages/my/namespace/edit.jsp
>>
>>  now when I request a page I would like to configure struts/codebehind
>>  combo so if I user requests:
>>
>>  /my/namespace -> index.action should kick in (of course it does not
>>  exists so index.jsp should be the result with the help of codebehind
>>  plugin. And in that page I can do what I need to
>>
>>  So, I tried to make an entry in struts.xml
>>
>>  <struts>
>>
>>         <constant name="struts.codebehind.pathPrefix" value="/WEB-INF/pages/" />
>>
>>         <package name="my.namespace" namespace="/my/namesapce">
>>                 <default-action-ref name="index" />
>>         </package>
>>
>>  </struts>
>>
>>  this does not seem to work as I get
>>
>>  HTTP ERROR: 404
>>  NOT_FOUND
>>
>>  Any idea on how I could achieve this ?
>>
>>  Thanks,
>>  Alex.
>>
>>     
>
> ---------------------------------------------------------------------
> 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: Codebehind + zero config options

Posted by Alex Shneyderman <a....@gmail.com>.
hmm, is this question too stupid to be answered ?

On Fri, Mar 14, 2008 at 1:07 PM, Alex Shneyderman
<a....@gmail.com> wrote:
> I am a bit confused by how it works maybe you guys could shed some light :-)
>
>  I have a package structure and JSP pages structure that match. To be
>  concrete actions are placed like this:
>
>  /com/mypackge/my/namespace/IndexAction.java
>  /com/mypackge/my/namespace/EditAction.java
>
>  and pages are placed like so:
>
>  /WEB-INF/pages/my/namespace/index.jsp
>  /WEB-INF/pages/my/namespace/edit.jsp
>
>  now when I request a page I would like to configure struts/codebehind
>  combo so if I user requests:
>
>  /my/namespace -> index.action should kick in (of course it does not
>  exists so index.jsp should be the result with the help of codebehind
>  plugin. And in that page I can do what I need to
>
>  So, I tried to make an entry in struts.xml
>
>  <struts>
>
>         <constant name="struts.codebehind.pathPrefix" value="/WEB-INF/pages/" />
>
>         <package name="my.namespace" namespace="/my/namesapce">
>                 <default-action-ref name="index" />
>         </package>
>
>  </struts>
>
>  this does not seem to work as I get
>
>  HTTP ERROR: 404
>  NOT_FOUND
>
>  Any idea on how I could achieve this ?
>
>  Thanks,
>  Alex.
>

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