You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Garner, Shawn" <sh...@pearson.com> on 2005/12/27 19:27:28 UTC

RE: [OT] customizing JSF view management (was [shale][struts-face s] structured URLs with JSF (reprised))

Is there a way to get the view as in the name of the jsp page within the
code?

Shawn

-----Original Message-----
From: craigmcc@gmail.com [mailto:craigmcc@gmail.com] On Behalf Of Craig
McClanahan
Sent: Thursday, December 22, 2005 11:24 PM
To: Struts Users Mailing List
Subject: Re: [OT] customizing JSF view management (was [shale][struts-faces]
structured URLs with JSF (reprised))

On 12/22/05, Laurie Harper <la...@holoweb.net> wrote:
>
> I think I've found an easier way... It looks like both our needs can be
> met by installing a custom ViewHandler that just delegates all methods
> to its parent, but which changes the viewId passed into createView
> before calling super.createView:
>
>    public class ProjectivaViewHandler extends ViewHandler {
>      private ViewHandler parent;
>
>      public ProjectivaViewHandler(ViewHandler parent) {
>        this.parent = parent;
>      }
>
>      public UIViewRoot createView(FacesContext ctx, String viewId) {
>        String pathToActualView = myViewLogic(viewId);
>        return super.createView(ctx, pathToActualView);
>      }
>
>      ...
>    }
>
> In my case I'd also need to push data from the original viewId into the
> request for use during rendering and use a custom NavigationHandler to
> let me carry parts of the from-view-id into the to-view-id, but I don't
> think you'd need that: just calling createView(ctx, "/somehost" +
> viewId) would be sufficient for you.
>
> Craig, does this sound like a reasonable thing to be doing? It sure
> *looks* like a solution to the problem :-)


The view that ultimately gets created will have a view identifier (as
returned by getFacesContext().getViewRoot().getViewId()) of the *actual*
view that was created, not the identifier you passed in from the navigation
rule.  As long as that's OK with your business logic, it sounds like you
might have a reasonable solution.

L.


Craig

David G. Friedman wrote:
> > I'm trying to do something similar with a lifecycle. My goal is to
> virtual host but retain the viewId of /about.jsf
> > while building off the main file /somehostname/about.jsf.
> >
> > Here's what I have done so far, added a lifecycleFactory to my
> faces-config.xml file.  My own factory's init method is
> > the only thing I changed.  I added my own lifecycle class using the name
> "VIRTUALHOST" then set the web.xml param
> > javax.faces.LIFECYCLE_ID to use the name "VIRTUALHOST" instead of the
> default lifecycle object which gets loaded in the
> > name "DEFAULT"
> >
> > It's complicated and slow going since I'm working on it on my own time
> but I hope this information helps.
> >
> > Regards,
> > David
> >
> > -----Original Message-----
> > From: news [mailto:news@sea.gmane.org]On Behalf Of Laurie Harper
> > Sent: Wednesday, December 21, 2005 9:31 PM
> > To: user@struts.apache.org
> > Subject: Re: [shale][struts-faces] structured URLs with JSF (reprised)
> >
> >
> > Craig McClanahan wrote:
> >> On 12/20/05, Laurie Harper <la...@holoweb.net> wrote:
> >>> So I'm pretty much sold on migrating from Struts/JSPs to JSF at this
> >>> point, with one remaining caveat I've yet to figure out. I've brought
> >>> this up before, but haven't found a good solution yet. I think the
> >>> easiest way to get what I want is to use struts-faces, but then I
> can't
> >>> get the benefits of Shale... So, I'd like to revisit the base
> >>> requirements to see if anyone can see a way to do what I want w/out
> >>> Struts Action / struts-faces in the mix...
> >>>
> >>> My base requirement is that everything be directly addressable by a
> >>> bookmark-able URL. So, for example, I'd like to have a URL like
> >>> http://.../users to be rendered by /users.jsp as a list of users and,
> >>> when you click on an entry in the list, you'd get taken to
> >>> http://.../users/bob which would be rendered by /userInfo.jsp. For any
> >>> X, the URL http://.../users/X would be rendered by /userInfo.jsp, with
> X
> >>> being made available to the JSP (or backing bean) as a request
> >>> parameter, request attribute or whatever.
> >>>
> >>> Using struts-faces, I can get what I want by using wild-card action
> >>> mappings to map logical URLs to physical JSPs, passing wild-card
> matched
> >>> parts of the request URL on to the view in the action; something like,
> >>> roughly:
> >>>
> >>>    <action path="/users/*" type="myaction" forward="/user.jsp">
> >>>      <set-property name="user" value="{1}"/>
> >>>
> >>> I need a way to get the same mapping from logical URLs to actual JSPs
> >>> with vanilla JSF / Shale. Sean suggested I could try writing a custom
> >>> navigation handler, but that doesn't seem to work since a navigation
> >>> handler only gets to influence how from-view-id/from-outcome pairs get
> >>> mapped to views.
> >>>
> >>> I tried setting up a front controller servlet that encapsulates the
> >>> URL-to-view mapping logic, but that doesn't work because to-view-id in
> a
> >>> navigation-rule is not a context relative path, so my navigation rules
> >>> can't route through my controller servlet...
> >>>
> >>> I'm really hoping I can find a way to do this that doesn't involve
> >>> deploying Struts + struts-faces as a front controller to Shale ;-) My
> >>> requirements can't be *that* weird can they?
> >>
> >> No, you just need a custom NavigationHandler, coupled with using
> <redirect/>
> >> elements in your navigation rules to ensure that the URLs in the
> browser are
> >> what you are after.  (See also my response to your comment on the
> myfaces
> >> list too ... view identifiers for the default view handler *are*
> context
> >> relative paths starting with a '/'.)
> >
> > So I figured out how to install a custom navigation handler, and gave
> > this a try but when I make a request to a particular URL the navigation
> > handler isn't called. It only gets called when I click on a command link
> > or other navigation element in a rendered view.
> >
> > What I need is to completely decouple the URL the browser requests from
> > the JSP that gets rendered as a result, to provide a less direct mapping
> > from the one to the other.
> >
> > Is there something I'm missing about the navigation handler approach? Is
> > there some way to get it to be invoked on an initial request?
> >
> > Thanks,
> >
> > L.
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>

