You can retrieve the current viewId at any time.
However, it would probably be better not to tie your business logic to
your presentation logic, so having a hidden input that is set properly
is probably the best way to go about it.
On Sun, 16 Jan 2005 21:35:55 -0600, Aaron Bartell
<[EMAIL PROTECTED]> wrote:
> Makes sense. I am sure some day I will have multiple forms. The reason
> I have picked this direction is because I will have multiple pages that
> all point to the same action method "upload", and the code to upload a
> file is exactly the same except for one switch statement. So if I put a
> hidden field in each page that uploads files with the appropriate
> literal (ie MYDOCUMENTS, OURDOCUMENTS, etc), then I can retrieve that
> value and determine which MySQL association tables I need to update with
> info.
>
> Correct me if I am wrong, but there isn't the ability to modify a bean
> property in a navigation-rule is there? I should have told you the
> scenario in the first place, sorry.
>
> Thanks for the response Heath,
> Aaron Bartell
>
> Heath Borders wrote:
>
> >You're close.
> >
> >The fields are placed on the request map by their clientId, not their id.
> >
> >The clientId the id with the parent NamingContainer's (usually a form)
> >id prepended onto it.
> >
> >So, if you had this JSP:
> >
> ><f:view>
> ><h:form id="myForm">
> ><h:inputText id="myInputText" />
> ></h:form>
> ></f:view>
> >
> >You could get the inputText's value by doing
> >RequestMap.get("myForm:myInputText");
> >
> >You might want to reconsider your strategy.
> >
> >Maybe you could have a managed-bean with a getter value-binded to the
> >h:inputHidden. The managed-bean could have a default value of
> >"OURDOCUMENTS"
> >
> >
> >
> >On Sun, 16 Jan 2005 17:27:28 -0600, Aaron Bartell
> ><[EMAIL PROTECTED]> wrote:
> >
> >
> >>Hi All,
> >>
> >>I thought I had an understanding of how to retrieve the value of a form
> >>field, but I am obviously missing something. If I have a form and field
> >>like the following code, how do I get at the value of the form field?
> >>In the past it was easy to map the value of a form field to a bean
> >>variable, but in this instance I need to hard code OURDOCUMENTS into
> >>this hidden field so I know what uploadtype is occurring.
> >>
> >> <h:form id="form1" name="form1" enctype="multipart/form-data" >
> >> <h:inputHidden id="uploadtype" value="OURDOCUMENTS" />
> >> ...
> >> </h:form>
> >>
> >>Here is how I have been retrieving values from a selection made from a
> >>data table:
> >>
> >>String ulType = (String) getUIObj("uploadtype");
> >>
> >> public Object getUIObj(String obj) {
> >> return
> >>FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(obj);
> >> }
> >>
> >>I have also tried this without success:
> >>String ulType = (String) getAppObj("uploadtype");
> >> public Object getAppObj(String obj) {
> >> FacesContext fc = FacesContext.getCurrentInstance();
> >> return
> >>fc.getApplication().getVariableResolver().resolveVariable(fc,obj);
> >> }
> >>
> >>What am I missing?
> >>
> >>THanks,
> >>Aaron Bartell
> >>
> >>
> >>
> >
> >
> >
> >
>
--
-Heath Borders-Wing
[EMAIL PROTECTED]