Frank Rocco
|
| Posted: 12/03/2002, 12:44 PM |
|
Hello,
I want to assign the Session("UserID") to a database field using custom
code.
What is the syntax to do this in JSP/Java?
trying to switch gears from ASP.
Thanks
Frank
|
|
|
 |
Michael Rachow
|
| Posted: 12/06/2002, 2:36 PM |
|
Hi Frank,
small function of mine containing some of the "requested" assignments
void setShowFromUni(javax.servlet.http.HttpSession session,
javax.servlet.http.HttpServletRequest request) {
if(getParam(request, "UniID").length() > 0)
session.setAttribute("ShowID", getParam(request, "UniID"));
if(session.getAttribute("ShowID").toString().length() == 0)
session.setAttribute("ShowID", "987654321");
return;
}
"Frank Rocco" <farocco@hotmail.com> schrieb im Newsbeitrag
news:asj535$kp6$1@news.codecharge.com...
> Hello,
>
> I want to assign the Session("UserID") to a database field using custom
> code.
> What is the syntax to do this in JSP/Java?
> trying to switch gears from ASP.
>
> Thanks
>
> Frank
>
>
|
|
|
 |
Frank Rocco
|
| Posted: 12/06/2002, 6:22 PM |
|
Hi Michael,
Thanks for the info, I'm looking how this applies to CCS using JSP &
Templates?
Seems like Java is much more complicated to use over php.
Regards,
Frank
"Michael Rachow" <michael@famrachow.com> wrote in message
news:asr8pc$ef9$1@news.codecharge.com...
> Hi Frank,
>
> small function of mine containing some of the "requested" assignments
>
> void setShowFromUni(javax.servlet.http.HttpSession session,
> javax.servlet.http.HttpServletRequest request) {
> if(getParam(request, "UniID").length() > 0)
> session.setAttribute("ShowID", getParam(request, "UniID"));
> if(session.getAttribute("ShowID").toString().length() == 0)
> session.setAttribute("ShowID", "987654321");
> return;
> }
>
>
>
> "Frank Rocco" <farocco@hotmail.com> schrieb im Newsbeitrag
>news:asj535$kp6$1@news.codecharge.com...
> > Hello,
> >
> > I want to assign the Session("UserID") to a database field using custom
> > code.
> > What is the syntax to do this in JSP/Java?
> > trying to switch gears from ASP.
> >
> > Thanks
> >
> > Frank
> >
> >
>
>
|
|
|
 |
Michael Rachow
|
| Posted: 12/07/2002, 5:50 AM |
|
Sorry Frank,
seems it was to late yesterday evening.
Havn't been aware of the part with database access.
I recommend to have a look at common.jsp and Login.jsp.
I would use openrs for executing an sql statement.
If common.jsp is included you should have the right environment
to use ist.
java.sql.ResultSet rs = null;
rs = openrs( stat, "select AZU_ID, secure from Benutzer where login =" +
toSQL(sLogin, adText) + " and passwort=" + toSQL(sPassword, adText));
BTW the online help is wrong in regard to the parameters resp. return value
for openrs()
The instance stat should be there. It was created by a factory method of the
connection.
++++
I think JSP could easily become more complex because you can mix it with
Java.
A lot of the used objects like session, request and response are "native"
Java objects.
Most of the JSP tags are an easy way of coding Java only. Later they'll be
translated
into Java.
Thats why servlets are more efficient than JSP's.
JSP: -> Java -> class
Servlet: already compiled Java class.
Michael
"Frank Rocco" <farocco@hotmail.com> schrieb im Newsbeitrag
news:asrm0i$634$1@news.codecharge.com...
> Hi Michael,
>
> Thanks for the info, I'm looking how this applies to CCS using JSP &
> Templates?
> Seems like Java is much more complicated to use over php.
>
> Regards,
>
> Frank
>
> "Michael Rachow" <michael@famrachow.com> wrote in message
>news:asr8pc$ef9$1@news.codecharge.com...
> > Hi Frank,
> >
> > small function of mine containing some of the "requested" assignments
> >
> > void setShowFromUni(javax.servlet.http.HttpSession session,
> > javax.servlet.http.HttpServletRequest request) {
> > if(getParam(request, "UniID").length() > 0)
> > session.setAttribute("ShowID", getParam(request, "UniID"));
> > if(session.getAttribute("ShowID").toString().length() == 0)
> > session.setAttribute("ShowID", "987654321");
> > return;
> > }
> >
> >
> >
> > "Frank Rocco" <farocco@hotmail.com> schrieb im Newsbeitrag
> >news:asj535$kp6$1@news.codecharge.com...
> > > Hello,
> > >
> > > I want to assign the Session("UserID") to a database field using
custom
> > > code.
> > > What is the syntax to do this in JSP/Java?
> > > trying to switch gears from ASP.
> > >
> > > Thanks
> > >
> > > Frank
> > >
> > >
> >
> >
>
>
|
|
|
 |