**************************************************************************** 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 
****************************************************************************

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


[Application pattern] Advice

Posted by "Sakalareddy.T" <sa...@spanservices.com>.
Hi Aldo Vadillo Batista,
     In my application for CRUD operations we have taken DispatchAction,  in
this action all required operations can do at one location  and you need to
take only one object.  Easy to operate it.  If you are design
Internationalization concept better to take LookupDispatchAction,  still if
you have any doubt go through
            http://www.reumann.net/struts/lesson2/step9.do
The above link give you complete solution for all your doubts.

                                  Thanks & Regards
                                  Sakala Reddy.T

-----Original Message-----
From: Aldo Vadillo Batista [mailto:aldo.vadillo@gmail.com]
Sent: Wednesday, December 28, 2005 2:58 PM
To: Struts Users Mailing List
Subject: Re: [Application pattern] Advice

For CRUD (create, restore, update, delete) I would use a
DispatchAction for each object.

2005/12/27, Xavier Vanderstukken <xv...@ionicsoft.com>:
> I need your help to design my web application using struts and hibernate.
> I have several classes to save/delete/update (like user, category,
> project,...).
>
> I dont know what is the best pattern to use :
> - 1action per object and all the operations(save,update,delete) in the
> same action
> - only one action for all the objects and all the operations
> - one action per operation (number of object * number of operation -->
> lot of actions, mapping and forms)
> - another pattern
>
> Thanks for your advices
>
> ---------------------------------------------------------------------
> 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

SPAN Systems Corporation, Bangalore. 
"Steering Progress. Together" 

--------------------------------------------------------------------------------
This email message and any attachments is confidential and intended only for the use of an individual or entity named above and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this email is strictly prohibited. If you have received this email in error, please notify us immediately by return email or itsupport@spanservices.com and destroy the original message. Opinions, conclusions, and other information in this message that do not relate to the official business of SPAN, shall be understood to be neither given nor endorsed by SPAN.





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


Re: [Application pattern] Advice

Posted by Aldo Vadillo Batista <al...@gmail.com>.
For CRUD (create, restore, update, delete) I would use a
DispatchAction for each object.

