Thanks Rick.  Once I escaped the “|” all worked just fine.  Thanks for the idea 
and help.

   String[] dates = combinedId.split( “\\|" );

Joaquin Valdez
joaquinfval...@gmail.com

> On Apr 16, 2016, at 12:37 PM, Rick Grashel <rgras...@gmail.com> wrote:
> 
> Joaquin,
> 
> Is this a PK for a domain object?  The domain object is called 
> "FreeShippings"?  If so, add the following two methods like the following to 
> your PK class.  (I have put brute force code here.  You should probably do 
> error-checking) :
> 
> public String getCombinedId() {
>    return this.startDate.getTime() + "|" + this.endDate.getTime();
> }
> 
> // This presumes a delimiter of pipe
> public String setCombinedId( String combinedId ) {
>    String[] dates = combinedId.split( "|" );
>    this.startDate = new Date( Long.parseLong( dates[ 0 ] ) );
>    this.endDate = new Date( Long.parseLong( dates[ 1 ] ) );
> }
> 
> Then, in your form, you do this:
> 
> <input type="hidden" name="freeShippingsPK" 
> value=${actionBean.freeShippingsPK.combinedId}"/>
> 
> If you want, you can also use a TypeConverter to do domain object loading and 
> manipulation.
> 
> When I am dealing with composite primary keys, I almost always have a pseudo 
> single-field setter/getter for convenience and Type conversion.
> 
> -- Rick
> 
> 
> On Sat, Apr 16, 2016 at 1:16 PM, Joaquin Valdez <joaquinfval...@gmail.com 
> <mailto:joaquinfval...@gmail.com>> wrote:
> Thanks Rick!
> 
> The model class I am using doesn’t contain a field called ID as the key.  I 
> wish it did.
> 
> Here is a snippet from the model :
> 
> 
> @Entity
> public class FreeShippings implements Serializable {
> 
>     private static final long serialVersionUID = 1L;
>   
>    @EmbeddedId
>     protected FreeShippingsPK freeShippingsPK;
>     ……
> }
>  
> 
> Where FreeShippingsPK is defined as:
> 
> @Embeddable
> public class FreeShippingsPK implements Serializable {
> 
>     @Basic(optional = false)
>     @NotNull
>     @Column(name = "StartDate")
>     @Temporal(TemporalType.TIMESTAMP)
>     private Date startDate;
> 
>     @Basic(optional = false)
>     @NotNull
>     @Column(name = "EndDate")
>     @Temporal(TemporalType.TIMESTAMP)
>     private Date endDate;
> 
>    // getters and setters...
> }
> 
> How would I reference this type of Primary key in the hiddent INPUT tag?
> 
> Thanks!
> 
> Joaquin Valdez
> joaquinfval...@gmail.com <mailto:joaquinfval...@gmail.com>
> 
>> On Apr 16, 2016, at 11:55 AM, Rick Grashel <rgras...@gmail.com 
>> <mailto:rgras...@gmail.com>> wrote:
>> 
>> Hi Joaquin,
>> 
>> If the ID of the user (being edited?) is already known, you can just use a 
>> regular <INPUT> tag.  No need to use a <s:hidden> tag.  So like this:
>> 
>> <input type="hidden" name="user" value="${actionBean.user.id 
>> <http://actionbean.user.id/>}"/>
>> 
>> This presumes that you have a type converter you are using which will load 
>> the user object when the parameters.  My experience with <s:input> tags has 
>> been varied.  Sometimes it seems to work and in other situations it does not 
>> behave as expected.  So in situations like the one you described, I will 
>> generally stick with a regular <input> tag.
>> 
>> -- Rick
>> 
>> On Sat, Apr 16, 2016 at 12:49 PM, Joaquin Valdez <joaquinfval...@gmail.com 
>> <mailto:joaquinfval...@gmail.com>> wrote:
>> Hello!
>> 
>> I am trying to build a form for a table containing records that has an 
>> embedded Primary Key.  How is that done?  Typically I just do this in the 
>> form tag:
>> 
>> <s:form beanclass=“….”>
>>      <s:hidden name=“user”/>
>>      ….
>> </s:form>
>> 
>> Currently I have it set up as I mentioned and when I try to retrieve the 
>> user record, it comes back NULL.
>> 
>> Thanks!
>> Joaquin Valdez
>> joaquinfval...@gmail.com <mailto:joaquinfval...@gmail.com>
>> 
>> 
>> ------------------------------------------------------------------------------
>> Find and fix application performance issues faster with Applications Manager
>> Applications Manager provides deep performance insights into multiple tiers 
>> of
>> your business applications. It resolves application problems quickly and
>> reduces your MTTR. Get your free trial!
>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z 
>> <https://ad.doubleclick.net/ddm/clk/302982198;130105516;z>
>> _______________________________________________
>> Stripes-users mailing list
>> Stripes-users@lists.sourceforge.net 
>> <mailto:Stripes-users@lists.sourceforge.net>
>> https://lists.sourceforge.net/lists/listinfo/stripes-users 
>> <https://lists.sourceforge.net/lists/listinfo/stripes-users>
>> 
>> 
>> ------------------------------------------------------------------------------
>> Find and fix application performance issues faster with Applications Manager
>> Applications Manager provides deep performance insights into multiple tiers 
>> of
>> your business applications. It resolves application problems quickly and
>> reduces your MTTR. Get your free trial!
>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z_______________________________________________
>>  
>> <https://ad.doubleclick.net/ddm/clk/302982198;130105516;z_______________________________________________>
>> Stripes-users mailing list
>> Stripes-users@lists.sourceforge.net 
>> <mailto:Stripes-users@lists.sourceforge.net>
>> https://lists.sourceforge.net/lists/listinfo/stripes-users 
>> <https://lists.sourceforge.net/lists/listinfo/stripes-users>
> 
> 
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z 
> <https://ad.doubleclick.net/ddm/clk/302982198;130105516;z>
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net 
> <mailto:Stripes-users@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/stripes-users 
> <https://lists.sourceforge.net/lists/listinfo/stripes-users>
> 
> 
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z_______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to