Frank Rocco
|
| Posted: 12/07/2002, 6:41 AM |
|
Thanks Michael,
Let me narrow my problem using JSP in CCS.
Say I have a form that has a hidden field called LastUserID.
When the form is updated, I want to assign the LastUserID the value of the
user logged in via the
session("UserID").
in PHP, I can say $form->LastUserID = get_session("UserID");
How is this done in CCS for JSP?
I want to be able to get and set variables on a form in CCS using JSP.
If I code JSP/Servlet pages by hand, I understand how to use getAttribute,
but am lost in the way CCS requires the correct syntax to do the same using
it's templates. It just seems alot harder to me to do the same in JSP over
PHP.
HTH
Frank
|
|
|
 |
Michael Rachow
|
| Posted: 12/08/2002, 3:13 PM |
|
Now I got it.
Sorry Frank, havn't done this until now.
Mic
"Frank Rocco" <farocco@hotmail.com> schrieb im Newsbeitrag
news:ast1be$i21$1@news.codecharge.com...
> Thanks Michael,
>
> Let me narrow my problem using JSP in CCS.
> Say I have a form that has a hidden field called LastUserID.
> When the form is updated, I want to assign the LastUserID the value of the
> user logged in via the
> session("UserID").
> in PHP, I can say $form->LastUserID = get_session("UserID");
> How is this done in CCS for JSP?
> I want to be able to get and set variables on a form in CCS using JSP.
>
> If I code JSP/Servlet pages by hand, I understand how to use getAttribute,
> but am lost in the way CCS requires the correct syntax to do the same
using
> it's templates. It just seems alot harder to me to do the same in JSP over
> PHP.
>
> HTH
>
> Frank
>
>
|
|
|
 |
somebody
|
| Posted: 12/09/2002, 12:22 AM |
|
Hi Frank,
Frank Rocco wrote:
> Thanks Michael,
>
> Let me narrow my problem using JSP in CCS.
> Say I have a form that has a hidden field called LastUserID.
> When the form is updated, I want to assign the LastUserID the value of the
> user logged in via the
> session("UserID").
> in PHP, I can say $form->LastUserID = get_session("UserID");
> How is this done in CCS for JSP?
In CCS 2 beta 1 (if you used form event)
e.getComponent().getControl("LastUserID").setValue(SessionStorage.getInstance(e.getPage().getRequest()).getAttribute("UserID"));
> I want to be able to get and set variables on a form in CCS using JSP.
>
> If I code JSP/Servlet pages by hand, I understand how to use getAttribute,
> but am lost in the way CCS requires the correct syntax to do the same using
> it's templates. It just seems alot harder to me to do the same in JSP over
> PHP.
>
> HTH
>
> Frank
>
>
|
|
|
 |
Frank Rocco
|
| Posted: 12/09/2002, 6:43 AM |
|
somebody help me. <g>
Thanks for the tip, I tried it and get a null pointer exception.
This works.
e.getComponent().getControl("article_title").setValue("Test");
This causes the exception.
e.getComponent().getControl("LastUserID").setValue(SessionStorage.getInstanc
e(e.getPage ().getRequest()).getAttribute("UserID"));
I'm using the Portal app and the Before Show event in Edit Articles. The
event caption shows Record: articles
HTH
Thanks for the help.
Frank
P.S. Why is JSP so much harder to learn than PHP? I read some JSP books, but
cannot see how to apply this to CCS JSP code.
|
|
|
 |
Frank Rocco
|
| Posted: 12/09/2002, 6:56 AM |
|
I found out the variable for user id in the portal is "PortalUserID"
Now it works... thanks
Frank
|
|
|
 |
|