2005/12/27, Xavier Vanderstukken <xv...@ionicsoft.com>:
> I need your help to design my web application using struts and hibernate.
> I have several classes to save/delete/update (like user, category,
> project,...).
>
> I dont know what is the best pattern to use :
> - 1action per object and all the operations(save,update,delete) in the
> same action
> - only one action for all the objects and all the operations
> - one action per operation (number of object * number of operation -->
> lot of actions, mapping and forms)
> - another pattern
>
> Thanks for your advices
>
> ---------------------------------------------------------------------
> 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


[Application pattern] Advice

Posted by Xavier Vanderstukken <xv...@ionicsoft.com>.
I need your help to design my web application using struts and hibernate.
I have several classes to save/delete/update (like user, category, 
project,...).

I dont know what is the best pattern to use :
- 1action per object and all the operations(save,update,delete) in the 
same action
- only one action for all the objects and all the operations
- one action per operation (number of object * number of operation --> 
lot of actions, mapping and forms)
- another pattern

Thanks for your advices

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


Re: Upload File

Posted by Laurie Harper <la...@holoweb.net>.
Flávio Maldonado wrote:
> Hello
> 
> I'm having a problem to upload a file using struts...
> I search for the error at Google... but I didn't solve my problem yet.
> I have this JSP:
> 
> <html:form action="/foto" enctype="multipart/form-data">
> <tr>
>  <td>
> 
>  <table cellpadding="0" cellspacing="15" width="100%">
>   <tr>
>    <td width="50%" align="right"><html:file property="theFile" 
> size="40"/></td>
>   </tr>
>   <tr>
>    <td width="50%" align="right"><html:submit value="Ok"/></td>
>   </tr>
>  </table>  </td>
> </tr>
> </html:form>
> 
> when I click in Ok button to call the action class, the servlet throws 
> an exception:
> 
> java.lang.NoSuchMethodError: 
> org.apache.commons.fileupload.FileUpload.setSizeMax(I)V at 
> org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(Common 
> sMultipartRequestHandler.java:220) at 
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:934)  at
> 
> I got the struts-upload.war example and it works fine... but my 
> application didn't! I don't know what i'm doing wrong...
> I put the struts.jar and commons-upload.jar in the classpath....
> I think this is a detail... but I'm not seeing what I'm doing wrong.
> 
> Something can help me?

I'd guess you have the wrong version of commons-upload.jar deployed. 
Check you're using the right version, and that there isn't another 
version elsewhere on the classpath of either your application or your 
servlet container.

L.


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


RE: Upload File

Posted by Daniel Blumenthal <da...@wordchamp.com>.
This probably won't help, but (you never know) - you might want to specify
method="POST".  So:

<html:form action="/foto" enctype="multipart/form-data" method="POST">

Just a thought.

Daniel

> -----Original Message-----
> From: Flávio Maldonado [mailto:fvmaldonado@yahoo.com.br] 
> Sent: Tuesday, December 27, 2005 1:52 PM
> To: Struts Users Mailing List
> Subject: Upload File
> 
> Hello
> 
> I'm having a problem to upload a file using struts...
> I search for the error at Google... but I didn't solve my problem yet.
> I have this JSP:
> 
>  <html:form action="/foto" enctype="multipart/form-data">  <tr>
>   <td>
> 
>   <table cellpadding="0" cellspacing="15" width="100%">
>    <tr>
>     <td width="50%" align="right"><html:file property="theFile" 
> size="40"/></td>
>    </tr>
>    <tr>
>     <td width="50%" align="right"><html:submit value="Ok"/></td>
>    </tr>
>   </table>  </td>
>  </tr>
>  </html:form>
> 
> when I click in Ok button to call the action class, the 
> servlet throws an
> exception:
> 
> java.lang.NoSuchMethodError: 
> org.apache.commons.fileupload.FileUpload.setSizeMax(I)V at 
> org.apache.struts.upload.CommonsMultipartRequestHandler.handle
> Request(Common
> sMultipartRequestHandler.java:220) at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java
> :934)  at
> 
> I got the struts-upload.war example and it works fine... but 
> my application didn't! I don't know what i'm doing wrong...
> I put the struts.jar and commons-upload.jar in the classpath....
> I think this is a detail... but I'm not seeing what I'm doing wrong.
> 
> Something can help me?
> 
> Thanks.
> 
> Have a happy new year.
> 
> Flávio Maldonado 
> 
> 
> 	
> 
> 	
> 		
> _______________________________________________________
> Yahoo! doce lar. Faça do Yahoo! sua homepage. 
> http://br.yahoo.com/homepageset.html 
> 
> 
> ---------------------------------------------------------------------
> 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


