Reply To: pretty url broken

Splash Forums PrettyFaces Users pretty url broken Reply To: pretty url broken

#27579

hairi11
Participant

Hi.

Please see code snipped. thx

<url-mapping parentId="ilibrary" id="publication-edit">
	<pattern value="/edit/#{pubCategoryCode}/#{publicationId}" />
	<view-id value="/pages/protected/isralib/publication/edit.xhtml" />
</url-mapping>

<url-mapping parentId="ilibrary" id="publication-view">
	<pattern value="/view/#{pubCategoryCode}/#{publicationId}" />
	<view-id value="/pages/public/isralib/publication/view.xhtml" />
</url-mapping>
<h:form id="edit" enctype="multipart/form-data">
	<p:commandButton value="#{msg['global.btn.save']}"
				 actionListener="#{bean.save}"
				 ajax="false" styleClass="GreenButton">
		<f:param name="pubCategoryCode" value="PBB"/>
	</p:commandButton>
</h:form>
save() {
	FacesContext facesContext = FacesContext.getCurrentInstance();
	ExternalContext externalContext = facesContext.getExternalContext();
	HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
	String url = request.getRequestURL().toString().replace(request.getRequestURI().substring(0), "") + request.getContextPath();
	String path = "/pages/public/isralib/publication/view.xhtml?publicationId=8123&pubCategoryCode=PBB&faces-redirect=true";

	try {
	    externalContext.redirect(url + path);
	} catch (IOException e) {
	    getLogger().error("Redirect failed", e);
	}

}