• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 19:19
CET 00:19
KST 08:19
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book19Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8
Community News
BGE Stara Zagora 2026 cancelled10Blizzard Classic Cup - Tastosis announced as captains12Weekly Cups (March 2-8): ByuN overcomes PvT block4GSL CK - New online series18BSL Season 224
StarCraft 2
General
BGE Stara Zagora 2026 cancelled BGE Stara Zagora 2026 announced ByuL: The Forgotten Master of ZvT Terran AddOns placement Blizzard Classic Cup - Tastosis announced as captains
Tourneys
StarCraft Evolution League (SC Evo Biweekly) [GSL CK] Team Maru vs. Team herO WardiTV Team League Season 10 Master Swan Open (Global Bronze-Master 2) RSL Season 4 announced for March-April
Strategy
Custom Maps
Publishing has been re-enabled! [Feb 24th 2026] Map Editor closed ?
External Content
The PondCast: SC2 News & Results Mutation # 516 Specter of Death Mutation # 515 Together Forever Mutation # 514 Ulnar New Year
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ ASL21 General Discussion BW General Discussion Gypsy to Korea Are you ready for ASL 21? Hype VIDEO
Tourneys
[Megathread] Daily Proleagues [BSL22] Open Qualifiers & Ladder Tours IPSL Spring 2026 is here! ASL Season 21 Qualifiers March 7-8
Strategy
Simple Questions, Simple Answers Soma's 9 hatch build from ASL Game 2 Fighting Spirit mining rates Zealot bombing is no longer popular?
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread PC Games Sales Thread No Man's Sky (PS4 and PC)
Dota 2
Official 'what is Dota anymore' discussion The Story of Wings Gaming
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Five o'clock TL Mafia Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Mexico's Drug War NASA and the Private Sector
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Movie Discussion! [Req][Books] Good Fantasy/SciFi books [Manga] One Piece
Sports
Formula 1 Discussion 2024 - 2026 Football Thread General nutrition recommendations Cricket [SPORT] TL MMA Pick'em Pool 2013
World Cup 2022
Tech Support
Laptop capable of using Photoshop Lightroom?
TL Community
The Automated Ban List
Blogs
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
Gaming-Related Deaths
TrAiDoS
Unintentional protectionism…
Uldridge
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1695 users

The Big Programming Thread - Page 614

Forum Index > General Forum
Post a Reply
Prev 1 612 613 614 615 616 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
April 15 2015 21:03 GMT
#12261
On April 15 2015 13:41 FFGenerations wrote:
ok well i've given up trying to make it work this way for now. i sort of understand what you've been saying earlier about the autogenerated thing being fucked up. what you wrote totally flew over my head before, but you kept railing on about it until i started to understand. thanks all, you've been brilliant!

will move on to trying to parse it myself instead

Good that you're moving in the right direction .