Upload File

Posted by Flávio Maldonado <fv...@yahoo.com.br>.
Hello

I'm having a problem to upload a file using struts...
I search for the error at Google... but I didn't solve my problem yet.
I have this JSP:

 <html:form action="/foto" enctype="multipart/form-data">
 <tr>
  <td>

  <table cellpadding="0" cellspacing="15" width="100%">
   <tr>
    <td width="50%" align="right"><html:file property="theFile" 
size="40"/></td>
   </tr>
   <tr>
    <td width="50%" align="right"><html:submit value="Ok"/></td>
   </tr>
  </table>  </td>
 </tr>
 </html:form>

when I click in Ok button to call the action class, the servlet throws an 
exception:

java.lang.NoSuchMethodError: 
org.apache.commons.fileupload.FileUpload.setSizeMax(I)V at 
org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(Common 
sMultipartRequestHandler.java:220) at 
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:934)  at

I got the struts-upload.war example and it works fine... but my application 
didn't! I don't know what i'm doing wrong...
I put the struts.jar and commons-upload.jar in the classpath....
I think this is a detail... but I'm not seeing what I'm doing wrong.

Something can help me?

Thanks.

Have a happy new year.

Flávio Maldonado 


	

	
		
_______________________________________________________ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html 


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


Re: [OT] customizing JSF view management (was [shale][struts-face s] structured URLs with JSF (reprised))

Posted by Laurie Harper <la...@holoweb.net>.
Is FaceesContext.getViewRoot().getViewId() what you're looking for?

L.

