You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Denis Avdic <de...@betterway.net> on 2003/05/23 21:36:12 UTC

[OT] parameter vs. attribute?

Hello all,

here is a question:

I have some links on my page which are of the form href="/blah.do?id=15"
Thus my id is exposed in the link and it is a request parameter.

How would I hide this id and how would I forward it as a request attribute?

Thanks,

Denis


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] parameter vs. attribute?

Posted by Ted Husted <hu...@apache.org>.
Denis Avdic wrote:
 > So, if I am understanding this correctly, instead of the link I would
 > have to have something like:
 >
 > <html:form action="myNextAction.do" >
 > <html:hidden property="id"/>
 > <html:submit value="press here"/>
 > </html:form>
 >
 > Assuming that I put id into the associated ActionForm in the previous
 > action?

That would write a simple one-button form to submit the id property. If 
the ActionForm property was set to "15" before forwarding to the page, 
then,yes, it would be the equivalent of the link.

Or, you could have a link too. See the html:link tag.

http://jakarta.apache.org/struts/userGuide/struts-html.html#link

-Ted.



-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] parameter vs. attribute?

Posted by Denis Avdic <de...@betterway.net>.
Hm.... Does the form change across the request from action -> jsp -> action?
Then I could have <a href="/myNextAction.do">Press here</a>
and I would still get the form with the id in it in my next action 
(assuming that I associate the form as input in the struts-config)?

Denis Avdic wrote:

> So, if I am understanding this correctly, instead of the link I would 
> have to have something like:
>
> <html:form action="myNextAction.do" >
> <html:hidden property="id"/>
> <html:submit value="press here"/>
> </html:form>
>
> Assuming that I put id into the associated ActionForm in the previous 
> action?
>
> Ted Husted wrote:
>
>> The Struts model is that you would define id as a property on your 
>> ActionForm. The controller will then populate the property for you 
>> automatically, using reflection. In the Action, you can then retrieve 
>> he property using getId().
>>
>> MyForm myForm = (MyForm) form;
>>
>> String id = myForm.getId();
>>
>> The page itself would not change. There are Struts custom tags that 
>> can help you create references like that dynamically, but the tag 
>> would appear the same in the browser's HTML.
>>
>> -Ted.
>>
>> Denis Avdic wrote:
>>
>>> Hello all,
>>>
>>> here is a question:
>>>
>>> I have some links on my page which are of the form 
>>> href="/blah.do?id=15"
>>> Thus my id is exposed in the link and it is a request parameter.
>>>
>>> How would I hide this id and how would I forward it as a request 
>>> attribute?
>>>
>>> Thanks,
>>>
>>> Denis
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: [OT] parameter vs. attribute?

Posted by Mike Whittaker <mi...@ntlworld.com>.
>So, if I am understanding this correctly, instead of the link I would
>have to have something like:
>
><html:form action="myNextAction.do" >
><html:hidden property="id"/>
><html:submit value="press here"/>
></html:form>
>
>Assuming that I put id into the associated ActionForm in the previous
>action?
>
>

What ever struts does it will have to write a standard hidden tag to the
client, ie name and value, so no, you can't hide the id.

Attributes are internal server side objects, they don't get sent to the
client.

All a client can do is send parameters by GET or POST.

AFAIK.

Mike W


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] parameter vs. attribute?

Posted by Denis Avdic <de...@betterway.net>.
So, if I am understanding this correctly, instead of the link I would 
have to have something like:

<html:form action="myNextAction.do" >
<html:hidden property="id"/>
<html:submit value="press here"/>
</html:form>

Assuming that I put id into the associated ActionForm in the previous 
action?

Ted Husted wrote:

> The Struts model is that you would define id as a property on your 
> ActionForm. The controller will then populate the property for you 
> automatically, using reflection. In the Action, you can then retrieve 
> he property using getId().
>
> MyForm myForm = (MyForm) form;
>
> String id = myForm.getId();
>
> The page itself would not change. There are Struts custom tags that 
> can help you create references like that dynamically, but the tag 
> would appear the same in the browser's HTML.
>
> -Ted.
>
> Denis Avdic wrote:
>
>> Hello all,
>>
>> here is a question:
>>
>> I have some links on my page which are of the form href="/blah.do?id=15"
>> Thus my id is exposed in the link and it is a request parameter.
>>
>> How would I hide this id and how would I forward it as a request 
>> attribute?
>>
>> Thanks,
>>
>> Denis
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] parameter vs. attribute?

Posted by Ted Husted <hu...@apache.org>.
The Struts model is that you would define id as a property on your 
ActionForm. The controller will then populate the property for you 
automatically, using reflection. In the Action, you can then retrieve he 
property using getId().

MyForm myForm = (MyForm) form;

String id = myForm.getId();

The page itself would not change. There are Struts custom tags that can 
help you create references like that dynamically, but the tag would 
appear the same in the browser's HTML.

-Ted.

Denis Avdic wrote:
> Hello all,
> 
> here is a question:
> 
> I have some links on my page which are of the form href="/blah.do?id=15"
> Thus my id is exposed in the link and it is a request parameter.
> 
> How would I hide this id and how would I forward it as a request attribute?
> 
> Thanks,
> 
> Denis
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


[OT] Chetan Khimjee

Posted by Denis Avdic <de...@betterway.net>.
Chetaan needs to empty his mailbox!
Next time he does (meaning whenever someone posts and does not get this 
message) email chetan directly
and kindly (or otherwise) ask him to either empty his mailbox regularly 
or to subscribe to digest version....

grrrr.

Postmaster@impfleet.co.za wrote:

>Your message
>
>  Subject: [OT] parameter vs. attribute?
>
>was not delivered to:
>
>  CKhimjee@impfleet.co.za
>
>because:
>
>  Error delivering to Chetan Khimjee/Impfleet; Router: Database disk quota exceeded
>
>  
>
>------------------------------------------------------------------------
>
>Reporting-MTA: dns;lotus_notes.impfleet.co.za
>
>Final-Recipient: rfc822;CKhimjee@impfleet.co.za
>Action: failed
>Status: 5.0.0
>Diagnostic-Code: X-Notes; Error delivering to Chetan Khimjee/Impfleet; Router: Database disk quota exceeded
>  
>
>
> ------------------------------------------------------------------------
>
> Subject:
> [OT] parameter vs. attribute?
> From:
> Denis Avdic <de...@betterway.net>
> Date:
> Fri, 23 May 2003 15:36:12 -0400
> To:
> Struts Users Mailing List <st...@jakarta.apache.org>
>
>
> Hello all,
>
> here is a question:
>
> I have some links on my page which are of the form href="/blah.do?id=15"
> Thus my id is exposed in the link and it is a request parameter.
>
> How would I hide this id and how would I forward it as a request 
> attribute?
>
> Thanks,
>
> Denis
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org