Java or jsp..

hi, i'm a newbie here and i hope this is not a stupid question of mine; i'd like to ask for your opinion and here it goes..
i've been reading some books, tutorials, forums etc and
i could not make up my mind whether to focus on JAVA first or to jump directly into JSP. Since i have a little background on C++ (although i'm ot too good at it), i think that if i just go on focusing on JSP, then on the same time i'll be able to understand Java as well.
but in the mean time, a friend of mine advice me to stick into Java first, and when i'm very good at it then i should jump into JSP.
right now i'm still studying and i was hoping before i graduate (1 more year), i'll have one programming skills for me to 'survive' later on.
Emm..your opinion please..? thanks..

A JSP (Java Server Page) is an HTML page with Java
code inside it.Though with as little code as possible actually embedded in the HTML.
One of the most important things with JSP is seperation. That is seperating your code form your html (and hopefully your html from you style/css).
Learn Java first, as this way you will get used to writing Java classes. You can then use these classes from within your JSPs.
I think if you went straight for JSPs you'd pick up a lot of bad habbits, and even when you start writing JSPs you're likely to find it a lot easier and quicker to prdouce bad pages (mix of html and java) than good pages (nice seperation).
When you get on to learning JSPs make sure you try and learn good practices from the start.
When you learn Java, make sure you learn about Object Oriented Programming.
Being a bad programmer means learning the syntax.
Being a good programmer means learning the theory and practices.

Similar Messages

  • How to use VPD in Java/Struts JSP portlet with SSO

    DB = 10.1.0 (Standard Edition)
    Portal = 9.0.4.1
    10gAS = 9.4.0.1 (EE)
    I am in the beginning stages of developing some portlets that will be Java/Struts JSP based. We use SSO and have implemented some VPD security in our DB by creating some views that use SYS_CONTEXT('USERENV','CURRENT_USERID').
    These Java portlets connect to the DB using a defined JDBC connection for the OC4J container they are deployed in. The problem I'm having is that the call to SYS_CONTEXT is returning the user of the JDBC connection and not the SSO user. So far I have been unable to find any documentation that will point me in the right direction to get this configured properly.
    Deployment and configuration are as follows. Deploy war file to custom container on app server. In the configuration of the OC4J contain the app used the containers default JDBC connection using the oracle.jdbc.pool.OracleDataSource class. Max and Min open connections are blank.
    In the portal configuration under Navigator - Providers tab we defined a new Registered Provider. In the Connections tab for the provider we Specify the URL Http://hpsrv02.simsol.com:7777/discovery-portlets/providers. Under "Specify how the user's identity will be set by the Portal..." the "The user has the same identity in the Web providers application as in the Single Sign-On identity" is selected. Under "User/Session Information" User is selected and Login Frequency is set to "Once per user session". Then we created a new portal page and created a new portlet with the new provider.
    Just an FYI I do have Discoverer working with VPD and any report portlet, dynamic page portlet and any other type of portlet I created all work correctly with VPD it is just the java/struts one that is not working.
    So does any one have any insight into what configuration steps I have missed?
    Any help is much appreciated,
    Ed Klinger

    Ed,
    Your java code must get the SSO username (it's just a HTTP header variable) :
    ie: code sample...
    Enumeration e = request.getHeaderNames();
    while (e.hasMoreElements()) {
    String name = (String)e.nextElement();
    String value = request.getHeader(name);
    out.println("<br> "+name + " = " + value);
    if (name.toUpperCase().trim().equals("OSSO-USER-DN")){
    dn_user=value;
    out.println("<br>******** USER DN = "+dn_user);
    Then, the SSO username can be used in the VPD policy.
    Note that there is a difference between the sso username and the database username . SSO username is not known by database (CURRENT_USERID will return a database username)
    Discoverer worked OK in your case with the SYS_CONTEXT (.. CURRENT_USERID) because authentication is made by database user, probably.

  • How to execute unix command in java  or jsp

    have a peace day,
    please send some sample code for
    "execute the unix command in java or jsp"
    thank you
    regards
    rex

    i execute this coding
    its compiling. while running i get the error " java.io.IOException: CreateProcess: \ls-l error=2 "
    import java.io.*;
    import java.util.*;
    public class Test
       public static void main(String[] args) throws Exception
         try
              String[] cmd = {"/ls-l"};
    Runtime.getRuntime().exec(cmd);
         catch (Exception e)
               System.out.println(e);
      }what can i do for that
    thank u

  • Websites for downloading code-templates (java and jsp) existing ?

    Hi,
    I'm searching for a website, offering code examples or templates (in java and jsp) for downloading.
    For example: A code for creating a new xml-file, login-procedure or sending an e-mail with a java-program, I can customize.
    I know, for asp.net such websites for downloading code-templates are existing (e.g. a German website: http://www.aspheute.com).
    So I think for java and jsp those sites will also be existing�
    Does anyone know some links ?
    bye
    Chris

    Yes, with google - I'll surely find some matches, but I'm looking for links and websites which will be provided by personal experiences.
    With google - you won't find any personal experiences...
    bye
    Chris

  • Java or JSP editor ?

    please suggest me a good Java and JSP editor, which can be used to create plain java classes (java beans or servlet) and JSP pages.
    is NetBeans or Eclipse will fulfill my requirement ?or what else ?

    please suggest me a good Java and JSP editor, which
    can be used to create plain java classes (java beans
    or servlet) and JSP pages.
    Try a new one every week for the next several years and decide for yourself which you like best.
    There's enough of them to keep you occupied as our resident editor tester for the rest of your life even if no new ones were released every day or so.
    is NetBeans or Eclipse will fulfill my requirement
    ?or what else ?doubt have abt ur rekwaierements fur editer. plz respond asap.

  • Learning java before jsp?

    Do I need to know Java before learning JSP?
    Also, I have a laptop that I am using at home and would like to start learning Java and JSP. Will Tomcat work on my laptop? Can I launch it from my desktop?

    It is not absolutely necessary to learn java before you learn jsp, but you must at least have programming experience. But if you want to do better, then you need to learn java.
    tomcat should run on your laptop.

  • Ideas pls for a small application on java and jsp?

    hi ,
    I would like to create an application which for resume. I would like to codify the java code . The java code should be able to autogenerate jsp file's since the output of the resume would be on an jsp page. To add it simply a wizard for dynamic resume creation using java swings and jsp. Code for jsp should be autogenerated please note it.
    Ideas please!
    Thanks in advance

    I'd like to add more information to Patreck's suggestion.
    JSP pages are wonderful if you need the web server to perform some actions before sending you the final web page.
    Here, you don't need the web server to do anything because your Swing application can do it for you. As Patreck implies, Swing can make a connection to the database, retrieve any information you want, perform whatever logic you need, and write the output to an HTML file.
    To give you an example, you can use Internet Explorer to view a basic web page on your hard disk. You can also use Microsoft Word to view the same basic web page. They both do the same task and there is no need to force IE to use its Word plug-in in order to view the web page.
    JSPs are not necessary because Swing will do all of the work for you. You only need JSPs if you want people to use your program through a web browser because they can't do Swing inside a web browser. You should only use one or the other, not both. Understand now?
    If you really really must generate JSP code from a Swing application, then just write out the JSP stuff in the file. For example...
    public void createWebPage( Printwriter pw, String myName ) {
       pw.println( "<% String myJSPName = \"" + myName + "\" %>" );
       pw.println( "<HTML>");
       pw.println( "<HEAD>");
       pw.println( "<TITLE>My Resume</TITLE>" );
       pw.println( "</HEAD>");
       pw.println( "<BODY>" );
       pw.println( "<H1>My name is " + myName + " and my JSP name is <%= myJSPName %></H1>" );
       pw.println( "</BODY>" );
       pw.println( "</HTML>" );
    }As you can see, it's pointless to embed JSP when you can do all the programming within Swing first and just write out the correct response.

  • How to call a function from Java to JSP

    Hello,
    I have a question about using tags.
    I have a java file,which has a function. Now I want to call this function into my JSP page.
    I'm using JSP 1.2 and TOMCAT 4.1 with Java2 SDK.
    I search through the web and find a method to do this.Bu it requires JSP 2.0
    But I try that in my machine(using JSP 1.2).It gives an error:
    Did you know what is the error? Or is there any method to call a function into my JSP page?
    Please, help me to solve this.
    Here are my codes(part of them)
    UserPassword.java file
    package data;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class UserPassword
         public static String verify(String username,String password){
              // some codes
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib
            PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
         "http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
      <tlib-version>1.0</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name>simple</short-name>
      <uri>http://jakarta.apache.org/tomcat/HRM/WEB-INF/lib</uri>
      <description>
         A  tab library for the login
      </description>
    <function>
            <description>verify username and password</description>
            <name>verify</name>
            <function-class>data.UserPassword</function-class>
            <function-signature>String verify(java.lang.String,java.lang.String)
            </function-signature>
    </function>
    </taglib>I put this file into the webapps/HRM/WEB-INF/lib folder
    Here is my JSP file.
    <%@ page language="java" %>
    <%@ page import="data.UserPassword" %>
    <%@ page session="true" %>
    <%@ taglib prefix="login" uri="/WEB-INF/lib/LoginVerify.tld" %>
    <jsp:useBean id="useraccount" class="data.UserPassword"/>
    <jsp:setProperty name="useraccount" property="*"/>
    <%
    String status = UserPassword.verify(String username,String password);
    String nextPage = "MainForm.jsp";
    if(status.equals("InvalidU")) nextPage ="InvalidUserName.jsp";
    if(status.equals("InvalidP")) nextPage ="InvalidPassword.jsp";
    if(status.equals("main")) nextPage ="MainForm.jsp";
    %>
    <jsp:forward page="<%=nextPage%>"/>
    Here is the error:
    org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/lib/LoginVerify.tld: (line 18, col -1): Element "taglib" does not allow "function" here.
         at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:189)
         at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:247)
         at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:183)
         at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
         at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381)Please, help me to solve this trouble.
    Thanks.

    Yes. As serlank showed, you can just call the function easily in scriptlet tags
    However the whole point of a tag library is to avoid the use of scriptlets.
    Seeing as you can't use functions, is just to do it as a standard tag.
    ie in your jsp
    <login:verify name="<%= userName %>" password = "<%= password %>" resultVar = "status"/>
    <c:choose>
      <c:when test="${status == 'InvalidU'}">
        <c:set var="nextPage" value="InvalidUserName.jsp"/>
      </c:when>
      <c:when test="${status == 'InvalidP'}">
        <c:set var="nextPage" value="InvalidPassword.jsp"/>
      </c:when>
    </c:choose>In your case, this tag in the tld would possibly look something like this.
    You would then have to write a tag handler class that would call the function you want.
    <tag>
      <name>verify</name>
      <tagclass>com.tags.login.Verify</tagclass>
      <teiclass>com.tags.login.VerifyTEI</teiclass>  (if required)
      <bodycontent>JSP</bodycontent>
    // name attribute 
    <attribute>
          <name>name</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
        </attribute>
    // password attribute
        <attribute>
          <name>password</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
        </attribute>
    // result variable to return a response from the tag.
      <variable>
        <name-from-attribute >resultVar</name-from-attribute >
        <variable-class>java.lang.String</variable-class>
        <declare>true</declare>
        <scope>AT_END</scope>
      </variable>
    </tag>Hope this helps some, and doesn't confuse too much :-)
    Cheers,
    evnafets

  • How to use setSelectedItem (java) in jsp

    hai,
    iam very much new to JSP. i have a combo box which has values populated from database. i got the combo box value selected by the user.
    now my question is how to set a particular value in a combo as we do in java using setSelectedItem("value");
    thanks

    Hi,
    You can Do it through Ajax as such you can't d it directly in Jsp.Since You are New to Jsp I dont want to confuse you.What you can do is instead of Using another combobox initially you can try to list those items with a radiio button once you select the radiobutton and give a go button the corresponding items can be selected initially you can try then you can try another way.
    R.Ramesh.

  • Java beans + jsp

    From a jsp I can use the setProperty property="*" method of java beans to set all the properties in a java bean, where each property has a corresponding element in the jsp page. How do I set the property of a java bean where I have the type of jsp code
    <%for (i=0;i<=15;i++)
    %>
    <input type="text" name="Text1" >
    <%
    %>
    I want to set the property of the javabean at one go.

    You need to have setter methods in the java bean corresponding
    to field names in the page. So, I don't think this can be done.

  • "Java file" & "Jsp file" compilation issues in Eclipse

    Hi,
    Eclipse
    Question 1:
    I have set the value for preference->java->Installed JREs as : j2re1.4.2_07 not to jdk
    When I write a java file, its compiling, how? From where its using "javac" exe file for compilation.
    Question 2:
    Whereas in prefrence->Tomcat->JVMSettings -> JRE(drop down box) set value as j2re.1.4.2_07
    When I write a jsp file as follows
    index.jsp
    <html>
    <body>
    <%java.util.Date d = new java.util.Date();%>
    Todays date is <%= d.getDate()%> and this jsp page worked!
    </body>
    </html>
    when i try to save this file & strat tomcat I got exception as follows:
    Exception:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: -1 in the jsp file: null
    Generated servlet error:
    [javac] Compiling 1 source file
    Please clear my doubts.
    Thanks,
    Hari

    Try going into your TOMCAT_HOME/conf/web.xml and look for this section:
    <servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
    <param-name>logVerbosityLevel</param-name>
    <param-value>WARNING</param-value>
    </init-param>
    <init-param>
    <param-name>fork</param-name>
    <param-value>false</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
    </servlet>
    Change the <param-value> for fork from false to true and see if that helps.
    Otherwise it's a problem with your JSP.

  • Help me to convert Java and Jsp Files into WAR File!!!!

    I need someone to help me to convert some java servlet files and jsp files into a WAR file. I need it URGENTLY and I'll be very grateful to anyone who is willing to help me! My email is [email protected] Thanks!!!!

    Are the Oracle JDBC drivers 11g used?
    oracle.jdbc.driver.OracleDriver is not supported in 11g drivers.
    Please replace with:
    oracle.jdbc.OracleDriver

  • Java in JSP page can't find local file

    Hi. I am very new to JSP development. I am having a strange issue. When I try to access a file within the same directory as my JSP file I get a FileNotFoundException thrown. Although, I can link the file using HTML so I know it is there in the proper directory.
    <%
    String line;
    int i = 0;
    try {
         File file  = new File("test1.csv");
         Scanner in = new Scanner(file);
         while (in.hasNextLine()) {
              line = in.nextLine();
              String strArray[] = line.split(",");
              for(int j = 0; j < strArray.length; ++j) {
                   out.print((i != 0) ? (" " + strArray[j] + " ") : (" <b>" + strArray[j] + "</b> "));
              out.println("<br>");
              i++;
    catch(IOException e) {
          out.print(e);
    %>Anyone know how I can get the JSP to read the file?

    java.io.File understands disk file system paths only, not web paths. Also, using absolute paths in java.io stuff is preferred above relative paths, because the current working directory may differ per environment.
    In case of a webapplication you can use ServletContext#getRealPath() to convert a web path to an absolute disk file system path which you can use further in the usual java.io stuff.

  • Use HTTP Session to pass Object from Web Dynpro for Java to JSP page

    Is it possible to get a handle on the HTTP Session object from within a Web Dynpro application? I want to place a Java object in there that can be retrieved by a JSP page.
    Thanks in advance.

    Hi Tom Cole,
       You can try this. i am not sure if this will work or not.
    HttpServletRequest request = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();
    You can also try this.
    IWDRequest mm_request = WDProtocolAdapter.getProtocolAdapter().getRequestObject();
    HttpServletRequest request = (HttpServletRequest)mm_request.getProtocolRequest();
    IWDRequest basically wraps the HttpServletRequest. if you are using NW04s then the getProtocolRequest() may not be available.
    Regards,
    Sanyev

  • Call Java from JSP?

    I have a button on a JSP.
    This jsp is using normal html tags - not htmlb tags.
    Normally, I think, the onClick action of a button calls JavaScript.
    Is it possible to call a Java method that is on the same jsp page instead of calling a javascript function?
    If I use HTMLB tags, my code would look like:
    <hbj:button
                                  id="<%=SAPMLogonLogic.uidPasswordLogonAction%>"
                                  text="<%=logonLocale.get("LOGON")%>"
                                  jsObjectNeeded="TRUE"         
                                  width="125px"
                                  tooltip="Click here to log on"
                                  onClick="getUserAgreement"
                                  onClientClick="submitForm"         
                                  disabled="false"
                                  design="EMPHASIZED"
                             />
    But, I just want to use html tags. So, my code would look like this, I suppose:
    <input style="height:3ex;" class="urBtnStd" type="button" name="<%=SAPMLogonLogic.uidPasswordLogonAction%>" value="<%=logonLocale.get("LOGON")%>" onClick="getUserAgreement()">
    Message was edited by: Eric Heilers

    No, you can't do this.
    This is because java is a server side script which cannot be directly called from client side script (javascript).
    You need to post a html form and do some processing there.
    You could for example have a hidden field in the form which you set dynamically with javascript to the method you wish to call, then when you get the form posted to the java code again you can use java reflection api to call the method. (this is in essence what HTMLB does when using the onClick method)

  • Java technologies (JSP, Servlet, Reflection).

    Hello.
    I have questions about Java technologies.
    3. what is it Stud&Skeleton and how are they created?
    4. what is it Reflection?
    5. what the relations between JSP and Java Servlets?
    6. what is it Remote object and how is it created?
    Thanks in advance.
    Tomer

    Hello.
    I have questions about Java technologies.
    3. what is it Stud&Skeleton and how are they created?http://java.sun.com/docs/books/tutorial/rmi/index.html
    4. what is it Reflection?http://java.sun.com/docs/books/tutorial/reflect/index.html
    5. what the relations between JSP and Java Servlets?http://java.sun.com/docs/books/tutorial/servlets/
    http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
    6. what is it Remote object and how is it created?http://java.sun.com/docs/books/tutorial/rmi/index.html
    happy reading!
    cheers,
    p

Maybe you are looking for

  • Problem in accessing query

    Hi Experts, I am facing a strange problem when working with BI 7.0, can you please help me out. One user is facing some authorization problem while executing queries, he is using query through BEX. In order to analyse when i copy his user id and when

  • Serving webpage with image stored in database

    This may look long, but it's easy to understand--I'm just trying to give all the details you might want: In our servlet/JSP site, a user can generate a report that may or may not contain images. The servlet just sends the user to a regular HTML page.

  • Usage of Switch Case

    Hi, I would like to get some help with regard to usage of Break inside Switch . And moreover can we have a name for switch statements. ex : <switch name='xyz'> Thanks, Jeyanth

  • SDO_GEOMETRY displaying in Oracle SQL Developer (freezing)

    Hi, I am using Oracle SQL Developer (V 1.5.3) heavily at work, and have noticed some undesirable behaviour when the table's data tab is trying to display SDO_GEOMETRY. In this version (and subsequent ones) Developer tries to convert the geometry to W

  • How to see any changes done in BOM through Engineering change management?

    Dear experts, My client need to verify the revision of some assemblies in BOM through ECM. I tried to verify it by taking some change numbers & executing it in CC03. I am getting the history date & name of person who done the changes. But can not abl