why i can not use f:param inside an html form?

Hi

Thank you for reading my post

what is wrong with the following code ?

<form action="https://www.3rdpartyWeb.com/CardServices/controller"

method="GET" enctype="multipart/form-data"

name="submissionform">

<f:param value="#{Session.MID}" name="MID" id="MID"/>

<f:param value="#{ButtonsActionListener.reservationNumber}"

name="ResNum" id="ResNum"/>

<f:param value="#{Session.redirectURL}" name="RedirectURL"

id="RedirectURL"/>

<f:param value="#{ButtonsActionListener.total_price}" name="Amount"

id="Amount"/>

</form>

<SCRIPT type="text/javascript">

document.forms["submissionform"].submit();

</SCRIPT>

while both ButtonsActionListener , Session are managed beans ,

my question is , does the above form will post correctly to the named

url along with parameters ?

if not , how i can make this possible , i should say that i submit the

form using javascript and no user interaction should be involved.

do i used a correct design for this ?

what is a correct design for this kind of requirements ?

thanks

[1649 byte] By [Legolas.wa] at [2007-10-3 6:01:10]
# 1
f:param is not intented for this use. Rather use f:attribute.Also see http://balusc.xs4all.nl/srv/dev-jep-com.htmlAnd please keep HTML away from JSF. Use h:form instead. If you can't do anything else, put the HTML in f:verbatim.
BalusCa at 2007-7-15 0:43:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hi

Thank you for reply.

you know , i can not use jsf forms because they dont have an action link.

jsf forms just work when we have a button on them and we press the button.

using html form make it possible to submit A POST action to another web page , but using html form prevent me from using f:attribute because of its parent tag.

my requiremet is to be able to POST some parameters to a url and let user continue on that URL (for example it can be a payment system that i should pass amount , mid .... to that page and let the user complete the transaction.

before this i used Struts and it was almost stright forward with struts , but now a jsf fomrm can not take an action link , so i can not use a jsf form.

using html form , i do not know how to set parameters (as you saw i tried using f:param).

also it will be good if i can do this job from a backing bean that calculate thos parameter , for example from the backing bean i redirect the user to 3rd party page along with the parameters that i calculate in using POST method.

it was the complete description of my problem , now i am looking for any advice and help.

thanks

Legolas.wa at 2007-7-15 0:43:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
> you know , i can not use jsf forms because they dont> have an action link.You have missed h:commandLink?
BalusCa at 2007-7-15 0:43:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
can we make the following :1-make the command link invisible (e can use no text on it)2-click it with java Script instead of making user click the linkthe importatnt thing here is that we should post the form without any need for user click thanks
Legolas.wa at 2007-7-15 0:43:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Hi

Thank you for reading this post

i tried to forget the automatic form submit for now , so i write the following codes:

<af:form>

<center>

<af:commandLink text="commandLink 1" action="payment" >

<f:param value="#{Session.MID}" name="MID" id="MID" />

<f:param value="#{ButtonsActionListener.reservationNumber}" name="ResNum" id="ResNum"/>

<f:param value="#{Session.redirectURL}" name="RedirectURL" id="RedirectURL"/>

<f:param value="#{ButtonsActionListener.total_price}" name="Amount" id="Amount"/>

</af:commandLink>

</center>

</af:form>

also i defined a navigation case like

<navigation-case>

<from-outcome>payment</from-outcome>

<to-view-id>https://www.3rdpartywebsite.com/CardServices/controller</to-view-id>

<redirect/>

</navigation-case>

so it should work in a way that i need but it just retun an exceptionlike this :

java.lang.IllegalArgumentException: Illegal view ID 'https://www.3rdparty.com/CardServices/controller'. The ID must begin with '/'

at com.sun.faces.application.ViewHandlerImpl.getActionURL(ViewHandlerImpl.java:443)

at oracle.adfinternal.view.faces.application.ViewHandlerImpl.getActionURL(ViewHandlerImpl.java:100)

at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:114)

at oracle.adfinternal.view.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:29)

at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:89)

at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:211)

at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)

at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)

at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)

at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)

at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)

at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)

at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)

at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)

at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)

at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:332)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:627)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)

at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)

at java.lang.Thread.run(Thread.java:595)

do you know what should i do ?

thanks

Legolas.wa at 2007-7-15 0:43:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
JS to invoke link or button action:document.getElementById('idOfUICommandElement').click();And about the error message: isn't it clear enough? Remove the http:// and start with /. Use relative paths.
BalusCa at 2007-7-15 0:43:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
Hithank you for reading my postwhat happens when we click on an h:outputLink , does it post to the URL tha we gave to it ?if not , how i can make the h:OutputLink to act as a POST method when people click on it ?thanks
Legolas.wa at 2007-7-15 0:43:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
Use h:form with h:commandLink, then the POST will be invoked.
BalusCa at 2007-7-15 0:43:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9

thank you very much , all done.

i could use an jsf form and change its action ,method attribute with javascript and also submit it using javascript.

but one question : how i can delete or change some of parameters that jsf add to url automatically ?

is there any way to change them or delete them using javascript ?

thanks

Legolas.wa at 2007-7-15 0:43:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...