1

The default behaviour for uploading image, using Stereotype("PHOTO") will change the url. For example, localhost:8080/m/Activity?Uid=15&Year=2017 will change to localhost:8080/m/Activity?application=Survey&module=Activity once image loaded. I have tried to retain the url with the code shown below but it does not work. Can somebody help me on how to retain the previous url?

ImageEditor.jsp

<%@ include file="../imports.jsp"%>

<%@ page import="org.openxava.model.meta.MetaProperty" %>
<%@ page import="org.openxava.web.Ids" %>

<%
String propertyKey = request.getParameter("propertyKey");
MetaProperty p = (MetaProperty) request.getAttribute(propertyKey);
boolean editable="true".equals(request.getParameter("editable"));
String uId = request.getParameter("UId");
String year = request.getParameter("Year");
long dif=System.currentTimeMillis(); // to avoid browser caching
%>

<img id='<%=propertyKey%>' name='<%=propertyKey%>' src='<%=request.getContextPath()%>/xava/ximage?UId=<%=uId%>&Year=<%=year%>&property=<%=propertyKey%>&dif=<%=dif%>' title="<%=p.getDescription(request)%>" alt=""/>

<% if (editable) { %>   
    <span valign='middle'>
        <xava:link action='ImageEditor.changeImage' argv='<%="newImageProperty="+Ids.undecorate(propertyKey)%>'/>
        &nbsp;&nbsp;
        <xava:action action='ImageEditor.deleteImage' argv='<%="newImageProperty="+Ids.undecorate(propertyKey)%>'/> 
    </span>
<% } %> 

Thanks.

Brian

Brian Cheong
  • 43
  • 2
  • 14

1 Answers1

0

OpenXava changes the URL after uploading, it works in that way. You should store the parameter values in a session object to not lossing them.

javierpaniza
  • 677
  • 4
  • 10
  • Thanks for answering my question on both discussion sites. But @javierpaninza, I must have the parameter value to allow me to set the value into my database. If I can't get the value due to altered URL, the parameter value going to be stored in the database will be NULL. For your information, I am using String sysuId = getRequest().getParameter("LocId") to get the value and getView().setValue("locId", locId) to store the value. Is there any other way of getting and setting the parameter value? Also, I am able to get and set the value before the URL altered but not anymore after that. – Brian Cheong Mar 08 '17 at 08:17
  • if sysuId is null do not assign it to the view. – javierpaniza Mar 13 '17 at 11:43