Just a couple things so you don't get overly dissuaded. There's nothing inherently wrong with using auto-generated code, and in fact a lot of major frameworks will have you relying a bit on them (C# with ADO.NET comes to mind). The important thing is to understand why you're using an auto-generator, and how actually interact with it.

Overriding ToString() methods is also a valid option in many cases, and returning the main identifier for an object like a Name is definitely a good time to do it. Of course, in this circumstance it would be a band-aid solution, because inevitably you'll want other information from you objects, and you'll be right back to the same problem you started with.

Finally, parsing text may seem like a massive undertaking at first, but it's something you will be dealing with eventually if you're a programmer of any kind, so it's definitely something worthwhile to learn. Luckily for you, you're dealing with XML, which is basically designed to be parsed easily.
Average means I'm better than half of you.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-15 22:55:38
April 15 2015 22:33 GMT
#12262
i found a pretty crazy good tutorial



i done the basic one first which also shows it being done with Lists then was wondering why the fuck my nested xml wasnt working and then found the person had just uploaded this one, thank god

so ..... the next thing i'm going to find out is how "deep" into the xml file i need to go to get the data i want i guess, or how far i can simplify it before it fucks up on me. i tend to lean towards it being easy now but i might end up having to look at a plugin that jumps to the parts i want, or something, which would be annoying :D since i have 5 days left lol

the xml file starts off something like this

<ann>
- <anime id="16547" gid="1838091909" type="OAV" name="Kono Danshi, Sekika ni Nayandemasu" precision="OAV" generated-on="2015-04-14T20:49:39Z">
<related-prev rel="related to" id="13312" />
- <info gid="1527892938" type="Picture" src="http://cdn.animenewsnetwork.com/thumbnails/fit200x200/encyc/A16547-1527892938.1417492374.jpg" width="139" height="200">
<img src="http://cdn.animenewsnetwork.com/thumbnails/hotlink-fit200x200/encyc/A16547-1527892938.1417492374.jpg" width="139" height="200" />
<img src="http://cdn.animenewsnetwork.com/thumbnails/hotlink-max500x600/encyc/A16547-1527892938.1417492374.jpg" width="174" height="250" />
</info>
<info gid="2071101469" type="Main title" lang="EN">Kono Danshi, Sekika ni Nayandemasu</info>
<info gid="367748411" type="Alternative title" lang="JA">この男子、石化に悩んでます。</info>
<info gid="742528363" type="Genres">supernatural</info>
<info gid="3133430704" type="Themes">yaoi</info>
<info gid="1492846673" type="Running time">26</info>


so thats like

<ann>
<anime> (use @XmlValue here maybe to grab 'anime id' and 'anime name'? need to check what it does exactly)
<info></info>
<info></info> (how to deal with multiple infos? maybe @XmlValue will straight up work here too to grab 'info src'. or maybe the parser will return a List of infos in this case)
.....
</anime
</ann>
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-16 01:49:40
April 16 2015 01:32 GMT
#12263
hi, im a bit stuck on this bit

so from what i can gather Ann (top class) returns as a list of Anime objects

the Anime class should have multiple attributes though: name, id and List of Info objects

FIXED
+ Show Spoiler +

so right now i have it looking like this:

public class Anime {

private String id;
private String name;
private List<Info> infolist;
...
public List<Info> getInfolist() {
return infolist;
}

public void setInfolist(List<Info> infolist) {
this.infolist = infolist;
}
...
public Anime(String id, String name, List<Info> infolist) {
this.infolist = infolist;
this.id = id;
this.name = name;
}


this looks different to the Ann class where i have

public class Ann {

private List<Anime> Ann = new ArrayList<Anime>();

@XmlElement(name="anime")
public List<Anime> getAnn() {
return Ann;
}

public void setAnn(List<Anime> Ann) {
this.Ann = Ann;
}


after unmarshalling the xml file into Ann, i am able to perform

for (Anime anime : ann.getAnn()) {

System.out.println("ID: " + anime.getId());
System.out.println("Name: " + anime.getName());

this works.

however i am struggling to be able to access the Info list that should be in the anime class.

i guess the question is, how do i correctly set a list of Info as an attribute of the anime class

Anime class did look similar to Ann to begin with, as below, but i thought maybe that was wrong


public class Anime {

private String id;
private String name;
private List<Info> Anime = new ArrayList<Info>();
...
public Anime(String id, String name) {
this.id = id;
this.name = name;
}



i reverted the code back to how it was in the tutorial (where the topmost class had only 1 attribute so i thought it might look different).

then in my unmarshaller i added a 2nd for loop to try to access the Info list , somehow i got the right syntax


for (Anime anime : ann.getAnn()) {

System.out.println("ID: " + anime.getId());
System.out.println("Name: " + anime.getName());

for (Info temp : anime.getAnime()){
System.out.println("Info: "+temp.getSrc());
}
}
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2015-04-16 01:53:34
April 16 2015 01:47 GMT
#12264
+ Show Spoiler [you fixed it] +
private List<Info> Anime = new ArrayList<Info>();

Why is the name of the variable Anime? Do you even need this field? Each Anime having a list of "Info" (whatever that means) seems pretty stupid in the first place. If you need more fields you can create them and call them things that actually make sense. You'd want to add fields for say release date or author rather than creating a list of Info.


I really dislike the idea of this Info class, but if it works then I won't rain on your parade.
I'll always be your shadow and veil your eyes from states of ain soph aur.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-16 01:59:28
April 16 2015 01:53 GMT
#12265
i'm using Info because its one of the XML tags... it occurs dozens of times for each anime entry with just random different info in:

- <info gid="1527892938" type="Picture" src="http://cdn.animenewsnetwork.com/thumbnails/fit200x200/encyc/A16547-1527892938.1417492374.jpg" width="139" height="200">
<img src="http://cdn.animenewsnetwork.com/thumbnails/hotlink-fit200x200/encyc/A16547-1527892938.1417492374.jpg" width="139" height="200" />
<img src="http://cdn.animenewsnetwork.com/thumbnails/hotlink-max500x600/encyc/A16547-1527892938.1417492374.jpg" width="174" height="250" />
</info>
<info gid="2071101469" type="Main title" lang="EN">Kono Danshi, Sekika ni Nayandemasu</info>
<info gid="367748411" type="Alternative title" lang="JA">この男子、石化に悩んでます。</info>
<info gid="742528363" type="Genres">supernatural</info>
<info gid="3133430704" type="Themes">yaoi</info>
etc


so i'm currently saving everything in an info tag into an Info object


@XmlRootElement (name="info")
public class Info {

private String src;

@XmlAttribute(name="src")
public String getSrc() {
return src;
}


and taking the @XmlAttribute from each info entry (if it exists) (only 1 exists per anime and i only need the 1, so that's handy) and accessing it with info.getSrc

right now i'm getting....

[image loading]

which is basically "HOLY FUCK I DONE IT AND SO FAST LOL OMFG TNX TUTORIAL also tnx brain and planning on paper lol"

btw is it normal for netbeans to ramp up to 1,300,000 memory lol

look lol

[image loading]
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2015-04-16 02:05:16
April 16 2015 01:58 GMT
#12266
On April 16 2015 10:53 FFGenerations wrote:
btw is it normal for netbeans to ramp up to 1,300,000 memory lol


Well each of those Info objects is at least 20 bytes and then you have a ton of them per parse so...

catch (Exception e)


My eyes are bleeding. I guess if you're just going to print the message then maybe it doesn't matter, but ^_^
I'll always be your shadow and veil your eyes from states of ain soph aur.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-16 02:36:54
April 16 2015 02:05 GMT
#12267
what i would delete that shit but it probably goes all red

i'm going to use the data to populate a webpage frontend for the user and also save it to a local database or do something else with it

i guess my next task is to go figure out the API get request so it doesn't look like a complete hackjob




i have a sort of interesting question .... how would i describe what this is doing in non-retard terms? for example i am trying to describe it like:

"custom parser that unmarshalls desired data from my sample nested xml file into objects with inheritance " <- this last bit, how should it be described? i want to indicate that the classes are connected and also use Lists as attributes.....

silly question but maybe you wanna answer it . i'm really bad at using terminology . i guess i could phrase it "custom parser that unmarshalls desired data from my sample nexted xml file into objects using inheritance and lists as attributes"
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
April 16 2015 02:47 GMT
#12268
I'm pretty bad at jargon too, so can't really help you there . It's basically a practice thing.

Also, you seem to over-complicating things by having an Info class. If the data is stored like this:
<anime id="16547" gid="1838091909" type="OAV" name="Kono Danshi, Sekika ni Nayandemasu" precision="OAV" generated-on="2015-04-14T20:49:39Z">
<info gid="2071101469" type="Main title" lang="EN">Kono Danshi, Sekika ni Nayandemasu</info>
<info gid="367748411" type="Alternative title" lang="JA">この男子、石化に悩んでます。</info>
<info gid="742528363" type="Genres">supernatural</info>
<info gid="3133430704" type="Themes">yaoi</info>
<info gid="1492846673" type="Running time">26</info>
</anime>


Then you should be parsing the type field in the info tags, and then pass the value into a variable in the Anime class. Basically, your class should look something like this:
class Anime{
private string title;
private string altTitle;
private string genre;
private List<string> themes; //assuming >1 theme is possible, otherwise just a single string
private double runTime;
}
Average means I'm better than half of you.
phar
Profile Joined August 2011
United States1080 Posts
April 16 2015 03:05 GMT
#12269
^^ strongly agree with using separate fields for things instead of just generic repeated info

You can heave a repeated info for unknown info tags if you want, but try to get more stuff parsed in up front, it's more useful.
Who after all is today speaking about the destruction of the Armenians?
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2015-04-16 03:07:43
April 16 2015 03:06 GMT
#12270
On April 16 2015 11:05 FFGenerations wrote:

"custom parser that unmarshalls desired data from my sample nested xml file into objects with inheritance " <- this last bit, how should it be described? i want to indicate that the classes are connected and also use Lists as attributes.....

silly question but maybe you wanna answer it . i'm really bad at using terminology . i guess i could phrase it "custom parser that unmarshalls desired data from my sample nexted xml file into objects using inheritance and lists as attributes"


Well you didn't actually end up using inheritance so that would just be a lie. We thought you needed inheritance because you had Anime and Manga classes before, but the Manga class disappeared so you don't need/aren't using inheritance.

The application services client anime requests by acquiring the information from <webservice> and displaying them in a user friendly manner. How this works under the hood is irrelevant unless that is what you're supposed to be describing.
I'll always be your shadow and veil your eyes from states of ain soph aur.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-16 03:21:46
April 16 2015 03:19 GMT
#12271
i'm not sure if that is possible

the way i am doing it is

look at @XmlRootElement (name="info")
look at @XmlAttribute(name="src")
save this


if there is an xml parser functionality that lets me check for Picture inside Infos then take the corresponding SRC from that Info and put it straight into Anime then sure....but i don't know if @XmlAttribute or @Something exists to do that

if anything there might be a plugin that lets you do that, like it autoscans the document and returns X for your nomatter where X is located...........

there is no fucking way i'm getting into that though :D i've got 4 days to finish this and then 4 days to do 2 other major assignments . edit: unless there is @functionality that just does that.............
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
FFGenerations
Profile Blog Joined April 2011
7088 Posts
April 16 2015 03:23 GMT
#12272
On April 16 2015 12:06 Blitzkrieg0 wrote:
Show nested quote +
On April 16 2015 11:05 FFGenerations wrote:

"custom parser that unmarshalls desired data from my sample nested xml file into objects with inheritance " <- this last bit, how should it be described? i want to indicate that the classes are connected and also use Lists as attributes.....

silly question but maybe you wanna answer it . i'm really bad at using terminology . i guess i could phrase it "custom parser that unmarshalls desired data from my sample nexted xml file into objects using inheritance and lists as attributes"


Well you didn't actually end up using inheritance so that would just be a lie. We thought you needed inheritance because you had Anime and Manga classes before, but the Manga class disappeared so you don't need/aren't using inheritance.

The application services client anime requests by acquiring the information from <webservice> and displaying them in a user friendly manner. How this works under the hood is irrelevant unless that is what you're supposed to be describing.


i was just describing the "prototype version" for when i have to write about it and sound mildly technical or whatever
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
April 16 2015 03:29 GMT
#12273
Well, can't help you with the specifics because I haven't used JAXB before. That said, this is the part where you learn that your power to Google is what makes you a programmer :D.
Average means I'm better than half of you.
ArchmageKruzer
Profile Joined August 2013
64 Posts
April 16 2015 03:43 GMT
#12274
So a couple of my friends and I want to make an IOS game. Currently we're writing the code in Java and then we're gonna import it into IOS. My question is is this a good idea, and if so, do you have any tricks and stuff to make the import easier, since there are probably gonna be like a million things going wrong once we do it.
Also, i've been poking around for engines, and 5 mins of google got me to the Unreal engine, which seems pretty OK. Any engine suggestions for IOS games, and tips/tutorials on how to use them?
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-16 13:17:07
April 16 2015 04:30 GMT
#12275
+ Show Spoiler +
(ignore this bit)
+ Show Spoiler +
so apparently you don't need to use REST web services, you can just have

URL url = new URL( "http://cdn.animenewsnetwork.com/encyclopedia/api.xml?title=~neon genesis" );

Ann ann = (Ann) ums.unmarshal(url);

and it does the get request and puts it straight into your parser. wtf. that is insane
i just shaved like 40 years off my life


i think i move on to figuring out how to make it into MVC now with a basic web frontend and then add a database functionality and then add jquery stuff



question about what i do next:

am i supposed to have the anime classes as managed java beans or can i keep them as they are and just print the data to a jsp page via a servlet controller?

ive been fucking around for a while and ended up with an insane mess and getting no error but it just fails to run with no error specification . at one point i tried to add bean annotations ontop of the xml annotations but it gave me a frowny face and i backed off for the time being

this is what i've got in my head so far:
1) jsp frontend page that takes the user's search string in a form
2) servlet page that takes this and passes it to my service class
3) the service class does GET request and parses the response into the anime objects
4) but then how do i access this data ? does it need to be turned into a java managed bean? can i access it directly from the jsp page? does it need to go through the servlet controller?

ill come back in 8 hours or whatever after i slept

have been trying random stuff but there's tons of stuff to try and that's before i even go to one of the super heavy tutorials .

edit: maybe i make session facade bean from the Ann java class and then use that to do stuff. if it lets me annotate it



OK here is what i've got so far. it runs , time-outs for about 9 seconds, then displays the HTML ("end") ie it doesnt display the object data

ControllerServlet.java
+ Show Spoiler +


ControllerServlet.java

package main;

import entities.Anime;
import entities.Ann;
import entities.Info;
import java.io.IOException;
import java.io.PrintWriter;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(name = "ControllerServlet", urlPatterns = {"/ControllerServlet"})
public class ControllerServlet extends HttpServlet {

@EJB
private AnnJAXB annJAXB = new AnnJAXB();

@EJB
private Ann ann = new Ann();

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet ControllerServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet ControllerServlet at " + request.getContextPath() + "</h1>");

AnnJAXB.Unmarshalling("evangelion");

for (Anime anime : ann.getAnn()) {

out.println("<h1>ID: " + anime.getId() + "</h1>");
out.println("<h1>Name: " + anime.getName() + "</h1>");

for (Info temp : anime.getAnime()) {
if (temp.getSrc() != null) {
out.println("<h1>Info: " + temp.getSrc() + "</h1>");
}
}
}

out.println("<h1>End</h1>");
out.println("</body>");
out.println("</html>");
}
}


AnnJAXB.java
+ Show Spoiler +


package main;

import entities.*;
import javax.xml.bind.*;
import java.io.*;
import java.net.URL;
import javax.ejb.Stateless;

@Stateless
public class AnnJAXB {

public static void Unmarshalling(String searchString) {
try {

JAXBContext jc = JAXBContext.newInstance(Ann.class);
Unmarshaller ums = jc.createUnmarshaller();
URL url = new URL( "http://cdn.animenewsnetwork.com/encyclopedia/api.xml?title=~"+searchString );

Ann ann = (Ann) ums.unmarshal(url);


} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}



when i remove the line AnnJAXB.Unmarshalling("evangelion"); it runs and displays the html instantly, so that bit there is causing it to time out and return nothing from it.

the obvious problem is in AnnJAXB at the line

Ann ann = (Ann) ums.unmarshal(url);

for this it says Variable ann is not used

the other bit that looks weird is
 @EJB
private AnnJAXB annJAXB = new AnnJAXB();

@EJB
private Ann ann = new Ann();
bit


posted to stackoverflow, easier to read http://stackoverflow.com/questions/29674404/mvc-object-method-and-serlvet-structure-help-in-java-please


i tried changing AnnJAXB Unmarshall to return an Ann instead of being static void method. i managed to get it to work eventually but its still hanging like previous version then not displaying the object data.

controllerservlet
+ Show Spoiler +


package main;

import entities.Anime;
import entities.Ann;
import entities.Info;
import java.io.IOException;
import java.io.PrintWriter;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
*
* @author J
*/
@WebServlet(name = "ControllerServlet", urlPatterns = {"/ControllerServlet"})
public class ControllerServlet extends HttpServlet {

// @EJB
// private AnnJAXB annJAXB = new AnnJAXB();

@EJB
private Ann ann;

/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet ControllerServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet ControllerServlet at " + request.getContextPath() + "</h1>");

AnnJAXB an = new AnnJAXB();
try{
an.Unmarshalling("evangelion");
}catch(Exception e){}

for (Anime anime : ann.getAnn()) {

out.println("<h1>ID: " + anime.getId() + "</h1>");
out.println("<h1>Name: " + anime.getName() + "</h1>");

for (Info temp : anime.getAnime()) {
if (temp.getSrc() != null) {
out.println("<h1>Info: " + temp.getSrc() + "</h1>");
}
}
}

out.println("<h1>End</h1>");
out.println("</body>");
out.println("</html>");
}
}



annjaxb

+ Show Spoiler +


package main;

import entities.*;
import javax.xml.bind.*;
import java.io.*;
import java.net.URL;
import java.net.MalformedURLException;
import javax.ejb.Stateless;

@Stateless
public class AnnJAXB {

public Ann Unmarshalling(String searchString) throws JAXBException, MalformedURLException {


JAXBContext jc = JAXBContext.newInstance(Ann.class);
Unmarshaller ums = jc.createUnmarshaller();
URL url = new URL( "http://cdn.animenewsnetwork.com/encyclopedia/api.xml?title=~"+searchString );


Ann ann = (Ann) ums.unmarshal(url);

return ann;
}
}



i have no words

[image loading]
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Manit0u
Profile Blog Joined August 2004
Poland17692 Posts
April 16 2015 19:25 GMT
#12276
On April 16 2015 10:53 FFGenerations wrote:
btw is it normal for netbeans to ramp up to 1,300,000 memory lol


*reads the word "netbeans"*

*averts his eyes*
Time is precious. Waste it wisely.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-16 22:38:54
April 16 2015 22:38 GMT
#12277
OK so the animenewsnetwork is online again now so I can finally test what I was doing all that time. It loads without timing out but nothing in the For loop , neither the html nor the Ann attributes, are displayed.

I posted a well-formatted version to http://stackoverflow.com/questions/29687169/accessing-an-instance-of-an-object-from-a-serlvet-in-java-web-application

If you could have a glimpse that would be awesome :/

I just woke up so gonna take another look in a min
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
berated-
Profile Blog Joined February 2007
United States1134 Posts
Last Edited: 2015-04-16 23:06:49
April 16 2015 23:06 GMT
#12278
On April 17 2015 07:38 FFGenerations wrote:
OK so the animenewsnetwork is online again now so I can finally test what I was doing all that time. It loads without timing out but nothing in the For loop , neither the html nor the Ann attributes, are displayed.

I posted a well-formatted version to http://stackoverflow.com/questions/29687169/accessing-an-instance-of-an-object-from-a-serlvet-in-java-web-application

If you could have a glimpse that would be awesome :/

I just woke up so gonna take another look in a min


Are those your only 3 classes in SO. It's kind of hard to troubleshoot code without being able to run it. Did someone already talk to you about possibly putting your stuff on github or something if you want more help?

Edit: Definitely not your only 3 classes. See question above
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-16 23:16:17
April 16 2015 23:15 GMT
#12279
hey dude, here is a zip file with the project (if google drive lets you share zipped code)

https://drive.google.com/file/d/0BzIvzoW04fGQbUdMT3RYVXN5ODA/view?usp=sharing


i got stuck trying to get git to work a while back and havent tried to use it since. i will sort that out sometime
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-16 23:34:05
April 16 2015 23:26 GMT
#12280
STOP I FIXED IT HOLY FUCKING CHRIST


I changed the loop to say:
+ Show Spoiler +

 for (Anime anime : annj.Unmarshalling("evangelion").getAnn()) {


and removed

 annj.Unmarshalling("evangelion");


so it looks like


try{
for (Anime anime : annj.Unmarshalling("evangelion").getAnn()) {

out.println("<h1>Loop1</h1>");

out.println("<h1>ID: " + anime.getId() + "</h1>");
out.println("<h1>Name: " + anime.getName() + "</h1>");

for (Info temp : anime.getAnime()) {
if (temp.getSrc() != null) {
out.println("<h1>Info: " + temp.getSrc() + "</h1>");
}
}
}}catch(Exception e){}

out.println("<h1>End</h1>");
out.println("</body>");
out.println("</html>");


pic

+ Show Spoiler +

[image loading]
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Prev 1 612 613 614 615 616 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 41m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft274
ProTech127
JuggernautJason106
StarCraft: Brood War
NaDa 22
Jaeyun 5
Dota 2
monkeys_forever300
capcasts90
Counter-Strike
minikerr8
Heroes of the Storm
Liquid`Hasu326
Other Games
summit1g11748
Grubby3978
FrodaN3956
shahzam612
byalli451
KnowMe358
C9.Mang0175
ViBE75
PPMD28
Organizations
Other Games
gamesdonequick2235
ComeBackTV 188
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• musti20045 42
• davetesta33
• Kozan
• Migwel
• sooper7s
• AfreecaTV YouTube
• intothetv
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• RayReign 61
• Azhi_Dahaki10
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21236
League of Legends
• Doublelift5105
Other Games
• imaqtpie1146
• Scarra1081
Upcoming Events
Replay Cast
41m
CranKy Ducklings
10h 41m
RSL Revival
10h 41m
MaxPax vs Rogue
Clem vs Bunny
WardiTV Team League
12h 41m
uThermal 2v2 Circuit
17h 41m
BSL
20h 41m
Sparkling Tuna Cup
1d 10h
RSL Revival
1d 10h
ByuN vs SHIN
Maru vs Krystianer
WardiTV Team League
1d 12h
Patches Events
1d 17h
[ Show More ]
BSL
1d 20h
Replay Cast
2 days
Replay Cast
2 days
Wardi Open
2 days
Monday Night Weeklies
2 days
WardiTV Team League
3 days
GSL
4 days
The PondCast
5 days
WardiTV Team League
5 days
Replay Cast
6 days
WardiTV Team League
6 days
Liquipedia Results

Completed

Proleague 2026-03-12
WardiTV Winter 2026
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
Jeongseon Sooper Cup
BSL Season 22
Proleague 2026-03-13
RSL Revival: Season 4
Nations Cup 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

CSL Elite League 2026
ASL Season 21
Acropolis #4 - TS6
2026 Changsha Offline CUP
Acropolis #4
IPSL Spring 2026
CSLAN 4
HSC XXIX
uThermal 2v2 2026 Main Event
NationLESS Cup
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.