how to <h:form> with two command button
Hello everybody ..
I just want to make a <h:form> with two command buttons
and a separate action for each one,,
i know the way and i did it, but it just not working...
although i'm sure of the mapping in the faces-config.xml..
a NullPointerException and 500 exception is returned...
so ... ?
# 1
This is just possible.
You just need to debug the NPE and go to fix it.
If you stucks, show the smallest reproduceable code snippet here and post at least the stacktrace of the NPE here.
# 2
I created this small example to show you the way i'm doing it..
i created test.jsp
has the form inside of it:
<h:form>
<h:commandButton value="Login" action="login"/>
<h:commandButton value="Login 2" action="login2"/>
</h:form>
and two pages one called login.jsp, and the other login2.jsp.
and i created the next navgation
<navigation-rule>
<from-view-id>/test.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/login.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>login2</from-outcome>
<to-view-id>/login2.jsp</to-view-id>
</navigation-case>
</navigation-rule>
simply pressing button Login goes to page login.jsp
and Login 2 goes to login2.jsp
and this example is working, the problem is as soon as there are parameters sent with the request (which i checked it's not null, and check the value by debugging).. it's giving me that NPE...
# 5
> Start adding things to your example until it breaks.
> Then strip away everything that did not make it
> break, verify it still breaks and repost it here.
you mean like adding parameters one by one...?
if that's your point, i can see it logical i'll try it..