Garner, Shawn wrote:
> Is there a way to get the view as in the name of the jsp page within the
> code?
> 
> Shawn
> 
> -----Original Message-----
> From: craigmcc@gmail.com [mailto:craigmcc@gmail.com] On Behalf Of Craig
> McClanahan
> Sent: Thursday, December 22, 2005 11:24 PM
> To: Struts Users Mailing List
> Subject: Re: [OT] customizing JSF view management (was [shale][struts-faces]
> structured URLs with JSF (reprised))
> 
> On 12/22/05, Laurie Harper <la...@holoweb.net> wrote:
>> I think I've found an easier way... It looks like both our needs can be
>> met by installing a custom ViewHandler that just delegates all methods
>> to its parent, but which changes the viewId passed into createView
>> before calling super.createView:
>>
>>    public class ProjectivaViewHandler extends ViewHandler {
>>      private ViewHandler parent;
>>
>>      public ProjectivaViewHandler(ViewHandler parent) {
>>        this.parent = parent;
>>      }
>>
>>      public UIViewRoot createView(FacesContext ctx, String viewId) {
>>        String pathToActualView = myViewLogic(viewId);
>>        return super.createView(ctx, pathToActualView);
>>      }
>>
>>      ...
>>    }
>>
>> In my case I'd also need to push data from the original viewId into the
>> request for use during rendering and use a custom NavigationHandler to
>> let me carry parts of the from-view-id into the to-view-id, but I don't
>> think you'd need that: just calling createView(ctx, "/somehost" +
>> viewId) would be sufficient for you.
>>
>> Craig, does this sound like a reasonable thing to be doing? It sure
>> *looks* like a solution to the problem :-)
> 
> 
> The view that ultimately gets created will have a view identifier (as
> returned by getFacesContext().getViewRoot().getViewId()) of the *actual*
> view that was created, not the identifier you passed in from the navigation
> rule.  As long as that's OK with your business logic, it sounds like you
> might have a reasonable solution.
> 
> L.
> 
> 
> Craig
> 
> David G. Friedman wrote:
>>> I'm trying to do something similar with a lifecycle. My goal is to
>> virtual host but retain the viewId of /about.jsf
>>> while building off the main file /somehostname/about.jsf.
>>>
>>> Here's what I have done so far, added a lifecycleFactory to my
>> faces-config.xml file.  My own factory's init method is
>>> the only thing I changed.  I added my own lifecycle class using the name
>> "VIRTUALHOST" then set the web.xml param
>>> javax.faces.LIFECYCLE_ID to use the name "VIRTUALHOST" instead of the
>> default lifecycle object which gets loaded in the
>>> name "DEFAULT"
>>>
>>> It's complicated and slow going since I'm working on it on my own time
>> but I hope this information helps.
>>> Regards,
>>> David
>>>
>>> -----Original Message-----
>>> From: news [mailto:news@sea.gmane.org]On Behalf Of Laurie Harper
>>> Sent: Wednesday, December 21, 2005 9:31 PM
>>> To: user@struts.apache.org
>>> Subject: Re: [shale][struts-faces] structured URLs with JSF (reprised)
>>>
>>>
>>> Craig McClanahan wrote:
>>>> On 12/20/05, Laurie Harper <la...@holoweb.net> wrote:
>>>>> So I'm pretty much sold on migrating from Struts/JSPs to JSF at this
>>>>> point, with one remaining caveat I've yet to figure out. I've brought
>>>>> this up before, but haven't found a good solution yet. I think the
>>>>> easiest way to get what I want is to use struts-faces, but then I
>> can't
>>>>> get the benefits of Shale... So, I'd like to revisit the base
>>>>> requirements to see if anyone can see a way to do what I want w/out
>>>>> Struts Action / struts-faces in the mix...
>>>>>
>>>>> My base requirement is that everything be directly addressable by a
>>>>> bookmark-able URL. So, for example, I'd like to have a URL like
>>>>> http://.../users to be rendered by /users.jsp as a list of users and,
>>>>> when you click on an entry in the list, you'd get taken to
>>>>> http://.../users/bob which would be rendered by /userInfo.jsp. For any
>>>>> X, the URL http://.../users/X would be rendered by /userInfo.jsp, with
>> X
>>>>> being made available to the JSP (or backing bean) as a request
>>>>> parameter, request attribute or whatever.
>>>>>
>>>>> Using struts-faces, I can get what I want by using wild-card action
>>>>> mappings to map logical URLs to physical JSPs, passing wild-card
>> matched
>>>>> parts of the request URL on to the view in the action; something like,
>>>>> roughly:
>>>>>
>>>>>    <action path="/users/*" type="myaction" forward="/user.jsp">
>>>>>      <set-property name="user" value="{1}"/>
>>>>>
>>>>> I need a way to get the same mapping from logical URLs to actual JSPs
>>>>> with vanilla JSF / Shale. Sean suggested I could try writing a custom
>>>>> navigation handler, but that doesn't seem to work since a navigation
>>>>> handler only gets to influence how from-view-id/from-outcome pairs get
>>>>> mapped to views.
>>>>>
>>>>> I tried setting up a front controller servlet that encapsulates the
>>>>> URL-to-view mapping logic, but that doesn't work because to-view-id in
>> a
>>>>> navigation-rule is not a context relative path, so my navigation rules
>>>>> can't route through my controller servlet...
>>>>>
>>>>> I'm really hoping I can find a way to do this that doesn't involve
>>>>> deploying Struts + struts-faces as a front controller to Shale ;-) My
>>>>> requirements can't be *that* weird can they?
>>>> No, you just need a custom NavigationHandler, coupled with using
>> <redirect/>
>>>> elements in your navigation rules to ensure that the URLs in the
>> browser are
>>>> what you are after.  (See also my response to your comment on the
>> myfaces
>>>> list too ... view identifiers for the default view handler *are*
>> context
>>>> relative paths starting with a '/'.)
>>> So I figured out how to install a custom navigation handler, and gave
>>> this a try but when I make a request to a particular URL the navigation
>>> handler isn't called. It only gets called when I click on a command link
>>> or other navigation element in a rendered view.
>>>
>>> What I need is to completely decouple the URL the browser requests from
>>> the JSP that gets rendered as a result, to provide a less direct mapping
>>> from the one to the other.
>>>
>>> Is there something I'm missing about the navigation handler approach? Is
>>> there some way to get it to be invoked on an initial request?
>>>
>>> Thanks,
>>>
>>> L.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
> 
> **************************************************************************** 
> This email may contain confidential material. 
> If you were not an intended recipient, 
> Please notify the sender and delete all copies. 
> We may monitor email to and from our network. 
> ****************************************************************************


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


