How to set a default parameter value
daxxy May 6, 2009 5:55 PMMy main view is a basic search form called basicSearch.xhtml. When you click put some input and click Search it jumps to officeList view with all the fields populated. In other words it basically works. It has 5 possible inputs and here is the basicSearch.page.xml file:
<param name="ring" value="#{officeViewList.officeView.ring}"/>
<param name="siteCode" value="#{officeViewList.officeView.siteCode}"/>
<param name="state" value="#{officeViewList.officeView.state}"/>
<param name="type" value="#{officeViewList.officeView.type}"/>
<param name="devName" value="#{devicesList.devices.devName}" />
The entity which populates officeList is OfficeView. The primary key/id for OfficeView is office_id/officeID (param name/entity propert).
I want to be able to access the officeList view with just the office_id parameter set. Like this
http://localhost:8080/ond/officeList.seam?office_id=7872
This works as well. In order for this to work, I had to include office_id in officeList.page.xml like this:
<param name="office_id" value="#{officeViewList.officeView.officeId}" />
etc. the rest of the parameters are not included here for brevity.
The problem is that when office_id is set as a parameter in officeList.page.xml, it turns up with a value of "0" when I click through to the officeList view from the basicSearch view. For instance to display offices in Alaska, I input AK into basicSearch and end up with this URL
http://localhost:8080/ond/officeList.seam?ring=&state=AK&devName=&type=&siteCode=&office_id=0cid=4
rather than this one
http://localhost:8080/ond/officeList.seam?ring=&state=AK&devName=&type=&siteCode=&office_id=cid=4
Of course I get zero results because there is no office with an office_id of 0 and a state of AK.
And yet I need that office_id parameter to be able to use this handy URL to access a single office, as I mention above:
http://localhost:8080/ond/officeList.seam?office_id=7872
How do I make office_id set to "" rather than "0" on queries generated by submitting the form in basicSearch? NOthing else gets a default value. Is it because officeId is type int and all other properties are type String?
How do I get around this?
Perhaps related -- I have an link on the officeList view back to basicSearch and I want office_id to be unset when someone clicks that link. How can I do this?
Here is the link as it is now:
<s:link value="Basic Search" view="/basicSearch.xhtml" /><br />
TDR
<param name="ring" value="#{officeViewList.officeView.ring}"/>
<param name="siteCode" value="#{officeViewList.officeView.siteCode}"/>
<param name="state" value="#{officeViewList.officeView.state}"/>
<param name="type" value="#{officeViewList.officeView.type}"/>
<param name="devName" value="#{devicesList.devices.devName}" />
The entity which populates officeList is OfficeView. The primary key/id for OfficeView is office_id/officeID (param name/entity propert).
I want to be able to access the officeList view with just the office_id parameter set. Like this
http://localhost:8080/ond/officeList.seam?office_id=7872
This works as well. In order for this to work, I had to include office_id in officeList.page.xml like this:
<param name="office_id" value="#{officeViewList.officeView.officeId}" />
etc. the rest of the parameters are not included here for brevity.
The problem is that when office_id is set as a parameter in officeList.page.xml, it turns up with a value of "0" when I click through to the officeList view from the basicSearch view. For instance to display offices in Alaska, I input AK into basicSearch and end up with this URL
http://localhost:8080/ond/officeList.seam?ring=&state=AK&devName=&type=&siteCode=&office_id=0cid=4
rather than this one
http://localhost:8080/ond/officeList.seam?ring=&state=AK&devName=&type=&siteCode=&office_id=cid=4
Of course I get zero results because there is no office with an office_id of 0 and a state of AK.
And yet I need that office_id parameter to be able to use this handy URL to access a single office, as I mention above:
http://localhost:8080/ond/officeList.seam?office_id=7872
How do I make office_id set to "" rather than "0" on queries generated by submitting the form in basicSearch? NOthing else gets a default value. Is it because officeId is type int and all other properties are type String?
How do I get around this?
Perhaps related -- I have an link on the officeList view back to basicSearch and I want office_id to be unset when someone clicks that link. How can I do this?
Here is the link as it is now:
<s:link value="Basic Search" view="/basicSearch.xhtml" /><br />
TDR