RE: [OT] customizing JSF view management (was [shale][struts-faces] structured URLs with JSF (reprised))

Posted by Daniel Blumenthal <da...@wordchamp.com>.
You can get it from the HttpServletRequest object.

<bean:page id="req" property="request"/>

Here's the javadoc page:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletRequest.
html

Daniel

> -----Original Message-----
> From: Garner, Shawn [mailto:shawn.garner@pearson.com] 
> Sent: Tuesday, December 27, 2005 1:27 PM
> To: 'Struts Users Mailing List'
> Subject: RE: [OT] customizing JSF view management (was 
> [shale][struts-faces] structured URLs with JSF (reprised))
> 
> Is there a way to get the view as in the name of the jsp page 
> within the code?
> 
> Shawn
> 
> -----Original Message-----
> From: craigmcc@gmail.com [mailto:craigmcc@gmail.com] On 
> Behalf Of Craig McClanahan
> Sent: Thursday, December 22, 2005 11:24 PM
> To: Struts Users Mailing List
> Subject: Re: [OT] customizing JSF view management (was 
> [shale][struts-faces] structured URLs with JSF (reprised))
> 
> On 12/22/05, Laurie Harper <la...@holoweb.net> wrote:
> >
> > I think I've found an easier way... It looks like both our 
> needs can 
> > be met by installing a custom ViewHandler that just delegates all 
> > methods to its parent, but which changes the viewId passed into 
> > createView before calling super.createView:
> >
> >    public class ProjectivaViewHandler extends ViewHandler {
> >      private ViewHandler parent;
> >
> >      public ProjectivaViewHandler(ViewHandler parent) {
> >        this.parent = parent;
> >      }
> >
> >      public UIViewRoot createView(FacesContext ctx, String viewId) {
> >        String pathToActualView = myViewLogic(viewId);
> >        return super.createView(ctx, pathToActualView);
> >      }
> >
> >      ...
> >    }
> >
> > In my case I'd also need to push data from the original viewId into 
> > the request for use during rendering and use a custom 
> > NavigationHandler to let me carry parts of the from-view-id 
> into the 
> > to-view-id, but I don't think you'd need that: just calling 
> > createView(ctx, "/somehost" +
> > viewId) would be sufficient for you.
> >
> > Craig, does this sound like a reasonable thing to be doing? It sure
> > *looks* like a solution to the problem :-)
> 
> 
> The view that ultimately gets created will have a view 
> identifier (as returned by 
> getFacesContext().getViewRoot().getViewId()) of the *actual* 
> view that was created, not the identifier you passed in from 
> the navigation rule.  As long as that's OK with your business 
> logic, it sounds like you might have a reasonable solution.
> 
> L.
> 
> 
> Craig
> 
> David G. Friedman wrote:
> > > I'm trying to do something similar with a lifecycle. My goal is to
> > virtual host but retain the viewId of /about.jsf
> > > while building off the main file /somehostname/about.jsf.
> > >
> > > Here's what I have done so far, added a lifecycleFactory to my
> > faces-config.xml file.  My own factory's init method is
> > > the only thing I changed.  I added my own lifecycle class 
> using the 
> > > name
> > "VIRTUALHOST" then set the web.xml param
> > > javax.faces.LIFECYCLE_ID to use the name "VIRTUALHOST" instead of 
> > > the
> > default lifecycle object which gets loaded in the
> > > name "DEFAULT"
> > >
> > > It's complicated and slow going since I'm working on it on my own 
> > > time
> > but I hope this information helps.
> > >
> > > Regards,
> > > David
> > >
> > > -----Original Message-----
> > > From: news [mailto:news@sea.gmane.org]On Behalf Of Laurie Harper
> > > Sent: Wednesday, December 21, 2005 9:31 PM
> > > To: user@struts.apache.org
> > > Subject: Re: [shale][struts-faces] structured URLs with JSF 
> > > (reprised)
> > >
> > >
> > > Craig McClanahan wrote:
> > >> On 12/20/05, Laurie Harper <la...@holoweb.net> wrote:
> > >>> So I'm pretty much sold on migrating from Struts/JSPs to JSF at 
> > >>> this point, with one remaining caveat I've yet to 
> figure out. I've 
> > >>> brought this up before, but haven't found a good 
> solution yet. I 
> > >>> think the easiest way to get what I want is to use 
> struts-faces, 
> > >>> but then I
> > can't
> > >>> get the benefits of Shale... So, I'd like to revisit the base 
> > >>> requirements to see if anyone can see a way to do what I want 
> > >>> w/out Struts Action / struts-faces in the mix...
> > >>>
> > >>> My base requirement is that everything be directly 
> addressable by 
> > >>> a bookmark-able URL. So, for example, I'd like to have 
> a URL like 
> > >>> http://.../users to be rendered by /users.jsp as a list 
> of users 
> > >>> and, when you click on an entry in the list, you'd get taken to 
> > >>> http://.../users/bob which would be rendered by 
> /userInfo.jsp. For 
> > >>> any X, the URL http://.../users/X would be rendered by 
> > >>> /userInfo.jsp, with
> > X
> > >>> being made available to the JSP (or backing bean) as a request 
> > >>> parameter, request attribute or whatever.
> > >>>
> > >>> Using struts-faces, I can get what I want by using wild-card 
> > >>> action mappings to map logical URLs to physical JSPs, passing 
> > >>> wild-card
> > matched
> > >>> parts of the request URL on to the view in the action; 
> something 
> > >>> like,
> > >>> roughly:
> > >>>
> > >>>    <action path="/users/*" type="myaction" forward="/user.jsp">
> > >>>      <set-property name="user" value="{1}"/>
> > >>>
> > >>> I need a way to get the same mapping from logical URLs 
> to actual 
> > >>> JSPs with vanilla JSF / Shale. Sean suggested I could 
> try writing 
> > >>> a custom navigation handler, but that doesn't seem to 
> work since a 
> > >>> navigation handler only gets to influence how 
> > >>> from-view-id/from-outcome pairs get mapped to views.
> > >>>
> > >>> I tried setting up a front controller servlet that encapsulates 
> > >>> the URL-to-view mapping logic, but that doesn't work because 
> > >>> to-view-id in
> > a
> > >>> navigation-rule is not a context relative path, so my 
> navigation 
> > >>> rules can't route through my controller servlet...
> > >>>
> > >>> I'm really hoping I can find a way to do this that 
> doesn't involve 
> > >>> deploying Struts + struts-faces as a front controller 
> to Shale ;-) 
> > >>> My requirements can't be *that* weird can they?
> > >>
> > >> No, you just need a custom NavigationHandler, coupled with using
> > <redirect/>
> > >> elements in your navigation rules to ensure that the URLs in the
> > browser are
> > >> what you are after.  (See also my response to your comment on the
> > myfaces
> > >> list too ... view identifiers for the default view handler *are*
> > context
> > >> relative paths starting with a '/'.)
> > >
> > > So I figured out how to install a custom navigation handler, and 
> > > gave this a try but when I make a request to a particular URL the 
> > > navigation handler isn't called. It only gets called when 
> I click on 
> > > a command link or other navigation element in a rendered view.
> > >
> > > What I need is to completely decouple the URL the browser 
> requests 
> > > from the JSP that gets rendered as a result, to provide a less 
> > > direct mapping from the one to the other.
> > >
> > > Is there something I'm missing about the navigation handler 
> > > approach? Is there some way to get it to be invoked on an 
> initial request?
> > >
> > > Thanks,
> > >
> > > L.
> > >
> > >
> > > 
> --------------------------------------------------------------------
> > > - 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
> >
> >
> 
> **************************************************************
> **************
> This email may contain confidential material. 
> If you were not an intended recipient,
> Please notify the sender and delete all copies. 
> We may monitor email to and from our network. 
> **************************************************************
> **************
> 
> ---------------------------------------------------------------------
> 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